changeset 849:5dd1a99a0737

Factor out more common code: busybox and toybox builds.
author Rob Landley <rob@landley.net>
date Wed, 14 Oct 2009 15:52:15 -0500
parents 63d79a2b0816
children e0879d661b55
files host-tools.sh root-filesystem.sh sources/sections/busybox.sh
diffstat 3 files changed, 44 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/host-tools.sh	Wed Oct 14 03:51:57 2009 -0500
+++ b/host-tools.sh	Wed Oct 14 15:52:15 2009 -0500
@@ -101,40 +101,7 @@
 
   if [ ! -f "${STAGE_DIR}/busybox" ]
   then
-    setupfor busybox &&
-    make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
-    make -j $CPUS &&
-    make busybox.links &&
-    cp busybox "${STAGE_DIR}"
-
-    [ $? -ne 0 ] && dienow
-
-    for i in $(sed 's@.*/@@' busybox.links)
-    do
-      [ ! -f "${STAGE_DIR}/$i" ] &&
-        (ln -sf busybox "${STAGE_DIR}/$i" || dienow)
-    done
-
-    cleanup
-  fi
-
-  # Build toybox
-
-  if [ ! -f "${STAGE_DIR}/toybox" ]
-  then
-    setupfor toybox &&
-    make defconfig &&
-    make || dienow
-    if [ -z "$USE_TOYBOX" ]
-    then
-      mv toybox "$STAGE_DIR" &&
-      ln -sf toybox "$STAGE_DIR"/patch &&
-      ln -sf toybox "$STAGE_DIR"/netcat || dienow
-    else
-      make install_flat PREFIX="${STAGE_DIR}" || dienow
-    fi
-
-    cleanup
+    build_section busybox
   fi
 
   # Create symlinks to the host toolchain.  We need a usable existing host
--- a/root-filesystem.sh	Wed Oct 14 03:51:57 2009 -0500
+++ b/root-filesystem.sh	Wed Oct 14 15:52:15 2009 -0500
@@ -110,41 +110,8 @@
 cp "$SRCDIR"/MANIFEST "$ROOT_TOPDIR/src" &&
 cp "${WORK}/config-${C_LIBRARY}" "$ROOT_TOPDIR/src/config-${C_LIBRARY}" || dienow
 
-# Build and install toybox
-
-setupfor toybox
-make defconfig &&
-if [ -z "$USE_TOYBOX" ]
-then
-  CFLAGS="$CFLAGS $STATIC_FLAGS" make CROSS="${ARCH}-" &&
-  cp toybox "$ROOT_TOPDIR/bin" &&
-  ln -s toybox "$ROOT_TOPDIR/bin/patch" &&
-  ln -s toybox "$ROOT_TOPDIR/bin/oneit" &&
-  ln -s toybox "$ROOT_TOPDIR/bin/netcat"
-else
-  CFLAGS="$CFLAGS $STATIC_FLAGS" \
-    make install_flat PREFIX="$ROOT_TOPDIR"/bin CROSS="${ARCH}-"
-fi
-
-cleanup
-
-# Build and install busybox
-
-setupfor busybox
-make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
-cp .config "$ROOT_TOPDIR"/src/config-busybox &&
-LDFLAGS="$LDFLAGS $STATIC_FLAGS" \
-  make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY &&
-make busybox.links &&
-cp busybox "$ROOT_TOPDIR/bin" || dienow
-
-for i in $(sed 's@.*/@@' busybox.links)
-do
-  # Allowed to fail.
-  ln -s busybox "$ROOT_TOPDIR/bin/$i" 2>/dev/null || true
-done
-
-cleanup
+STAGE_DIR="$ROOT_TOPDIR"/bin build_section busybox
+cp "$WORK"/config-busybox "$ROOT_TOPDIR"/src || dienow
 
 # Build and install make
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/sections/busybox.sh	Wed Oct 14 15:52:15 2009 -0500
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+[ ! -z "$ARCH" ] && DO_CROSS=CROSS_COMPILE=${ARCH}-
+
+# Build busybox
+
+setupfor busybox
+make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
+cp .config "$WORK"/config-busybox
+LDFLAGS="$LDFLAGS $STATIC_FLAGS" make -j $CPUS $VERBOSITY $DO_CROSS &&
+make busybox.links &&
+cp busybox "${STAGE_DIR}"
+
+[ $? -ne 0 ] && dienow
+
+for i in $(sed 's@.*/@@' busybox.links)
+do
+  [ ! -f "${STAGE_DIR}/$i" ] &&
+    (ln -sf busybox "${STAGE_DIR}/$i" || dienow)
+done
+
+cleanup
+
+# Build toybox
+
+[ ! -z "$ARCH" ] && DO_CROSS=CROSS_COMPILE=${ARCH}-
+
+setupfor toybox
+make defconfig &&
+CFLAGS="$CFLAGS $STATIC_FLAGS" make $DO_CROSS || dienow
+if [ -z "$USE_TOYBOX" ]
+then
+  mv toybox "$STAGE_DIR" &&
+  ln -sf toybox "$STAGE_DIR"/patch &&
+  ln -sf toybox "$STAGE_DIR"/oneit &&
+  ln -sf toybox "$STAGE_DIR"/netcat || dienow
+else
+  make install_flat PREFIX="$STAGE_DIR" || dienow
+fi
+
+cleanup