changeset 1036:e021bba5e22e

Yank ugly STAGE_DIR adjustment and instead teach busybox/toybox bilds to auto-detect "bin" directory on install. (And while we're at it, don't build hello-dynamic on static-only system.)
author Rob Landley <rob@landley.net>
date Mon, 12 Apr 2010 00:04:11 -0500
parents a3716680a825
children 3a141d15c503
files root-filesystem.sh sources/sections/busybox.build sources/sections/toybox.build
diffstat 3 files changed, 25 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/root-filesystem.sh	Mon Apr 12 00:02:32 2010 -0500
+++ b/root-filesystem.sh	Mon Apr 12 00:04:11 2010 -0500
@@ -35,16 +35,19 @@
 
 # Build busybox and toybox
 
-STAGE_DIR="$STAGE_DIR"/bin build_section busybox
+build_section busybox
 cp "$WORK"/config-busybox "$STAGE_DIR"/src || dienow
-
-STAGE_DIR="$STAGE_DIR"/bin build_section toybox
+build_section toybox
 
 # Put statically and dynamically linked hello world programs on there for
 # test purposes.
 
-"${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os $CFLAGS -o "$STAGE_DIR/bin/hello-dynamic" &&
-"${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os $CFLAGS -static -o "$STAGE_DIR/bin/hello-static" || dienow
+"${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os $CFLAGS -o "$STAGE_DIR/bin/hello-dynamic" || dienow
+
+if [ ! -z "$BUILD_STATIC" ] && [ "$BUILD_STATIC" != none ]
+then
+  "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os $CFLAGS -static -o "$STAGE_DIR/bin/hello-static" || dienow
+fi
 
 # If a native compiler exists for this target, grab it
 
--- a/sources/sections/busybox.build	Mon Apr 12 00:02:32 2010 -0500
+++ b/sources/sections/busybox.build	Mon Apr 12 00:04:11 2010 -0500
@@ -1,16 +1,19 @@
 # Build busybox statically by default, but don't statically link against
-# glibc because glibc is buggy and can't combine --static with --gc-sections.
+# glibc (during host_tools) build because glibc is buggy and can't combine
+# --static with --gc-sections.
 
 # Build busybox
 
 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
 cp .config "$WORK"/config-busybox &&
 LDFLAGS="$LDFLAGS $STATIC_DEFAULT_FLAGS" make -j $CPUS $VERBOSITY $DO_CROSS &&
-make busybox.links &&
-cp busybox${SKIP_STRIP:+_unstripped} "${STAGE_DIR}/busybox" || dienow
+make busybox.links || dienow
+
+[ -d "$STAGE_DIR/bin" ] && INSTDIR="$STAGE_DIR/bin" || INSTDIR="$STAGE_DIR"
+
+cp busybox${SKIP_STRIP:+_unstripped} "$INSTDIR/busybox" || dienow
 
 for i in $(sed 's@.*/@@' busybox.links)
 do
-  [ ! -f "${STAGE_DIR}/$i" ] &&
-    (ln -sf busybox "${STAGE_DIR}/$i" || dienow)
+  [ ! -f "INSTDIR/$i" ] && (ln -sf busybox "$INSTDIR/$i" || dienow)
 done
--- a/sources/sections/toybox.build	Mon Apr 12 00:02:32 2010 -0500
+++ b/sources/sections/toybox.build	Mon Apr 12 00:04:11 2010 -0500
@@ -3,13 +3,17 @@
 yes "" | make defconfig &&
 CFLAGS="$CFLAGS $STATIC_DEFAULT_FLAGS" make $DO_CROSS || dienow
 
+# Install into bin subdirectory if it exists
+
+[ -d "$STAGE_DIR/bin" ] && INSTDIR="$STAGE_DIR/bin" || INSTDIR="$STAGE_DIR"
+
 if [ -z "$USE_TOYBOX" ]
 then
-  ln -sf toybox "$STAGE_DIR"/patch &&
-  ln -sf toybox "$STAGE_DIR"/oneit &&
-  ln -sf toybox "$STAGE_DIR"/netcat || dienow
+  ln -sf toybox "$INSTDIR/patch" &&
+  ln -sf toybox "$INSTDIR/oneit" &&
+  ln -sf toybox "$INSTDIR/netcat" || dienow
 else
-  make install_flat PREFIX="$STAGE_DIR" || dienow
+  make install_flat PREFIX="$INSTDIR" || dienow
 fi
 
-mv toybox${SKIP_STRIP:+_unstripped} "$STAGE_DIR/toybox"
+mv toybox${SKIP_STRIP:+_unstripped} "$INSTDIR/toybox"