changeset 1034:27c38c82401d

Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
author Rob Landley <rob@landley.net>
date Sun, 11 Apr 2010 15:21:00 -0500
parents 87b3a69ca71c
children a3716680a825
files native-compiler.sh root-filesystem.sh sources/sections/bash.build sources/sections/distcc.build sources/sections/make.build
diffstat 5 files changed, 48 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/native-compiler.sh	Thu Apr 08 23:09:13 2010 -0500
+++ b/native-compiler.sh	Sun Apr 11 15:21:00 2010 -0500
@@ -34,15 +34,26 @@
 build_section gcc
 build_section ccwrap
 
-# Tell future packages to link against the libraries in the new root filesystem,
-# rather than the ones in the cross compiler directory.
+# Tell future packages to link against the libraries in the new compiler,
+# rather than the ones in the simple compiler.
 
 export "$(echo $ARCH | sed 's/-/_/g')"_CCWRAP_TOPDIR="$STAGE_DIR"
 
 build_section uClibc++
 
+# For a native compiler, build make, bash, and distcc.  (Yes, this is an old
+# version of Bash.  It's intentional.)
+
+if [ "$FROM_ARCH" == "$ARCH" ]
+then
+  build_section make
+  build_section bash
+  build_section distcc
+fi
+
 # Delete some unneeded files
 
-[ -z "$SKIP_STRIP" ] && rm -rf "$STAGE_DIR"/{info,man}
+[ -z "$SKIP_STRIP" ] &&
+  rm -rf "$STAGE_DIR"/{info,man,libexec/gcc/*/*/install-tools}
 
 create_stage_tarball
--- a/root-filesystem.sh	Thu Apr 08 23:09:13 2010 -0500
+++ b/root-filesystem.sh	Sun Apr 11 15:21:00 2010 -0500
@@ -46,14 +46,17 @@
 "${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
 
-# If no native compiler exists for this target...
+# If a native compiler exists for this target, grab it
 
-if [ ! -d "$BUILD/native-compiler-$ARCH" ]
+if [ -d "$BUILD/native-compiler-$ARCH" ]
 then
+  # Copy native compiler
 
+  cp -a "$BUILD/native-compiler-$ARCH/." "$STAGE_DIR/" || dienow
+else
   # Do we need shared libraries?
 
-  if [ ! -z "$BUILD_STATIC" ]
+  if [ ! -z "$BUILD_STATIC" ] && [ "$BUILD_STATIC" != none ]
   then
     echo Copying compiler libraries...
     mkdir -p "$STAGE_DIR/lib" || dienow
@@ -65,67 +68,7 @@
 
   # Since we're not installing a compiler, delete the example source code.  
   rm -rf "$STAGE_DIR/src/*.c*" || dienow
-
-# If a native compiler exists for this target, use it and add supplementary
-# development tools
-
-else
-
-  # Copy native compiler
-
-  cp -a "$BUILD/native-compiler-$ARCH/." "$STAGE_DIR/" || dienow
-
-  # Build and install make
-
-  setupfor make
-  LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \
-    --prefix="$STAGE_DIR" --build="${CROSS_HOST}" --host="${CROSS_TARGET}" &&
-  make -j $CPUS &&
-  make -j $CPUS install
-
-  cleanup
-
-  # Build and install bash.  (Yes, this is an old version.  It's intentional.)
-
-  setupfor bash
-  # wire around some tests ./configure can't run when cross-compiling.
-  echo -e "ac_cv_func_setvbuf_reversed=no\nbash_cv_sys_named_pipes=yes\nbash_cv_have_mbstate_t=yes\nbash_cv_getenv_redef=no" > config.cache &&
-  LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" RANLIB="${ARCH}-ranlib" \
-    ./configure --prefix="$STAGE_DIR" \
-    --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \
-    --without-bash-malloc --disable-readline &&
-  # note: doesn't work with -j
-  make &&
-  make install &&
-  # Make bash the default shell.
-  ln -sf bash "$STAGE_DIR/bin/sh"
-
-  cleanup
-
-  # Build and install distcc
-
-  setupfor distcc
-  rsync_cv_HAVE_C99_VSNPRINTF=yes \
-  LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \
-    --host="${CROSS_TARGET}" --prefix="$STAGE_DIR" \
-    --with-included-popt --disable-Werror &&
-  make -j $CPUS &&
-  make -j $CPUS install &&
-  mkdir -p "$STAGE_DIR/distcc" || dienow
-
-  for i in gcc cc g++ c++
-  do
-    ln -s ../bin/distcc "$STAGE_DIR/distcc/$i" || dienow
-  done
-
-  cleanup
-
-  # Delete some unneeded files
-
-  [ -z "$SKIP_STRIP" ] &&
-    rm -rf "$STAGE_DIR"/{info,man,libexec/gcc/*/*/install-tools}
-
-fi # native compiler
+fi
 
 # This is allowed to fail if there are no configs.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/sections/bash.build	Sun Apr 11 15:21:00 2010 -0500
@@ -0,0 +1,11 @@
+# wire around some tests ./configure can't run when cross-compiling.
+echo -e "ac_cv_func_setvbuf_reversed=no\nbash_cv_sys_named_pipes=yes\nbash_cv_have_mbstate_t=yes\nbash_cv_getenv_redef=no" > config.cache &&
+LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" RANLIB="${ARCH}-ranlib" \
+  ./configure --prefix="$STAGE_DIR" \
+  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \
+  --without-bash-malloc --disable-readline &&
+# note: doesn't work with -j
+make &&
+make install &&
+# Make bash the default shell.
+ln -sf bash "$STAGE_DIR/bin/sh"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/sections/distcc.build	Sun Apr 11 15:21:00 2010 -0500
@@ -0,0 +1,12 @@
+rsync_cv_HAVE_C99_VSNPRINTF=yes \
+LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \
+  --host="${CROSS_TARGET}" --prefix="$STAGE_DIR" \
+  --with-included-popt --disable-Werror &&
+make -j $CPUS &&
+make -j $CPUS install &&
+mkdir -p "$STAGE_DIR/distcc" || dienow
+
+for i in gcc cc g++ c++
+do
+  ln -s ../bin/distcc "$STAGE_DIR/distcc/$i" || dienow
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/sections/make.build	Sun Apr 11 15:21:00 2010 -0500
@@ -0,0 +1,4 @@
+LDFLAGS="$STATIC_FLAGS $LDFLAGS" CC="${ARCH}-cc" ./configure \
+  --prefix="$STAGE_DIR" --build="${CROSS_HOST}" --host="${CROSS_TARGET}" &&
+make -j $CPUS &&
+make -j $CPUS install