aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-10-20 13:31:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-10-20 13:31:52 +0200
commit1fcd5d1067254c40921df17b8de906c81934077a (patch)
tree71dc34b096c6ee9544d8e99c6240b7fbf4d3078d /etc
parent3ddab9d7360213cda421ac25f62cbf7ef92b513b (diff)
Add support for parallel bootstrap on Linux, Mac OS, and FreeBSD
Diffstat (limited to 'etc')
-rwxr-xr-xetc/bootstrap/bbot-bootstrap-freebsd.sh17
-rwxr-xr-xetc/bootstrap/bbot-bootstrap-linux.sh14
-rwxr-xr-xetc/bootstrap/bbot-bootstrap-macos.sh19
-rw-r--r--etc/bootstrap/bbot-bootstrap-mingw.bat6
-rw-r--r--etc/bootstrap/bbot-bootstrap.service2
-rwxr-xr-xetc/bootstrap/bbot-bootstrap.sh6
-rw-r--r--etc/bootstrap/bbot-rc-d9
7 files changed, 63 insertions, 10 deletions
diff --git a/etc/bootstrap/bbot-bootstrap-freebsd.sh b/etc/bootstrap/bbot-bootstrap-freebsd.sh
new file mode 100755
index 0000000..8a86696
--- /dev/null
+++ b/etc/bootstrap/bbot-bootstrap-freebsd.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# file : etc/bootstrap/bbot-bootstrap-freebsd.sh
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : TBC; see accompanying LICENSE file
+
+# Note: install GNU make with 'pkg install gmake'.
+#
+
+if ! jobs="$(sysctl -n hw.ncpu)"; then
+ jobs=1
+fi
+
+"$(dirname "$0")/bbot-bootstrap.sh" \
+ --make gmake \
+ --make "-j$jobs" \
+ "$@"
diff --git a/etc/bootstrap/bbot-bootstrap-linux.sh b/etc/bootstrap/bbot-bootstrap-linux.sh
new file mode 100755
index 0000000..0aa408d
--- /dev/null
+++ b/etc/bootstrap/bbot-bootstrap-linux.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# file : etc/bootstrap/bbot-bootstrap-linux.sh
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : TBC; see accompanying LICENSE file
+
+if ! jobs="$(nproc)"; then
+ jobs=1
+fi
+
+"$(dirname "$0")/bbot-bootstrap.sh" \
+ --make make \
+ --make "-j$jobs" \
+ "$@"
diff --git a/etc/bootstrap/bbot-bootstrap-macos.sh b/etc/bootstrap/bbot-bootstrap-macos.sh
index 039e802..e7f7be8 100755
--- a/etc/bootstrap/bbot-bootstrap-macos.sh
+++ b/etc/bootstrap/bbot-bootstrap-macos.sh
@@ -1,6 +1,19 @@
-#!/bin/bash
+#!/bin/sh
+
+# file : etc/bootstrap/bbot-bootstrap-macos.sh
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : TBC; see accompanying LICENSE file
# open -a Terminal -n -F ~/bbot-bootstrap-macos.sh
-~/bbot-bootstrap.sh --cxx clang++ --build /tmp \
- --environments "$HOME/environments"
+if ! jobs="$(sysctl -n hw.ncpu)"; then
+ jobs=1
+fi
+
+"$(dirname "$0")/bbot-bootstrap.sh" \
+ --cxx clang++ \
+ --build /tmp \
+ --environments "$HOME/environments" \
+ --make make \
+ --make "-j$jobs" \
+ "$@"
diff --git a/etc/bootstrap/bbot-bootstrap-mingw.bat b/etc/bootstrap/bbot-bootstrap-mingw.bat
index 9db41c8..a3ffa04 100644
--- a/etc/bootstrap/bbot-bootstrap-mingw.bat
+++ b/etc/bootstrap/bbot-bootstrap-mingw.bat
@@ -131,9 +131,13 @@ del trust
@for /D %%d in (build2-toolchain-*) do set "bstrap=%%d"
cd %bstrap%
+@rem Bootstrap in parallel using GNU make (which is part of our mingw
+@rem toolchain).
+@rem
@rem Note: executing in a separate cmd.exe to preserve the echo mode.
@rem
-cmd /C build-mingw.bat --timeout %TIMEOUT% g++ %INSTALL% %trust%
+cmd /C build-mingw.bat --make mingw32-make --make -j%NUMBER_OF_PROCESSORS%^
+ --timeout %TIMEOUT% g++ %INSTALL% %trust%
@if errorlevel 1 goto error
cd ..
diff --git a/etc/bootstrap/bbot-bootstrap.service b/etc/bootstrap/bbot-bootstrap.service
index 8879c72..3e4cba0 100644
--- a/etc/bootstrap/bbot-bootstrap.service
+++ b/etc/bootstrap/bbot-bootstrap.service
@@ -17,7 +17,7 @@ Environment=CXX=g++
Environment=BUILD=/tmp
Environment=ENVIRONMENTS=/home/build/environments
-ExecStart=/usr/local/bin/bbot-bootstrap.sh \
+ExecStart=/usr/local/bin/bbot-bootstrap-linux.sh \
--cxx ${CXX} \
--build ${BUILD} \
--environments ${ENVIRONMENTS}
diff --git a/etc/bootstrap/bbot-bootstrap.sh b/etc/bootstrap/bbot-bootstrap.sh
index e5ffe80..5908fe1 100755
--- a/etc/bootstrap/bbot-bootstrap.sh
+++ b/etc/bootstrap/bbot-bootstrap.sh
@@ -4,7 +4,7 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : TBC; see accompanying LICENSE file
-usage="Usage: $0 [<options>]"
+usage="Usage: $0 [<options>] [<build-options>]"
set -e # Exit on errors.
@@ -66,7 +66,7 @@ while test $# -ne 0; do
shift
;;
*)
- error "unexpected argument '$1'"
+ break
;;
esac
done
@@ -121,7 +121,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 "$@" "$cxx"
run cd ..
run rm -r "$bstrap"
diff --git a/etc/bootstrap/bbot-rc-d b/etc/bootstrap/bbot-rc-d
index 12fadcd..bbde152 100644
--- a/etc/bootstrap/bbot-rc-d
+++ b/etc/bootstrap/bbot-rc-d
@@ -5,10 +5,15 @@
. /etc/rc.subr
name=bbot
-command=/home/build/bbot-bootstrap.sh
+command=/home/build/bbot-bootstrap-freebsd.sh
command_interpreter=/bin/sh
+
bbot_user=build
-start_cmd="/usr/sbin/daemon -u $bbot_user -t $name $command --environments /home/build/environments 2>&1 | /usr/bin/logger -p local1.info"
+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"
load_rc_config $name
run_rc_command "$1"