annotate sources/functions.sh @ 777:879353d1cfba

Update timestamp on freshly downloaded files so cleanup doesn't delete them.
author Rob Landley <rob@landley.net>
date Thu, 02 Jul 2009 16:23:39 -0500
parents 37c083cca810
children e373d2b6d0b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 # Lots of reusable functions. This file is sourced, not run.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
744
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
3 function read_arch_dir()
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
4 {
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
5 # Get target platform from first command line argument.
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
6
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
7 ARCH_NAME="$1"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
8 if [ ! -f "${TOP}/sources/targets/${ARCH_NAME}/settings" ]
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
9 then
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
10 echo "Supported architectures: "
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
11 (cd "${TOP}/sources/targets" && ls)
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
12
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
13 exit 1
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
14 fi
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
15
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
16 # Read the relevant config file.
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
17
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
18 ARCH="$ARCH_NAME"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
19 CONFIG_DIR="${TOP}/sources/targets"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
20 source "${CONFIG_DIR}/${ARCH}/settings"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
21
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
22 # Which platform are we building for?
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
23
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
24 export WORK="${BUILD}/temp-$ARCH_NAME"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
25
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
26 # Say "unknown" in two different ways so it doesn't assume we're NOT
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
27 # cross compiling when the host and target are the same processor. (If host
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
28 # and target match, the binutils/gcc/make builds won't use the cross compiler
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
29 # during root-filesystem.sh, and the host compiler links binaries against the
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
30 # wrong libc.)
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
31 [ -z "$CROSS_HOST" ] && export CROSS_HOST=`uname -m`-walrus-linux
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
32 if [ -z "$CROSS_TARGET" ]
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
33 then
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
34 export CROSS_TARGET=${ARCH}-unknown-linux
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
35 else
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
36 [ -z "$FROM_HOST" ] && FROM_HOST="${CROSS_TARGET}"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
37 fi
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
38
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
39 # Override FROM_ARCH to perform a canadian cross in root-filesystem.sh
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
40
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
41 if [ -z "$FROM_ARCH" ]
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
42 then
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
43 FROM_ARCH="${ARCH}"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
44 else
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
45 [ -z "$PROGRAM_PREFIX" ] && PROGRAM_PREFIX="${ARCH}-"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
46 fi
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
47 [ -z "$FROM_HOST" ] && FROM_HOST="${FROM_ARCH}-thingy-linux"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
48
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
49 # Setup directories and add the cross compiler to the start of the path.
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
50
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
51 [ -z "$NATIVE_ROOT" ] && export NATIVE_ROOT="${BUILD}/root-filesystem-$ARCH"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
52 export PATH="${BUILD}/cross-compiler-$ARCH/bin:$PATH"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
53 [ "$FROM_ARCH" != "$ARCH" ] &&
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
54 PATH="${BUILD}/cross-compiler-${FROM_ARCH}/bin:$PATH"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
55
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
56 [ ! -z "${NATIVE_TOOLSDIR}" ] && TOOLS="${NATIVE_ROOT}/tools" ||
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
57 TOOLS="${NATIVE_ROOT}/usr"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
58
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
59 return 0
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
60 }
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
61
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
62 function blank_tempdir()
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
63 {
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
64 # sanity test: never rm -rf something we don't own.
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
65 [ -z "$1" ] && dienow
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
66 touch -c "$1" || dienow
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
67
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
68 # Delete old directory, create new one.
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
69 rm -rf "$1"
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
70 mkdir -p "$1" || dienow
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
71 }
759adf5a0fe9 Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents: 727
diff changeset
72
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
73 # Figure out if we're using the stable or unstable versions of a package.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
74
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
75 function unstable()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
77 [ ! -z "$(echo ,"$USE_UNSTABLE", | grep ,"$1",)" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
78 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
79
530
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
80 # Find appropriate miniconfig file
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
81
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
82 function getconfig()
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
83 {
581
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
84 for i in $(unstable $1 && echo {$ARCH_NAME,$ARCH}/miniconfig-alt-$1) \
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
85 {$ARCH_NAME,$ARCH}/miniconfig-$1
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
86 do
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
87 if [ -f "$CONFIG_DIR/$i" ]
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
88 then
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
89 echo "$CONFIG_DIR/$i"
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
90 return
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
91 fi
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
92 done
530
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
93
581
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
94 echo "getconfig $1 failed" >&2
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
95 dienow
530
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
96 }
ea7a010e5c47 Add ldd/readelf/ldconfig to cross and native toolchains, and teach build to fallback to stable miniconfig when miniconfig-alt is absent.
Rob Landley <rob@landley.net>
parents: 494
diff changeset
97
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
98 # Strip the version number off a tarball
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
99
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
100 function cleanup()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
101 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
102
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
103 [ $? -ne 0 ] && dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
104
567
5619a7375b74 Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents: 534
diff changeset
105 if [ ! -z "$NO_CLEANUP" ]
5619a7375b74 Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents: 534
diff changeset
106 then
5619a7375b74 Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents: 534
diff changeset
107 echo "skip cleanup $@"
5619a7375b74 Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents: 534
diff changeset
108 return
5619a7375b74 Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents: 534
diff changeset
109 fi
5619a7375b74 Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents: 534
diff changeset
110
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
111 for i in "$@"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
112 do
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
113 unstable "$i" && i="$PACKAGE"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
114 echo "cleanup $i"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
115 rm -rf "$i" || dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
116 done
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
117 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
118
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
119 # Give filename.tar.ext minus the version number.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
120
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
121 function noversion()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
122 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
123 echo "$1" | sed -e 's/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\6/'
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
124 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
125
440
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
126 # Given a filename.tar.ext, return the versino number.
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
127
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
128 function getversion()
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
129 {
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
130 echo "$1" | sed -e 's/.*-\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\1/'
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
131 }
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
132
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
133 # Give package name, minus file's version number and archive extension.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
134
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
135 function basename()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
136 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
137 noversion $1 | sed 's/\.tar\..z2*$//'
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
138 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
139
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
140 # output the sha1sum of a file
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
141 function sha1file()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
142 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
143 sha1sum "$@" | awk '{print $1}'
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
144 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
145
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
146 # Extract tarball named in $1 and apply all relevant patches into
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
147 # "$BUILD/sources/$1". Record sha1sum of tarball and patch files in
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
148 # sha1-for-source.txt. Re-extract if tarball or patches change.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
149
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
150 function extract()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
151 {
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
152 FILENAME="$1"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
153 SRCTREE="${BUILD}/sources"
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
154 SHA1FILE="$(echo "${SRCTREE}/${PACKAGE}/sha1-for-source.txt")"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
155
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
156 # Sanity check: don't ever "rm -rf /". Just don't.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
157
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
158 if [ -z "$PACKAGE" ] || [ -z "$SRCTREE" ]
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
159 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
160 dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
161 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
162
665
17fc6a3bffa4 Allow build to run with build/sources but not source tarballs. (Makes build-static-toolchains.sh slightly easier.)
Rob Landley <rob@landley.net>
parents: 662
diff changeset
163 # If the source tarball doesn't exist, but the extracted directory is there,
17fc6a3bffa4 Allow build to run with build/sources but not source tarballs. (Makes build-static-toolchains.sh slightly easier.)
Rob Landley <rob@landley.net>
parents: 662
diff changeset
164 # assume everything's ok.
17fc6a3bffa4 Allow build to run with build/sources but not source tarballs. (Makes build-static-toolchains.sh slightly easier.)
Rob Landley <rob@landley.net>
parents: 662
diff changeset
165
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
166 [ ! -e "$FILENAME" ] && [ -e "$SHA1FILE" ] && return 0
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
167
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
168 SHA1TAR="$(sha1file "${SRCDIR}/${FILENAME}")"
665
17fc6a3bffa4 Allow build to run with build/sources but not source tarballs. (Makes build-static-toolchains.sh slightly easier.)
Rob Landley <rob@landley.net>
parents: 662
diff changeset
169
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
170 # If it's already extracted and up to date (including patches), do nothing.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
171 SHALIST=$(cat "$SHA1FILE" 2> /dev/null)
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
172 if [ ! -z "$SHALIST" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
173 then
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
174 for i in "$SHA1TAR" $(sha1file "${SOURCES}/patches/${PACKAGE}"-* 2>/dev/null)
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
175 do
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
176 # Is this sha1 in the file?
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
177 if [ -z "$(echo "$SHALIST" | sed -n "s/$i/$i/p" )" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
178 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
179 SHALIST=missing
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
180 break
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
181 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
182 # Remove it
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
183 SHALIST="$(echo "$SHALIST" | sed "s/$i//" )"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
184 done
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
185 # If we matched all the sha1sums, nothing more to do.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
186 [ -z "$SHALIST" ] && return 0
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
187 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
188
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
189 echo -n "Extracting '${PACKAGE}'"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
190 # Delete the old tree (if any). Create new empty working directories.
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
191 rm -rf "${BUILD}/temp" "${SRCTREE}/${PACKAGE}" 2>/dev/null
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
192 mkdir -p "${BUILD}"/{temp,sources} || dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
193
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
194 # Is it a bzip2 or gzip tarball?
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
195 DECOMPRESS=""
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
196 [ "$FILENAME" != "${FILENAME/%\.tar\.bz2/}" ] && DECOMPRESS="j"
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
197 [ "$FILENAME" != "${FILENAME/%\.tar\.gz/}" ] && DECOMPRESS="z"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
198
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
199 cd "${WORK}" &&
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
200 { tar -xv${DECOMPRESS} -f "${SRCDIR}/${FILENAME}" -C "${BUILD}/temp" || dienow
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
201 } | dotprogress
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
202
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
203 mv "${BUILD}/temp/"* "${SRCTREE}/${PACKAGE}" &&
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
204 rmdir "${BUILD}/temp" &&
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
205 echo "$SHA1TAR" > "$SHA1FILE"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
206
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
207 [ $? -ne 0 ] && dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
208
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
209 # Apply any patches to this package
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
210
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
211 ls "${SOURCES}/patches/${PACKAGE}"-* 2> /dev/null | sort | while read i
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
212 do
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
213 if [ -f "$i" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
214 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
215 echo "Applying $i"
676
112dc7b787d3 Fix hg 665 so it actually works. (Make setupfor work when build/sources/package exists but there's no packages/package-*.tar* file.)
Rob Landley <rob@landley.net>
parents: 668
diff changeset
216 (cd "${SRCTREE}/${PACKAGE}" && patch -p1 -i "$i") || dienow
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
217 sha1file "$i" >> "$SHA1FILE"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
218 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
219 done
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
220 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
221
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
222 function try_checksum()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
223 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
224 SUM="$(sha1file "$SRCDIR/$FILENAME" 2>/dev/null)"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
225 if [ x"$SUM" == x"$SHA1" ] || [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
226 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
227 if [ -z "$SHA1" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
228 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
229 echo "No SHA1 for $FILENAME ($SUM)"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
230 else
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
231 echo "Confirmed $FILENAME"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
232 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
233
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
234 # Preemptively extract source packages?
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
235
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
236 [ -z "$EXTRACT_ALL" ] && return 0
761
93149f07231f Blank ARCH is a bad signal because host-tools.sh has that, so use a separate EXTRACT_ONLY variable.
Rob Landley <rob@landley.net>
parents: 760
diff changeset
237 EXTRACT_ONLY=1 setupfor "$(basename "$FILENAME")"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
238 return $?
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
239 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
240
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
241 return 1
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
242 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
243
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
244
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
245 function try_download()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
246 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
247 # Return success if we have a valid copy of the file
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
248
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
249 try_checksum && return 0
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
250
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
251 # If there's a corrupted file, delete it. In theory it would be nice
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
252 # to resume downloads, but wget creates "*.1" files instead.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
253
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
254 rm "$SRCDIR/$FILENAME" 2> /dev/null
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
255
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
256 # If we have another source, try to download file.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
257
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
258 if [ -n "$1" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
259 then
668
e7eb5123258c Support PREFERRED_MIRROR for USE_UNSTABLE.
Rob Landley <rob@landley.net>
parents: 665
diff changeset
260 wget -t 2 -T 20 -O "$SRCDIR/$FILENAME" "$1" ||
e7eb5123258c Support PREFERRED_MIRROR for USE_UNSTABLE.
Rob Landley <rob@landley.net>
parents: 665
diff changeset
261 (rm "$SRCDIR/$FILENAME"; return 2)
777
879353d1cfba Update timestamp on freshly downloaded files so cleanup doesn't delete them.
Rob Landley <rob@landley.net>
parents: 776
diff changeset
262 touch -c "$SRCDIR/$FILENAME"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
263 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
264
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
265 try_checksum
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
266 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
267
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
268 # Confirm a file matches sha1sum, else try to download it from mirror list.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
269
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
270 function download()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
271 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
272 FILENAME=`echo "$URL" | sed 's .*/ '`
683
3c09987974c8 Allow UNSTABLE=squashfs to download cvs snapshot with 4.0 support (but still not equivalent to genext2fs -D or gen_cpio_init's text file input, for creating /dev/console without root access).
Rob Landley <rob@landley.net>
parents: 676
diff changeset
273 [ -z "$RENAME" ] || FILENAME="$(echo "$FILENAME" | sed -r "$RENAME")"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
274 ALTFILENAME=alt-"$(noversion "$FILENAME" -0)"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
275
595
161e2bca18f4 Add slightly more debugging/status info to download.
Rob Landley <rob@landley.net>
parents: 582
diff changeset
276 echo -ne "checking $FILENAME\r"
161e2bca18f4 Add slightly more debugging/status info to download.
Rob Landley <rob@landley.net>
parents: 582
diff changeset
277
768
27f007ea2129 Keep unstable tarballs around even when you do a build that doesn't use 'em.
Rob Landley <rob@landley.net>
parents: 767
diff changeset
278 # Update timestamps on both stable and unstable tarballs (if any)
27f007ea2129 Keep unstable tarballs around even when you do a build that doesn't use 'em.
Rob Landley <rob@landley.net>
parents: 767
diff changeset
279 # so cleanup_oldfiles doesn't delete them
27f007ea2129 Keep unstable tarballs around even when you do a build that doesn't use 'em.
Rob Landley <rob@landley.net>
parents: 767
diff changeset
280 touch -c "$SRCDIR"/{"$FILENAME","$ALTFILENAME"} 2>/dev/null
27f007ea2129 Keep unstable tarballs around even when you do a build that doesn't use 'em.
Rob Landley <rob@landley.net>
parents: 767
diff changeset
281
581
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
282 # Is the unstable version selected?
9dffdd74c186 More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents: 567
diff changeset
283 if unstable "$(basename "$FILENAME")"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
284 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
285 # Download new one as alt-packagename.tar.ext
668
e7eb5123258c Support PREFERRED_MIRROR for USE_UNSTABLE.
Rob Landley <rob@landley.net>
parents: 665
diff changeset
286 FILENAME="$ALTFILENAME" SHA1= try_download "$UNSTABLE" ||
e7eb5123258c Support PREFERRED_MIRROR for USE_UNSTABLE.
Rob Landley <rob@landley.net>
parents: 665
diff changeset
287 ([ ! -z "$PREFERRED_MIRROR" ] && SHA1= FILENAME="$ALTFILENAME" try_download "$PREFERRED_MIRROR/$ALTFILENAME")
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
288 return $?
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
289 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
290
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
291 # If environment variable specifies a preferred mirror, try that first.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
292
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
293 if [ ! -z "$PREFERRED_MIRROR" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
294 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
295 try_download "$PREFERRED_MIRROR/$FILENAME" && return 0
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
296 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
297
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
298 # Try standard locations
582
d66eae57a344 Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents: 581
diff changeset
299 # Note: the URLs in mirror list cannot contain whitespace.
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
300
582
d66eae57a344 Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents: 581
diff changeset
301 try_download "$URL" && return 0
d66eae57a344 Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents: 581
diff changeset
302 for i in $MIRROR_LIST
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
303 do
582
d66eae57a344 Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents: 581
diff changeset
304 try_download "$i/$FILENAME" && return 0
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
305 done
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
306
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
307 # Return failure.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
308
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
309 echo "Could not download $FILENAME"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
310 echo -en "\e[0m"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
311 return 1
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
312 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
313
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
314 # Clean obsolete files out of the source directory
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
315
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
316 START_TIME=`date +%s`
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
317
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
318 function cleanup_oldfiles()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
319 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
320 for i in "${SRCDIR}"/*
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
321 do
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
322 if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
323 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
324 echo Removing old file "$i"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
325 rm -rf "$i"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
326 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
327 done
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
328 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
329
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
330 # An exit function that works properly even from a subshell.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
331
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
332 function actually_dienow()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
333 {
629
4db8fc1ea338 Cosmetic tweak.
Rob Landley <rob@landley.net>
parents: 623
diff changeset
334 echo -e "\n\e[31mExiting due to errors ($ARCH_NAME $STAGE_NAME $PACKAGE)\e[0m"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
335 exit 1
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
336 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
337
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
338 trap actually_dienow SIGUSR1
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
339 TOPSHELL=$$
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
340
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
341 function dienow()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
342 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
343 kill -USR1 $TOPSHELL
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
344 exit 1
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
345 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
346
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
347 # Turn a bunch of output lines into a much quieter series of periods.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
348
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
349 function dotprogress()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
350 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
351 x=0
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
352 while read i
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
353 do
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
354 x=$[$x + 1]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
355 if [[ "$x" -eq 25 ]]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
356 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
357 x=0
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
358 echo -n .
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
359 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
360 done
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
361 echo
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
362 }
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
363
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
364 # Extract package $1, use out-of-tree build directory $2 (or $1 if no $2)
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
365 # Use link directory $3 (or $1 if no $3)
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
366
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
367 function setupfor()
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
368 {
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
369 export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.setupfor"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
370
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
371 # Figure out whether we're using an unstable package.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
372
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
373 PACKAGE="$1"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
374 unstable "$PACKAGE" && PACKAGE=alt-"$PACKAGE"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
375
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
376 # Make sure the source is already extracted and up-to-date.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
377 cd "${SRCDIR}" &&
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
378 extract "${PACKAGE}-"*.tar* || exit 1
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
379
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
380 # If all we want to do is extract source, bail out now.
761
93149f07231f Blank ARCH is a bad signal because host-tools.sh has that, so use a separate EXTRACT_ONLY variable.
Rob Landley <rob@landley.net>
parents: 760
diff changeset
381 [ ! -z "$EXTRACT_ONLY" ] && return 0
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
382
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
383 # Set CURSRC
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
384 CURSRC="$PACKAGE"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
385 if [ ! -z "$3" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
386 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
387 CURSRC="$3"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
388 unstable "$CURSRC" && CURSRC=alt-"$CURSRC"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
389 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
390 export CURSRC="${WORK}/${CURSRC}"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
391
623
6f7f4d9011af Add SNAPSHOT_SYMLINK option so extracted source packages can live in a different filesystem than the build directory.
Rob Landley <rob@landley.net>
parents: 595
diff changeset
392 [ -z "$SNAPSHOT_SYMLINK" ] && LINKTYPE="l" || LINKTYPE="s"
6f7f4d9011af Add SNAPSHOT_SYMLINK option so extracted source packages can live in a different filesystem than the build directory.
Rob Landley <rob@landley.net>
parents: 595
diff changeset
393
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
394 # Announce package, with easy-to-grep-for "===" marker.
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
395
727
cc0b6deda270 Cosmetic improvement, have === bars show stage name.
Rob Landley <rob@landley.net>
parents: 724
diff changeset
396 echo "=== Building $PACKAGE ($ARCH_NAME $STAGE_NAME)"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
397 echo "Snapshot '$PACKAGE'..."
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
398 cd "${WORK}" || dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
399 if [ $# -lt 3 ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
400 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
401 rm -rf "${CURSRC}" || dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
402 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
403 mkdir -p "${CURSRC}" &&
623
6f7f4d9011af Add SNAPSHOT_SYMLINK option so extracted source packages can live in a different filesystem than the build directory.
Rob Landley <rob@landley.net>
parents: 595
diff changeset
404 cp -${LINKTYPE}fR "${SRCTREE}/$PACKAGE/"* "${CURSRC}"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
405
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
406 [ $? -ne 0 ] && dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
407
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
408 # Do we have a separate working directory?
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
409
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
410 if [ -z "$2" ]
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
411 then
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
412 cd "$PACKAGE"* || dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
413 else
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
414 mkdir -p "$2" && cd "$2" || dienow
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
415 fi
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
416 export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.$1"
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
417
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
418 # Change window title bar to package now
762
879cf963cdbb Add option to disable title bar display updates.
Rob Landley <rob@landley.net>
parents: 761
diff changeset
419 [ -z "$NO_TITLE_BAR" ] &&
879cf963cdbb Add option to disable title bar display updates.
Rob Landley <rob@landley.net>
parents: 761
diff changeset
420 echo -en "\033]2;$ARCH_NAME $STAGE_NAME $PACKAGE\007"
428
c88e25996320 Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
421 }
440
59fe5a276991 Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents: 436
diff changeset
422
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
423 # Figure out what version of a package we last built
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
424
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
425 function get_download_version()
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
426 {
724
3ccce25660f4 Make MANIFEST generation less brittle.
Rob Landley <rob@landley.net>
parents: 720
diff changeset
427 getversion $(sed -n 's@URL=.*/\(.[^ ]*\).*@\1@p' "$TOP/download.sh" | grep ${1}-)
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
428 }
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
429
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
430 # Identify subversion or mercurial revision, or release number
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
431
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
432 function identify_release()
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
433 {
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
434 if unstable "$1"
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
435 then
767
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
436 for i in "b" ""
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
437 do
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
438 FILE="$(echo "$SRCDIR/alt-$1-"*.tar.$i*)"
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
439 if [ -f "$FILE" ]
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
440 then
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
441 GITID="$(${i}zcat "$FILE" | git get-tar-commit-id)"
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
442 if [ ! -z "$GITID" ]
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
443 then
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
444 # The first dozen chars should form a unique id.
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
445
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
446 echo $GITID | sed 's/^\(................\).*/git \1/'
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
447 return
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
448 fi
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
449 fi
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
450 done
dc19e20734ca Use the git magic tarball comment field to get the version number of unstable git packages for MANIFEST.
Rob Landley <rob@landley.net>
parents: 762
diff changeset
451
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
452 # Need to extract unstable packages to determine source control version.
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
453
761
93149f07231f Blank ARCH is a bad signal because host-tools.sh has that, so use a separate EXTRACT_ONLY variable.
Rob Landley <rob@landley.net>
parents: 760
diff changeset
454 EXTRACT_ONLY=1 setupfor "$1" >&2
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
455 DIR="${BUILD}/sources/alt-$1"
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
456
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
457 if [ -d "$DIR/.svn" ]
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
458 then
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
459 ( cd "$DIR"; echo subversion rev \
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
460 $(svn info | sed -n "s/^Revision: //p")
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
461 )
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
462 return 0
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
463 elif [ -d "$DIR/.hg" ]
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
464 then
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
465 ( echo mercurial rev \
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
466 $(hg tip | sed -n 's/changeset: *\([0-9]*\).*/\1/p')
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
467 )
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
468 return 0
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
469 fi
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
470 fi
760
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
471
2537f30c2397 Improve version detection for MANIFEST file. Still doesn't detect version for git archive output because git hasn't got any equivalent of mercurial's .hg_archive.txt file.
Rob Landley <rob@landley.net>
parents: 744
diff changeset
472 echo release version $(get_download_version $1)
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
473 }
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
474
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
475 # Create a README identifying package versions in current build.
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
476
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
477 function do_readme()
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
478 {
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
479 # Grab FWL version number
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
480
662
1fa9eb882e3b Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents: 647
diff changeset
481 [ -z "$FWL_VERS" ] &&
1fa9eb882e3b Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents: 647
diff changeset
482 FWL_VERS="mercurial rev $(cd "$TOP"; hg tip | sed -n 's/changeset: *\([0-9]*\).*/\1/p')"
1fa9eb882e3b Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents: 647
diff changeset
483
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
484 cat << EOF
662
1fa9eb882e3b Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents: 647
diff changeset
485 Built on $(date +%F) from:
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
486
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
487 Build script:
662
1fa9eb882e3b Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents: 647
diff changeset
488 Firmware Linux (http://landley.net/code/firmware) $FWL_VERS
464
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
489
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
490 Base packages:
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
491 uClibc (http://uclibc.org) $(identify_release uClibc)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
492 BusyBox (http://busybox.net) $(identify_release busybox)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
493 Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
494
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
495 Toolchain packages:
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
496 Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
497 )
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
498 GCC (http://gcc.gnu.org) $(identify_release gcc-core)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
499 gmake (http://www.gnu.org/software/make) $(identify_release make)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
500 bash (ftp://ftp.gnu.org/gnu/bash) $(identify_release bash)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
501
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
502 Optional packages:
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
503 Toybox (http://landley.net/code/toybox) $(identify_release toybox)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
504 distcc (http://distcc.samba.org) $(identify_release distcc)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
505 uClibc++ (http://cxx.uclibc.org) $(identify_release uClibc++)
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
506 EOF
99e039a4b8bc Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents: 461
diff changeset
507 }
685
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
508
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
509 # When building with a base architecture, symlink to the base arch name.
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
510
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
511 function link_arch_name()
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
512 {
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
513 [ "$ARCH" == "$ARCH_NAME" ] && return 0
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
514
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
515 rm -rf "$BUILD/$2" &&
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
516 ln -s "$1" "$BUILD/$2" || dienow
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
517 }
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
518
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
519 # Check if this target has a base architecture that's already been built.
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
520 # If so, just tar it up and exit now.
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
521
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
522 function check_for_base_arch()
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
523 {
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
524 # If we're building something with a base architecture, symlink to actual
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
525 # target.
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
526
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
527 if [ "$ARCH" != "$ARCH_NAME" ] && [ -e "$BUILD/$1-$ARCH" ]
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
528 then
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
529 echo === Using existing $1-"$ARCH"
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
530
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
531 link_arch_name $1-{"$ARCH","$ARCH_NAME"}
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
532 [ -e $1-"$ARCH".tar.bz2 ] &&
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
533 link_arch_name $1-{"$ARCH","$ARCH_NAME"}.tar.bz2
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
534
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
535 return 1
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
536 fi
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
537 }
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
538
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
539 function create_stage_tarball()
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
540 {
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
541 # Handle linking to base architecture if we just built a derivative target.
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
542
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
543 cd "$BUILD" || dienow
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
544 link_arch_name $1-{$ARCH,$ARCH_NAME}
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
545
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
546 if [ -z "$SKIP_STAGE_TARBALLS" ]
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
547 then
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
548 echo -n creating "$1-${ARCH}".tar.bz2
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
549
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
550 { tar cjvf "$1-${ARCH}".tar.bz2 "$1-${ARCH}" || dienow
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
551 } | dotprogress
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
552
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
553 link_arch_name $1-{$ARCH,$ARCH_NAME}.tar.bz2
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
554 fi
90ab1a1f4db5 Teach build not to rebuild base architecture toolchains. Factor out some common code while there.
Rob Landley <rob@landley.net>
parents: 683
diff changeset
555 }
776
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
556
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
557 # Run a command either in foreground or background, depending on $FORK
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
558 # Log to the file $LOG
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
559
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
560 doforklog()
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
561 {
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
562 [ -z "$LOG" ] && LOG=/dev/null
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
563
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
564 if [ ! -z "$FORK" ]
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
565 then
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
566 $* 2>&1 | tee "$LOG" | grep '^===' &
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
567 else
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
568 $* 2>&1 | tee "$LOG"
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
569 fi
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
570 }
37c083cca810 Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents: 773
diff changeset
571