aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-14 12:16:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-15 13:46:11 +0200
commit91364b58fa5cc224e80209e28e62613ca36dc4a9 (patch)
tree8b11e1ffca0b25682dfa20da5431c967b3f97175 /etc
parent2068fd01f5acebeea9f0b92fbc43426772b10538 (diff)
Command line interface redesign for bootstrap scripts
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bootstrap/bbot-bootstrap-freebsd.sh7
-rwxr-xr-xetc/bootstrap/bbot-bootstrap-linux.sh7
-rwxr-xr-xetc/bootstrap/bbot-bootstrap-macos.sh18
-rw-r--r--etc/bootstrap/bbot-bootstrap.service6
-rwxr-xr-xetc/bootstrap/bbot-bootstrap.sh39
-rw-r--r--etc/bootstrap/bbot-rc-d2
6 files changed, 47 insertions, 32 deletions
diff --git a/etc/bootstrap/bbot-bootstrap-freebsd.sh b/etc/bootstrap/bbot-bootstrap-freebsd.sh
index 06f3d45..e2306ab 100755
--- a/etc/bootstrap/bbot-bootstrap-freebsd.sh
+++ b/etc/bootstrap/bbot-bootstrap-freebsd.sh
@@ -19,12 +19,9 @@ fi
cd /tmp
ulimit -c unlimited
-# Note: bootstrap script options must come before build options.
+# Note: bootstrap script options must come before build.sh options/arguments.
#
-"$(dirname "$0")/bbot-bootstrap.sh" \
- "$@" \
- --make gmake \
- --make "-j$jobs"
+"$(dirname "$0")/bbot-bootstrap.sh" --make gmake --jobs "$jobs" "$@"
# If success, wait a bit and shutdown. Otherwise leave the machine running
# for investigation.
diff --git a/etc/bootstrap/bbot-bootstrap-linux.sh b/etc/bootstrap/bbot-bootstrap-linux.sh
index 5d84877..d25944d 100755
--- a/etc/bootstrap/bbot-bootstrap-linux.sh
+++ b/etc/bootstrap/bbot-bootstrap-linux.sh
@@ -13,12 +13,9 @@ fi
cd /tmp
ulimit -c unlimited
-# Note: bootstrap script options must come before build options.
+# Note: bootstrap script options must come before build.sh options/arguments
#
-"$(dirname "$0")/bbot-bootstrap.sh" \
- "$@" \
- --make make \
- --make "-j$jobs"
+"$(dirname "$0")/bbot-bootstrap.sh" --make make --jobs "$jobs" "$@"
# If success, wait a bit and shutdown. Otherwise leave the machine running
# for investigation.
diff --git a/etc/bootstrap/bbot-bootstrap-macos.sh b/etc/bootstrap/bbot-bootstrap-macos.sh
index 92aedaa..0163c49 100755
--- a/etc/bootstrap/bbot-bootstrap-macos.sh
+++ b/etc/bootstrap/bbot-bootstrap-macos.sh
@@ -6,6 +6,8 @@
# open -a Terminal -n -F ~/bbot-bootstrap-macos.sh
+cxx=clang++
+
if ! jobs="$(sysctl -n hw.ncpu)"; then
jobs=1
fi
@@ -14,15 +16,15 @@ fi
#
ulimit -c unlimited
-# Note: bootstrap script options must come before build options.
+# Note: bootstrap script options must come before build.sh options/arguments.
#
-"$(dirname "$0")/bbot-bootstrap.sh" \
- --cxx clang++ \
- --build /tmp \
- --environments "$HOME/environments" \
- "$@" \
- --make make \
- --make "-j$jobs"
+"$(dirname "$0")/bbot-bootstrap.sh" \
+--build /tmp \
+--environments "$HOME/environments" \
+--make make \
+--jobs "$jobs" \
+"$cxx" \
+"$@"
# If success, wait a bit and shutdown. Otherwise leave the machine running
# for investigation.
diff --git a/etc/bootstrap/bbot-bootstrap.service b/etc/bootstrap/bbot-bootstrap.service
index 3e4cba0..6dbf365 100644
--- a/etc/bootstrap/bbot-bootstrap.service
+++ b/etc/bootstrap/bbot-bootstrap.service
@@ -18,9 +18,9 @@ Environment=BUILD=/tmp
Environment=ENVIRONMENTS=/home/build/environments
ExecStart=/usr/local/bin/bbot-bootstrap-linux.sh \
- --cxx ${CXX} \
- --build ${BUILD} \
- --environments ${ENVIRONMENTS}
+--build ${BUILD} \
+--environments ${ENVIRONMENTS} \
+${CXX}
StandardInput=tty-force
StandardOutput=inherit
diff --git a/etc/bootstrap/bbot-bootstrap.sh b/etc/bootstrap/bbot-bootstrap.sh
index d2153e8..4914ae4 100755
--- a/etc/bootstrap/bbot-bootstrap.sh
+++ b/etc/bootstrap/bbot-bootstrap.sh
@@ -33,22 +33,15 @@ run ()
# Defaults that can be changed via command line.
#
-cxx=g++
build=/tmp
environments="$HOME/environments"
+make=
+jobs=
# Parse options.
#
while test $# -ne 0; do
case $1 in
- --cxx)
- shift
- if test $# -eq 0; then
- error "missing C++ compiler after --cxx"
- fi
- cxx="$1"
- shift
- ;;
--build)
shift
if test $# -eq 0; then
@@ -65,6 +58,22 @@ while test $# -ne 0; do
environments="$1"
shift
;;
+ --make)
+ shift
+ if test $# -eq 0; then
+ error "missing make program after --make"
+ fi
+ make="$1"
+ shift
+ ;;
+ --jobs)
+ shift
+ if test $# -eq 0; then
+ error "missing jobs number after --jobs"
+ fi
+ jobs="$1"
+ shift
+ ;;
*)
break
;;
@@ -85,6 +94,16 @@ timeout=600
#tftp="127.0.0.1:55123"
#build_options="--install-dir $install"
+# If make was specified, add it to build_options.
+#
+if test -n "$make"; then
+ build_options="$build_options --make $make"
+
+ if test -n "$jobs"; then
+ build_options="$build_options --make -j$jobs"
+ fi
+fi
+
PATH="$install/bin:$PATH"
export PATH
@@ -121,7 +140,7 @@ run rm trust
#
bstrap="$(echo build2-toolchain-*)"
run cd "$bstrap"
-run ./build.sh --timeout "$timeout" --trust "$trust" $build_options "$@" "$cxx"
+run ./build.sh --timeout "$timeout" --trust "$trust" $build_options "$@"
run cd ..
run rm -r "$bstrap"
diff --git a/etc/bootstrap/bbot-rc-d b/etc/bootstrap/bbot-rc-d
index bbde152..0ae4515 100644
--- a/etc/bootstrap/bbot-rc-d
+++ b/etc/bootstrap/bbot-rc-d
@@ -13,7 +13,7 @@ bbot_cxx=clang++
bbot_build=/tmp
bbot_environments="/home/$bbot_user/environments"
-start_cmd="/usr/sbin/daemon -u $bbot_user -t $name $command --cxx $bbot_cxx --build $bbot_build --environments $bbot_environments 2>&1 | /usr/bin/logger -p local1.info"
+start_cmd="/usr/sbin/daemon -u $bbot_user -t $name $command --build $bbot_build --environments $bbot_environments $bbot_cxx 2>&1 | /usr/bin/logger -p local1.info"
load_rc_config $name
run_rc_command "$1"