# When I originally created this very brief (read: half-ass) HOWTO, there
# was no Slackware package. Slackware 15.0 now includes a 'ninja' package.
# Below I leave the instructions for installing it from Git, and I add a
# section for installing 1.11.1 from a GitHub release tarball.
# This tarball-installed Ninja will match the prefix used by Slackware's
# package. If you have a ninja binary in /usr/local/bin, remove that
# before you install this one.
# Get the tarball
cd
test -f installed/ninja-1.11.1.tar.gz &&
mv -f installed/ninja-1.11.1.tar.gz .
test ! -f ninja-1.11.1.tar.gz &&
wget -O ninja-1.11.1.tar.gz https://github.com/ninja-build/ninja/archive/\
refs/tags/v1.11.1.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "ninja-*" -exec rm -r {} \;
tar xzvf ~/ninja-1.11.1.tar.gz
cd ninja-1.11.1
test $UID = 0 && chown -R root:root .
## Build it
# This will run it with 'python', if you have a 'python' and it is a symlink
# to Python 2.x, run this as 'python3 configure.py --bootstrap'
# If 'python' is a link (or a copy of) 'python3', then that is not necessary
./configure.py --bootstrap
# Build manual.html, or just read the docs online at
# https://ninja-build.org/manual.html
( cd doc
asciidoc -b docbook -o manual.docbook manual.asciidoc
docbook2html -u manual.docbook )
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg ninja
# If you have an old Ninja in /usr/local/bin, remove it
rm -f /usr/local/bin/ninja
# Remove old docs if this is an upgrade, in case a file is no longer
# included
test -d /usr/doc/ninja && rm -r /usr/doc/ninja
# Install it
# [ If you use Emacs, see misc/ninja-mode.el ]
install -s -m 755 ninja /usr/bin/
install -d /usr/doc/ninja
install -m 644 *.md COPYING RELEASING /usr/doc/ninja/
test -f doc/manual.html && install -m 644 doc/manual.html /usr/doc/ninja/
test -d /usr/share/bash-completion/completions &&
install -m 644 misc/bash-completion \
/usr/share/bash-completion/completions/ninja
test -d /usr/share/vim/vimfiles/syntax &&
install -m 644 misc/ninja.vim /usr/share/vim/vimfiles/syntax/ninja.vim
test -d /usr/share/zsh/site-functions &&
install -m 644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
# If you use Emacs, see misc/ninja-mode.el
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/ninja-*.tar.*
mv ninja-1.11.1.tar.gz installed/
# Ninja from Git
# ==============
mkdir -p -m 0700 ~/src
cd ~/src
test -d ./ninja &&
( cd ninja ; git pull )
test ! -d ninja &&
git clone git://github.com/ninja-build/ninja.git
cd ninja
git checkout release
# Build it
./configure.py --bootstrap
# You can view the documentation at https://ninja-build.com/manual.html
# or generate documentation
# (you may want to put manual.html in /usr/local/doc/ninja)
( cd doc
asciidoc -b docbook -o manual.docbook manual.asciidoc
docbook2html -u manual.docbook )
# Install the ninja binary
su -c "install -m 755 ninja /usr/local/bin/"