From 7e096227d4f1663928a2c7383a51b3bba3328e83 Mon Sep 17 00:00:00 2001 From: Aditya Date: Thu, 12 Jan 2023 14:37:49 +0530 Subject: [PATCH] Add 8.52 - Build ninja --- scripts/chapter8/8.52-ninja.sh | 31 +++++++++++++++++++++++++++++++ scripts/main.sh | 12 ++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 scripts/chapter8/8.52-ninja.sh diff --git a/scripts/chapter8/8.52-ninja.sh b/scripts/chapter8/8.52-ninja.sh new file mode 100644 index 0000000..cdda4cd --- /dev/null +++ b/scripts/chapter8/8.52-ninja.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +cd /sources +tar xf ninja-1.11.0.tar.gz +cd ninja-1.11.0 + +export NINJAJOBS=4 + +sed -i '/int Guess/a \ + int j = 0;\ + char* jobs = getenv( "NINJAJOBS" );\ + if ( jobs != NULL ) j = atoi( jobs );\ + if ( j > 0 ) return j;\ +' src/ninja.cc + +python3 configure.py --bootstrap + +if [ $? -ne 0 ] +then + exit 1 +fi + +./ninja ninja_test +./ninja_test --gtest_filter=-SubprocessTest.SetWithLots + +install -vm755 ninja /usr/bin/ +install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja +install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja + +cd /sources +rm -rf ninja-1.11.0 diff --git a/scripts/main.sh b/scripts/main.sh index b906f0b..0c69c4e 100644 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -1162,3 +1162,15 @@ then stop_script "chapter8/8.51-wheel.sh" fi +# Chapter 8.52 +# ============ +echo "Building ninja" +su -c "bash $SCRIPT/chapter8/8.52-ninja.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter8/8.52-ninja.sh" +fi +