- Linux or macOS
- Python 3.7+
Unlike Make and CMake, which are almost ubiquitous on every developer's machine, Ninja and GN are niche. Therefore, the proxy scripts ninja.py and gn.py will download the binaries over the network on first invocation if:
ninjaandgnare missing fromPATH, orninjaandgnare found onPATH, butgclientis also found onPATH(presence ofgclientimplies theninjaandgncommands found are customized for the Chromium projects).
The zipball URLs for downloading are in the get_binaries.py
source, or can be shown with command get_binaries.py --show-urls.
After downloading, the binaries will be stored in bin/linux (or bin/mac if
you are on a macOS). They will not be added to your PATH. Instead, you should
call the proxy scripts in lieu of calling the binaries.
If you wish not to download Ninja and GN binaries over the network or there's an error, you can tell the proxy scripts to use locally-built/installed binaries.
# Assume you are at this directory.
# step 1: create bin/XXX and change working directory
mkdir -p bin/linux # on macOS: mkdir -p bin/mac
cd bin/linux # on macOS: cd bin/mac
# step 2: make symlinks
ln -s /path/to/your/gn gn
ls -s /path/to/your/ninja ninja
# step 3: verify
cd ../..
./gn.py --version
./ninja.py --version