aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-10-02 22:41:55 -0500
committerRob Landley <rob@landley.net>2016-10-02 22:41:55 -0500
commit6c3188cf0e551cd07e28398262cffb8b5b82a114 (patch)
tree5a25e02dff6f340d20fc741304c76a95b9b38ffa
parent8d0f0b6ba864155914f88e39076213b4486efee4 (diff)
downloadtoybox-6c3188cf0e551cd07e28398262cffb8b5b82a114.tar.gz
Add install_airlock target for hermetic build environment setup, and rebuild
headers during install to make other install targets robust against single command builds between "make" and "make install" of multiplexer version.
-rw-r--r--Makefile4
-rwxr-xr-xscripts/install.sh61
2 files changed, 65 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6c5dd0d4..cd21798e 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,9 @@ bloatcheck: toybox_old generated/unstripped/toybox
install_flat:
scripts/install.sh --symlink --force
+install_airlock:
+ scripts/install.sh --symlink --force --airlock
+
install:
scripts/install.sh --long --symlink --force
@@ -76,6 +79,7 @@ help::
@echo ' to show diff, VERBOSE=fail to stop after first failure.'
@echo ' clean - Delete temporary files.'
@echo " distclean - Delete everything that isn't shipped."
+ @echo ' install_airlock - Install toybox and host toolchain into $PREFIX directory.'
@echo ' install_flat - Install toybox into $$PREFIX directory.'
@echo ' install - Install toybox into subdirectories of $$PREFIX.'
@echo ' uninstall_flat - Remove toybox from $$PREFIX directory.'
diff --git a/scripts/install.sh b/scripts/install.sh
index 961341e6..7f344986 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -23,11 +23,15 @@ do
# Use {,usr}/{bin,sbin} paths instead of all files in one directory?
[ "$1" == "--long" ] && LONG_PATH="bin/"
+ # Symlink host toolchain binaries to destination to create cross compile $PATH
+ [ "$1" == "--airlock" ] && AIRLOCK=1
+
shift
done
echo "Compile instlist..."
+NOBUILD=1 scripts/make.sh
$DEBUG $HOSTCC -I . scripts/install.c -o generated/instlist || exit 1
COMMANDS="$(generated/instlist $LONG_PATH)"
@@ -88,4 +92,61 @@ do
fi
done
+[ -z "$AIRLOCK" ] && exit 0
+
+# --airlock creates a single directory you can point the $PATH to for cross
+# compiling, which contains just toybox and symlinks to toolchain binaries.
+
+# This not only means you're building with a known set of tools (insulated from
+# variations in the host distro), but that everything else is NOT in your PATH
+# and thus various configure stages won't find things on thie host that won't
+# be there on the target (such as the distcc build noticing the host has
+# python and deciding to #include Python.h).
+
+# The following are commands toybox should provide, but doesn't yet.
+# For now symlink the host version. This list must go away by 1.0.
+
+PENDING="bunzip2 bzcat dd diff expr ftpd ftpget ftpput gunzip less ping route tar test tr vi wget zcat awk bzip2 fdisk gzip sh sha512sum unxz xzcat"
+
+# "gcc" should go away for llvm, but some things still hardwire it
+TOOLCHAIN="ar as nm cc make ld gcc objdump"
+
+if [ ! -z "$AIRLOCK" ]
+then
+
+ # Tools needed to build packages
+ for i in ar as nm cc make ld gcc objdump $PENDING $HOST_EXTRA
+ do
+ if [ ! -f "$i" ]
+ then
+ # Loop through each instance, populating fallback directories (used by
+ # things like distcc, which require multiple instances of the same binary
+ # in a known order in the $PATH).
+
+ X=0
+ FALLBACK="$PREFIX"
+ which -a "$i" | while read j
+ do
+ if [ ! -e "$FALLBACK/$i" ]
+ then
+ mkdir -p "$FALLBACK" &&
+ ln -sf "$j" "$FALLBACK/$i" || exit 1
+ fi
+
+ X=$[$X+1]
+ FALLBACK="$PREFIX/fallback-$X"
+ done
+
+ if [ ! -f "$PREFIX/$i" ]
+ then
+ echo "Toolchain component missing: $i" >&2
+ EXIT=1
+ fi
+ fi
+done
+
+
+
+fi
+
exit $EXIT