The samurai package provides a drop-in replacement for the Ninja package. It aims for full compatibility.
Install samurai by running the following commands:
make CC=cc CFLAGS+=" -std=c99"
Now, as the root user:
make PREFIX=/usr install
If you want samu to
be used whenever ninja is ran, move the original
Ninja copy out of the way and make a symlink as the root user:
mv /usr/bin/ninja{,.old} &&
ln -svf samu /usr/bin/ninja
samu won't run on
all logical CPUs or threads by default, similar to make. The premise to make it do
so is the same process: pass -j, where
<x> is the number of
logical CPUs you want used, whenever samu (or ninja if you made the symlink)
is ran. You can get around having to specify it everytime by
setting <x>SAMUFLAGS and including
-j to it, like so:
<x>
export SAMUFLAGS=-j$(nproc)
A trick you can do is make SAMUFLAGS
contain $MAKEFLAGS if MAKEFLAGS only contains the -j option, like so:
export SAMUFLAGS=$MAKEFLAGS
Add it to a Bash profile script like ~/.bash_profile to avoid having to set it after
logging in.