summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/bootstrap.sh57
1 files changed, 52 insertions, 5 deletions
diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh
index 6948801a8..ce81f481b 100755
--- a/scripts/bootstrap.sh
+++ b/scripts/bootstrap.sh
@@ -214,6 +214,12 @@
# It is not currently possible to safely reuse any of the output
# if the target architecture is changed. You will need to start
# from scratch if you wish to change the target. This is a TODO.
+#
+#
+# todo
+# ----
+#
+# * Do not inherit the build environment; avoid contamination.
#
HERE="$(dirname $(readlink -f ${0}))";
@@ -322,7 +328,7 @@ if ! test -d "${MTOOLS}/sys/emus/bin"; then # FIXME: no hard code
test -d bootstrap \
|| git clone ${CHAINS}/bootstrap.git;
cd bootstrap;
- git checkout d148555321a391fd6f23a289fa51c2dfa26f4b10;
+ git checkout 2a79c1e5ea43e6fab23cf1e18b8a4104cfb9cef1;
## seed rootfs
#
@@ -389,7 +395,7 @@ fi
#
# Build both. We will eventually need both toolchains, anyway.
#
-if ! test -d "${MTOOLS}/sys/tc/native"; then # FIXME: no hard code
+if ! test -d "${MTOOLS}"/sys/tc/native; then # FIXME: no hard code
cd "${BASE}";
test -d musl-cross-make \
@@ -454,8 +460,6 @@ ${MTOOLS}/sys/emus/bin/proot \
# mcmtools (host)
##
-# Build the 'system/' repository.
-#
# NOTE: The 'PATH' order is *really* important. Foreign "native"
# toolchains must be the first ones found; e.g. '/usr/bin/gcc'
# is a symlink to 'ccache' and isn't a functional compiler.
@@ -468,14 +472,21 @@ ${MTOOLS}/sys/emus/bin/proot \
# Error loading shared library libgcc_s.so.1:
# Exec format error (needed by ...)
#
+# NOTE: We *do* need to build 'musl-cross-make' (even though it
+# may seem redundant) so that we can safely install the dynamic
+# loader. If we do not do this, we're on the hook to symlink it.
+#
# Once 'coreutils' is built, 'uname' will return correctly, then
# future software should(tm) build as if it is built natively.
#
# FIXME: is Linux 3.2.0 really appropriate here?
#
+# TODO: add 'if' gate for whether to execute this ... don't want
+# to run it every time.
+if ! test -d "${BASE}"/mcmtools-${TARGET}/sys/tc/musl/bin; then # FIXME: no hard code
PROOT_NO_SECCOMP=1 \
PATH="/tc/native/bin:${DEF_PATH}" \
-LD_LIBRARY_PATH=/tc/native/lib \
+LD_LIBRARY_PATH=/tc/native/lib \
SHELL=/bin/sh \
BASE="${BASE}" \
DEST="${BASE}"/mcmtools-${TARGET} \
@@ -488,6 +499,42 @@ ${MTOOLS}/sys/emus/bin/proot \
-k "3.2.0" \
"${BASE}"/bootstrap/bootstrap \
;
+fi
+
+##
+# Install the native static toolchain over the native rootfs for
+# a quick way to have the dynamic loader. Overwrite the symlink!
+#
+if test -h "${BASE}"/mcmtools-${TARGET}/sys/bin/gcc; then # FIXME: no hard code
+ tar -C "${BASE}"/mcmtools-${TARGET}/sys \
+ --strip-components=1 \
+ -xzf "${BASE}"/musl-cross-make/output/${TARGET}-native.tgz \
+ ;
+fi
+
+
+#---------------------------------------------------------------
+# build tools (host)
+
+##
+# Build 'abuild', its dependencies, and other utilities.
+#
+PROOT_NO_SECCOMP=1 \
+PATH="/tc/musl/bin:${DEF_PATH}" \
+SHELL=/bin/sh \
+DEST=/usr/local \
+CURL_CA_BUNDLE=/cacert.pem \
+CC=gcc \
+CXX=g++ \
+AR=ar \
+LD=ld \
+CPP=cpp \
+${MTOOLS}/sys/emus/bin/proot \
+ -S "${BASE}"/mcmtools-${TARGET}/sys \
+ -q "${MTOOLS}"/sys/emus/bin/qemu-${q} \
+ -b "${HERE}" \
+ "${HERE}"/bootstrap-abuild \
+ ;
#---------------------------------------------------------------