changeset 1623:6cef85eefede

Break out variable setting into sources/variables.sh
author Rob Landley <rob@landley.net>
date Sat, 24 Aug 2013 05:56:35 -0500
parents ca0cf2dc37c2
children c654511d227c
files sources/include.sh sources/variables.sh
diffstat 2 files changed, 77 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/sources/include.sh	Sat Aug 24 05:56:17 2013 -0500
+++ b/sources/include.sh	Sat Aug 24 05:56:35 2013 -0500
@@ -1,91 +1,20 @@
 #!/bin/echo "This file is sourced, not run"
 
+# This is the top level include file sourced by each build stage.
+
+# Guard against multiple inclusion
+
 if ! already_included_this 2>/dev/null
 then
 alias already_included_this=true
 
 # Set up all the environment variables and functions for a build stage.
-# This file is sourced, not run.
 
-# Include config and source shell function files.
-
-[ -e config ] && source config
-
+source config
 source sources/utility_functions.sh
 source sources/functions.sh
 source sources/download_functions.sh
-
-# Avoid trouble from unexpected environment settings
-
-[ -z "$NO_SANITIZE_ENVIRONMENT" ] && sanitize_environment
-
-# List of fallback mirrors to download package source from
-
-MIRROR_LIST="http://landley.net/code/aboriginal/mirror http://127.0.0.1/code/aboriginal/mirror"
-
-# Where are our working directories?
-
-export_if_blank TOP=`pwd`
-export_if_blank SOURCES="$TOP/sources"
-export_if_blank SRCDIR="$TOP/packages"
-export_if_blank PATCHDIR="$SOURCES/patches"
-export_if_blank BUILD="$TOP/build"
-export_if_blank SRCTREE="$BUILD/packages"
-export_if_blank HOSTTOOLS="$BUILD/host"
-export_if_blank WRAPDIR="$BUILD/record-commands"
-
-# Set a default non-arch
-
-export WORK="${BUILD}/host-temp"
-export ARCH_NAME=host
-
-# What host compiler should we use?
-
-export_if_blank CC=cc
-
-# How many processors should make -j use?
-
-MEMTOTAL="$(awk '/MemTotal:/{print $2}' /proc/meminfo)"
-if [ -z "$CPUS" ]
-then
-  export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
-  [ "$CPUS" -lt 1 ] && CPUS=1
-
-  # If we're not using hyper-threading, and there's plenty of memory,
-  # use 50% more CPUS than we actually have to keep system busy
-
-  [ -z "$(cat /proc/cpuinfo | grep '^flags' | head -n 1 | grep -w ht)" ] &&
-    [ $(($CPUS*512*1024)) -le $MEMTOTAL ] &&
-      CPUS=$((($CPUS*3)/2))
-fi
-
-export_if_blank STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'`
-[ ! -z "$BUILD_VERBOSE" ] && VERBOSITY="V=1"
-
-export_if_blank BUILD_STATIC=busybox,toybox,binutils,gcc-core,gcc-g++,make
-
-# Adjust $PATH
-
-# If record-commands.sh set up a wrapper directory, adjust $PATH again.
-
-export PATH
-if [ -z "$OLDPATH" ]
-then
-  export OLDPATH="$PATH"
-  [ -z "$BUSYBOX" ] || BUSYBOX=busybox
-  [ -f "$HOSTTOOLS/${BUSYBOX:-toybox}" ] &&
-    PATH="$(hosttools_path)" ||
-    PATH="$(hosttools_path):$PATH"
-
-  if [ -f "$WRAPDIR/wrappy" ]
-  then
-    OLDPATH="$PATH"
-    mkdir -p "$BUILD/logs"
-    [ $? -ne 0 ] && echo "Bad $WRAPDIR" >&2 && dienow
-    PATH="$WRAPDIR"
-  fi
-fi
-export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.$ARCH_NAME.early"
+source sources/variables.sh
 
 # Create files with known permissions
 umask 022
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/variables.sh	Sat Aug 24 05:56:35 2013 -0500
@@ -0,0 +1,71 @@
+#!/bin/echo "This file is sourced, not run"
+
+# Avoid trouble from unexpected environment settings
+
+[ -z "$NO_SANITIZE_ENVIRONMENT" ] && sanitize_environment
+
+# List of fallback mirrors to download package source from
+
+export_if_blank MIRROR_LIST="http://landley.net/code/aboriginal/mirror http://127.0.0.1/code/aboriginal/mirror"
+
+# Where are our working directories?
+
+export_if_blank TOP=`pwd`
+export_if_blank SOURCES="$TOP/sources"
+export_if_blank SRCDIR="$TOP/packages"
+export_if_blank PATCHDIR="$SOURCES/patches"
+export_if_blank BUILD="$TOP/build"
+export_if_blank SRCTREE="$BUILD/packages"
+export_if_blank HOSTTOOLS="$BUILD/host"
+export_if_blank WRAPDIR="$BUILD/record-commands"
+
+# Set a default non-arch
+
+export WORK="${BUILD}/host-temp"
+export ARCH_NAME=host
+
+# What host compiler should we use?
+
+export_if_blank CC=cc
+
+# How many processors should make -j use?
+
+MEMTOTAL="$(awk '/MemTotal:/{print $2}' /proc/meminfo)"
+if [ -z "$CPUS" ]
+then
+  export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)
+  [ "$CPUS" -lt 1 ] && CPUS=1
+
+  # If we're not using hyper-threading, and there's plenty of memory,
+  # use 50% more CPUS than we actually have to keep system busy
+
+  [ -z "$(cat /proc/cpuinfo | grep '^flags' | head -n 1 | grep -w ht)" ] &&
+    [ $(($CPUS*512*1024)) -le $MEMTOTAL ] &&
+      CPUS=$((($CPUS*3)/2))
+fi
+
+export_if_blank STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'`
+[ ! -z "$BUILD_VERBOSE" ] && VERBOSITY="V=1"
+
+export_if_blank BUILD_STATIC=busybox,toybox,binutils,gcc-core,gcc-g++,make
+
+# If record-commands.sh set up a wrapper directory, adjust $PATH.
+
+export PATH
+if [ -z "$OLDPATH" ]
+then
+  export OLDPATH="$PATH"
+  [ -z "$BUSYBOX" ] || BUSYBOX=busybox
+  [ -f "$HOSTTOOLS/${BUSYBOX:-toybox}" ] &&
+    PATH="$(hosttools_path)" ||
+    PATH="$(hosttools_path):$PATH"
+
+  if [ -f "$WRAPDIR/wrappy" ]
+  then
+    OLDPATH="$PATH"
+    mkdir -p "$BUILD/logs"
+    [ $? -ne 0 ] && echo "Bad $WRAPDIR" >&2 && dienow
+    PATH="$WRAPDIR"
+  fi
+fi
+export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.$ARCH_NAME.early"