summaryrefslogtreecommitdiffstats
path: root/bootstrap.sh
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-02 00:48:39 (GMT)
committerEvan Martin <martine@danga.com>2011-05-02 01:02:13 (GMT)
commitd7bd4a2367046ee0458123051d9cbdc465d022d1 (patch)
treed3c92ec32dce8649b0d39786254b2a4c64099acf /bootstrap.sh
parent101d9b2d14f6877818787921bad55783ad76f6f4 (diff)
downloadNinja-d7bd4a2367046ee0458123051d9cbdc465d022d1.zip
Ninja-d7bd4a2367046ee0458123051d9cbdc465d022d1.tar.gz
Ninja-d7bd4a2367046ee0458123051d9cbdc465d022d1.tar.bz2
check in a script that generates build.ninja
This will allow us to: 1) simplify bootstrap 2) generate windows-style paths on windows It is also in line with ninja's philosophy: the build file syntax is simple because the build files are easy to generate.
Diffstat (limited to 'bootstrap.sh')
-rwxr-xr-xbootstrap.sh22
1 files changed, 8 insertions, 14 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 7722c18..6ff90e5 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -18,30 +18,24 @@ set -e
SYSTEMNAME=`uname -s`
+# Compute system-specific CFLAGS/LDFLAGS as used in both in the below
+# g++ call as well as in the later gen-build-file.py.
if [ "${SYSTEMNAME}" = "Linux" ]; then
- EXTRA_CFLAGS=
- EXTRA_LDFLAGS=
+ export CFLAGS=
+ export LDFLAGS=
elif [ "${SYSTEMNAME}" = "FreeBSD" ]; then
- EXTRA_CFLAGS="-I/usr/local/include"
- EXTRA_LDFLAGS="-L/usr/local/lib"
+ export CFLAGS="-I/usr/local/include"
+ export LDFLAGS="-L/usr/local/lib"
fi
-cat >config.ninja <<EOT
-# This file is generated by bootstrap.sh.
-conf_cflags = -O2 ${EXTRA_CFLAGS}
-conf_ldflags = -s ${EXTRA_LDFLAGS}
-# When developing:
-# conf_cflags = -g -Wall ${EXTRA_CFLAGS}
-# conf_ldflags = ${EXTRA_LDFLAGS}
-EOT
-
echo "Building ninja manually..."
mkdir -p build
./src/inline.sh kBrowsePy < src/browse.py > build/browse_py.h
srcs=$(ls src/*.cc | grep -v test)
-g++ -Wno-deprecated ${EXTRA_CFLAGS} ${EXTRA_LDFLAGS} -o ninja.bootstrap $srcs
+g++ -Wno-deprecated ${CFLAGS} ${LDFLAGS} -o ninja.bootstrap $srcs
echo "Building ninja using itself..."
+./gen-build-file.py > build.ninja
./ninja.bootstrap ninja
rm ninja.bootstrap