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 run, move the original
Ninja 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 process to make it do
so is the same: pass -j, where
<x> is the number of
logical CPUs you want to use whenever samu (or ninja if you made the symlink)
is run. You can get around having to specify it every time by
including <x>-j in <x>SAMUFLAGS like so:
export SAMUFLAGS=-j$(nproc)
If MAKEFLAGS only contains the
-j option, you can set SAMUFLAGS to MAKEFLAGS
like so:
export SAMUFLAGS=$MAKEFLAGS
If you'd like to avoid manually setting SAMUFLAGS each time you log in, add it to a Bash
profile script like ~/.bash_profile.