aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-14 10:14:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-14 10:14:18 +0200
commitda2e2cca504e0ed7296edff128f5ac76f0fe1439 (patch)
treec8fae24bc6b1fb6016be00e8e2686bcd1abb58f7
parentd0e9c628f823655e4391f5c436bd086bb6bb2bc1 (diff)
Add support for passing compile options to build script
-rwxr-xr-xbuild.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 00b2675..51ad6b9 100755
--- a/build.sh
+++ b/build.sh
@@ -4,7 +4,7 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-usage="Usage: $0 [-h|--help] [<options>] <c++-compiler>"
+usage="Usage: $0 [-h|--help] [<options>] <c++-compiler> [<compile-options>]"
# Package repository URL (or path).
#
@@ -75,6 +75,13 @@ while test $# -ne 0; do
diag
diag "$0 --make gmake --make -j8 g++"
diag
+ diag "If specified, <compile-options> override the default (-O3) compile"
+ diag "options (config.cc.coptions) in the bpkg configuration used to build"
+ diag "and install the final toolchain. For example, to build with the debug"
+ diag "information (and without optimization):"
+ diag
+ diag "$0 g++ -g"
+ diag
diag "See the BOOTSTRAP-UNIX file for details."
diag
exit 0
@@ -151,6 +158,7 @@ while test $# -ne 0; do
;;
*)
cxx="$1"
+ shift
break
;;
esac
@@ -162,6 +170,12 @@ if test -z "$cxx"; then
exit 1
fi
+# Place default <compile-options> into the $@ array.
+#
+if test $# -eq 0; then
+ set -- -O3
+fi
+
# Only use default sudo for the default installation directory and only if
# it wasn't specified by the user.
#
@@ -280,7 +294,7 @@ cdir="$(pwd)" # Save full path for later.
run bpkg-stage $verbose create \
cc \
config.cxx="$cxx" \
-config.cc.coptions=-O3 \
+config.cc.coptions="'$@'" \
config.bin.rpath="$conf_rpath" \
config.install.root="$idir" \
config.install.sudo="$conf_sudo"