changeset 1398:b74d36876c0a

Replace read_arch_dir with load_target, which understands that sources/targets/$TARGET can be a file or a directory.
author Rob Landley <rob@landley.net>
date Sun, 26 Jun 2011 17:44:02 -0500
parents 06f26d3b636e
children ee9ee44835e9
files linux-kernel.sh more/cross-smoke-test.sh more/for-each-target.sh more/migrate-kernel.sh more/test.sh native-compiler.sh root-filesystem.sh root-image.sh simple-cross-compiler.sh simple-root-filesystem.sh sources/README sources/functions.sh system-image.sh
diffstat 13 files changed, 35 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/linux-kernel.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/linux-kernel.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -4,9 +4,9 @@
 
 source sources/include.sh || exit 1
 
-# Parse the sources/targets/$1 directory
+# Parse sources/targets/$1
 
-read_arch_dir "$1"
+load_target "$1"
 
 # If we have an initramfs, incorporate it into the kernel image.
 
--- a/more/cross-smoke-test.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/more/cross-smoke-test.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -3,7 +3,7 @@
 # Perform a smoke test on a target's cross compiler by building "hello world"
 # and attempting to run it under QEMU application emulation.
 
-source sources/include.sh && read_arch_dir "$1" || exit 1
+source sources/include.sh && load_target "$1" || exit 1
 
 # Build statically linked hello world, if necessary
 
--- a/more/for-each-target.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/more/for-each-target.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -8,10 +8,11 @@
 . sources/utility_functions.sh || exit 1
 
 [ -z "${ARCHES}" ] &&
-  ARCHES="$(cd sources/targets/; ls | grep -v '^hw-')"
+  ARCHES="$(ls sources/targets)"
 
 for TARGET in $ARCHES
 do
+  [ ! -f "$TARGET" ] && continue
   maybe_fork "$* | maybe_quiet"
 done
 
--- a/more/migrate-kernel.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/more/migrate-kernel.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -8,7 +8,7 @@
 
 . sources/include.sh
 
-read_arch_dir "$1"
+load_target "$1"
 rmdir "$STAGE_DIR"
 
 [ -z "$BOOT_KARCH" ] && BOOT_KARCH="$KARCH"
--- a/more/test.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/more/test.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -10,6 +10,6 @@
 
 . sources/include.sh || exit 1
 
-read_arch_dir "$1"
+load_target "$1"
 shift
 eval "$@"
--- a/native-compiler.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/native-compiler.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -9,7 +9,7 @@
 # The new compiler is built --with-shared, with thread support, has uClibc++
 # installed, and is linked against uClibc (see BUILD_STATIC in config).
 
-source sources/include.sh && read_arch_dir "$1" || exit 1
+source sources/include.sh && load_target "$1" || exit 1
 check_for_base_arch || exit 0
 
 check_prerequisite "${ARCH}-cc"
--- a/root-filesystem.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/root-filesystem.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -4,7 +4,7 @@
 
 . sources/include.sh || exit 1
 
-read_arch_dir "$1"
+load_target "$1"
 
 [ ! -d "$BUILD/simple-root-filesystem-$ARCH" ] &&
   echo "No $BUILD/simple-root-filesystem-$ARCH" >&2 &&
--- a/root-image.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/root-image.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -4,9 +4,9 @@
 
 source sources/include.sh || exit 1
 
-# Parse the sources/targets/$1 directory
+# Parse sources/targets/$1
 
-read_arch_dir "$1"
+load_target "$1"
 
 # Which directory do we package up?
 
--- a/simple-cross-compiler.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/simple-cross-compiler.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -14,9 +14,9 @@
 
 source sources/include.sh || exit 1
 
-# Parse the sources/targets/$1 directory
+# Parse sources/targets/$1
 
-read_arch_dir "$1"
+load_target "$1"
 
 # If this target has a base architecture that's already been built, use that.
 
--- a/simple-root-filesystem.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/simple-root-filesystem.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -7,7 +7,7 @@
 # prefix- name is correct.
 
 source sources/include.sh || exit 1
-read_arch_dir "$1"
+load_target "$1"
 check_for_base_arch || exit 0
 check_prerequisite "${ARCH}-cc"
 
--- a/sources/README	Sun Jun 26 17:42:52 2011 -0500
+++ b/sources/README	Sun Jun 26 17:44:02 2011 -0500
@@ -33,9 +33,10 @@
            Each package has "$PACKAGE-*.patch" applied in alphabetical order,
            or "alt-$PACKAGE-*.patch" for USE_UNSTABLE versions.
 
-  targets: Configuration for each target platform, parsed by read_arch_dir()
-           and getconfig() in functions.sh.  Each subdirectory is a
-           target name, and contains at least four files:
+  targets: Configuration for each target platform, parsed by load_target()
+           and getconfig() in functions.sh.  Each entry is a target name,
+           either a self-contained script setting configuration information,
+           or else a directory containing:
 
       settings: Environment variables needed by the build.
 
@@ -47,8 +48,6 @@
                          (If miniconfig-alt-uClibc exists, USE_UNSTABLE=uClibc
                           will use that instead.)
 
-      description: Simple documentation about the platform
-
   root-filesystem: Files to be copied verbatim into the target filesystem.
                    Used by simple-root-filesystem.sh.
 
--- a/sources/functions.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/sources/functions.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -17,24 +17,32 @@
   echo -n "$i:"
 }
 
-read_arch_dir()
+load_target()
 {
   # Get target platform from first command line argument.
 
   ARCH_NAME="$1"
-  if [ ! -f "${SOURCES}/targets/${ARCH_NAME}/settings" ]
+  ARCH="$ARCH_NAME"
+  CONFIG_DIR="$SOURCES/targets"
+
+  # Read the relevant config file.
+
+  if [ -f "$CONFIG_DIR/$ARCH" ]
   then
+    source "$CONFIG_DIR/$ARCH"
+    CONFIG_DIR=
+  elif [ -f "$CONFIG_DIR/$ARCH/settings" ]
+  then
+    source "$CONFIG_DIR/$ARCH/settings" ]
+  else
     echo "Supported architectures: "
-    (cd "${SOURCES}/targets" && ls)
+    ls "$CONFIG_DIR"
 
     exit 1
   fi
 
-  # Read the relevant config file.
 
-  ARCH="$ARCH_NAME"
-  CONFIG_DIR="${SOURCES}/targets"
-  source "${CONFIG_DIR}/${ARCH}/settings"
+  source "$CONFIG_DIR/$ARCH/settings"
 
   # Which platform are we building for?
 
--- a/system-image.sh	Sun Jun 26 17:42:52 2011 -0500
+++ b/system-image.sh	Sun Jun 26 17:44:02 2011 -0500
@@ -4,9 +4,9 @@
 
 source sources/include.sh || exit 1
 
-# Parse the sources/targets/$1 directory
+# Parse sources/targets/$1
 
-read_arch_dir "$1"
+load_target "$1"
 
 cd "$BUILD/linux-kernel-$ARCH_NAME" &&
 KERNEL="$(ls)" &&