changeset 726:db5cb617339a

Centrialize BUILD_STATIC and make it apply to more of root-filesystem.sh
author Rob Landley <rob@landley.net>
date Thu, 07 May 2009 19:09:56 -0500
parents 1645af9db5f8
children cc0b6deda270
files cross-compiler.sh root-filesystem.sh sources/include.sh
diffstat 3 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cross-compiler.sh	Tue Apr 28 22:38:38 2009 -0500
+++ b/cross-compiler.sh	Thu May 07 19:09:56 2009 -0500
@@ -14,8 +14,6 @@
 rm -rf "${CROSS}"
 mkdir -p "${CROSS}" || dienow
 
-[ -z "$BUILD_STATIC" ] || STATIC_FLAGS='--static'
-
 # Build and install binutils
 
 setupfor binutils build-binutils &&
--- a/root-filesystem.sh	Tue Apr 28 22:38:38 2009 -0500
+++ b/root-filesystem.sh	Thu May 07 19:09:56 2009 -0500
@@ -93,8 +93,6 @@
 
 else
 
-[ -z "$BUILD_STATIC" ] || STATIC_FLAGS='--static'
-
 # Build and install native binutils
 
 setupfor binutils build-binutils
@@ -226,14 +224,15 @@
 make defconfig &&
 if [ -z "$USE_TOYBOX" ]
 then
-  make CROSS="${ARCH}-" &&
+  CFLAGS="$CFLAGS $STATIC_FLAGS" make CROSS="${ARCH}-" &&
   cp toybox "$TOOLS/bin" &&
   ln -s toybox "$TOOLS/bin/patch" &&
   ln -s toybox "$TOOLS/bin/oneit" &&
   ln -s toybox "$TOOLS/bin/netcat" &&
   cd ..
 else
-  make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" &&
+  CFLAGS="$CFLAGS $STATIC_FLAGS" \
+    make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" &&
   cd ..
 fi
 
@@ -244,7 +243,8 @@
 setupfor busybox
 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
 cp .config "${TOOLS}"/src/config-busybox &&
-make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY &&
+LDFLAGS="$LDFLAGS $STATIC_FLAGS" \
+  make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY &&
 make busybox.links &&
 cp busybox "${TOOLS}/bin"
 
--- a/sources/include.sh	Tue Apr 28 22:38:38 2009 -0500
+++ b/sources/include.sh	Thu May 07 19:09:56 2009 -0500
@@ -99,8 +99,12 @@
 
   # Override these to perform a canadian cross in root-filesystem.sh
 
-  [ -z "$FROM_ARCH" ] && FROM_ARCH="${ARCH}" ||
+  if [ -z "$FROM_ARCH" ]
+  then
+    FROM_ARCH="${ARCH}"
+  else
     [ -z "$PROGRAM_PREFIX" ] && PROGRAM_PREFIX="${ARCH}-"
+  fi
   [ -z "$FROM_HOST" ] && FROM_HOST="${FROM_ARCH}"-walrus-linux 
 
   # Setup directories and add the cross compiler to the start of the path.
@@ -122,7 +126,11 @@
   mkdir -p "${WORK}" || dienow
 fi
 
-if [ ! -z "$BUILD_VERBOSE" ]
+
+[ ! -z "$BUILD_VERBOSE" ] && VERBOSITY="V=1"
+
+# This is an if instead of && so the exit code of include.sh is reliably 0
+if [ ! -z "$BUILD_STATIC" ]
 then
-  VERBOSITY="V=1"
+  STATIC_FLAGS="--static"
 fi