Mercurial > hg > aboriginal
annotate sources/functions.sh @ 928:0291e9591d18
Update downloads/binaries/README
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 08 Dec 2009 20:22:53 -0600 |
parents | 8b69eeb17ebf |
children | eb7e1087f0ee |
rev | line source |
---|---|
840 | 1 #!/bin/echo "This file is sourced, not run" |
2 | |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # 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
|
4 |
919
8b69eeb17ebf
Break up sources/functions.sh starting with some of the more obviously independent ones.
Rob Landley <rob@landley.net>
parents:
915
diff
changeset
|
5 source sources/utility_functions.sh |
8b69eeb17ebf
Break up sources/functions.sh starting with some of the more obviously independent ones.
Rob Landley <rob@landley.net>
parents:
915
diff
changeset
|
6 |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
7 # Output the first cross compiler (static or basic) that's installed. |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
8 |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
9 cc_path() |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
10 { |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
11 local i |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
12 |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
13 for i in "$BUILD"/cross-{static,compiler}-"$1/bin" |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
14 do |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
15 [ -e "$i/$1-cc" ] && break |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
16 done |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
17 echo -n "$i:" |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
18 } |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
19 |
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
|
20 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
|
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 # 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
|
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 ARCH_NAME="$1" |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
25 if [ ! -f "${SOURCES}/targets/${ARCH_NAME}/settings" ] |
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
|
26 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
|
27 echo "Supported architectures: " |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
28 (cd "${SOURCES}/targets" && ls) |
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
|
29 |
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 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
|
31 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
|
32 |
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 # 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
|
34 |
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 ARCH="$ARCH_NAME" |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
36 CONFIG_DIR="${SOURCES}/targets" |
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
|
37 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
|
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 # 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
|
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 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
|
42 |
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 # 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
|
44 # 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
|
45 # 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
|
46 # 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
|
47 # 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
|
48 [ -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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 [ -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
|
54 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
|
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 # 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
|
57 |
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 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
|
59 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
|
60 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
|
61 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
|
62 [ -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
|
63 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
|
64 [ -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
|
65 |
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 # 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
|
67 |
844
ea9af6c73dbf
Use the ARCH_NAME rather than ARCH when making stage directories. The only place we don't run check_for_base_arch is system-image, and here we want this to differ because of the kernels.
Mark Miller <mark@mirell.org>
parents:
840
diff
changeset
|
68 STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}" |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
69 |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
70 export PATH="$(cc_path "$ARCH")$PATH" |
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
71 [ "$FROM_ARCH" != "$ARCH" ] && PATH="$(cc_path "$FROM_ARCH")$PATH" |
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
|
72 |
798
2c9f22daa8fe
Allow target settings to specify BUILD_STATIC.
Rob Landley <rob@landley.net>
parents:
796
diff
changeset
|
73 # Check this here because it could be set in "settings" |
2c9f22daa8fe
Allow target settings to specify BUILD_STATIC.
Rob Landley <rob@landley.net>
parents:
796
diff
changeset
|
74 |
2c9f22daa8fe
Allow target settings to specify BUILD_STATIC.
Rob Landley <rob@landley.net>
parents:
796
diff
changeset
|
75 [ ! -z "$BUILD_STATIC" ] && STATIC_FLAGS="--static" |
2c9f22daa8fe
Allow target settings to specify BUILD_STATIC.
Rob Landley <rob@landley.net>
parents:
796
diff
changeset
|
76 |
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
|
77 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
|
78 } |
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
|
79 |
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
|
80 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
|
81 { |
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
|
82 # 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
|
83 [ -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
|
84 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
|
85 |
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
|
86 # 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
|
87 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
|
88 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
|
89 } |
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
|
90 |
820
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
91 # Note that this sources the file, rather than calling it as a separate |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
92 # process. That way it can set environment variables if it wants to. |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
93 |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
94 function build_section() |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
95 { |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
96 . "$SOURCES"/sections/"$1".sh |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
97 } |
d1a88d878e18
Factor out and unify binutils, gcc, and ccwrap builds.
Rob Landley <rob@landley.net>
parents:
818
diff
changeset
|
98 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 # 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
|
100 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 function unstable() |
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 [ ! -z "$(echo ,"$USE_UNSTABLE", | grep ,"$1",)" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
104 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
105 |
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
|
106 # 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
|
107 |
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
|
108 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
|
109 { |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
110 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
|
111 {$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
|
112 do |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
113 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
|
114 then |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
115 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
|
116 return |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
117 fi |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
118 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
|
119 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
120 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
|
121 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
|
122 } |
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
|
123 |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
124 # Find all files in $STAGE_DIR newer than $CURSRC. |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
125 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
126 function recent_binary_files() |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
127 { |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
128 PREVIOUS= |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
129 (cd "$STAGE_DIR" || dienow |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
130 # Note $WORK/$PACKAGE != $CURSRC here for renamed packages like gcc-core. |
818
87ebc3d2a067
Eliminate a stupid warning that GNU find produces. (Works fine either way, but it's noisy.)
Rob Landley <rob@landley.net>
parents:
817
diff
changeset
|
131 find . -depth -newer "$WORK/$PACKAGE/FWL-TIMESTAMP" \ |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
132 | sed -e 's/^.//' -e 's/^.//' -e '/^$/d' |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
133 ) | while read i |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
134 do |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
135 TEMP="${PREVIOUS##"$i"/}" |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
136 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
137 if [ $[${#PREVIOUS}-${#TEMP}] -ne $[${#i}+1] ] |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
138 then |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
139 # Because the expanded $i might have \ chars in it, that's why. |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
140 echo -n "$i" |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
141 echo -ne '\0' |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
142 fi |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
143 PREVIOUS="$i" |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
144 done |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
145 } |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
146 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
147 # Strip the version number off a tarball |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
148 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
149 function cleanup() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
150 { |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
151 # If package build exited with an error, do not continue. |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
152 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
153 [ $? -ne 0 ] && dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
154 |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
155 if [ ! -z "$BINARY_PACKAGE_TARBALLS" ] |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
156 then |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
157 TARNAME="$PACKAGE-$STAGE_NAME-${ARCH_NAME}".tar.bz2 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
158 echo -n Creating "$TARNAME" |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
159 { recent_binary_files | xargs -0 tar -cjvf \ |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
160 "$BUILD/${TARNAME}".tar.bz2 -C "$STAGE_DIR" || dienow |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
161 } | dotprogress |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
162 fi |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
163 |
567
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
164 if [ ! -z "$NO_CLEANUP" ] |
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
165 then |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
166 echo "skip cleanup $PACKAGE $@" |
567
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
167 return |
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
168 fi |
5619a7375b74
Add NO_CLEANUP option to config.
Rob Landley <rob@landley.net>
parents:
534
diff
changeset
|
169 |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
170 # Loop deleting directories |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
171 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
172 cd "$WORK" || dienow |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
173 for i in "$PACKAGE" "$@" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
174 do |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
175 [ -z "$i" ] && continue |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
176 echo "cleanup $i" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
177 rm -rf "$i" || dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
178 done |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
179 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
180 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
181 # Give filename.tar.ext minus the version number. |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
182 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
183 function noversion() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
184 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
185 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
|
186 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
187 |
440
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
188 # 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
|
189 |
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
190 function getversion() |
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
191 { |
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
192 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
|
193 } |
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
194 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
195 # 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
|
196 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
197 function basename() |
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 noversion $1 | sed 's/\.tar\..z2*$//' |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
200 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
201 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
202 # output the sha1sum of a file |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
203 function sha1file() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
204 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
205 sha1sum "$@" | awk '{print $1}' |
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 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
208 # Extract tarball named in $1 and apply all relevant patches into |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
209 # "$BUILD/packages/$1". Record sha1sum of tarball and patch files in |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
210 # 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
|
211 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
212 function extract() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
213 { |
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
|
214 FILENAME="$1" |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
215 SRCTREE="${BUILD}/packages" |
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 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
|
217 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
218 # 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
|
219 |
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
|
220 if [ -z "$PACKAGE" ] || [ -z "$SRCTREE" ] |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
221 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
222 dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
223 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
224 |
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
|
225 # 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
|
226 # 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
|
227 |
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
|
228 [ ! -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
|
229 |
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
|
230 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
|
231 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
232 # 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
|
233 SHALIST=$(cat "$SHA1FILE" 2> /dev/null) |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
234 if [ ! -z "$SHALIST" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
235 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
|
236 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
|
237 do |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
238 # Is this sha1 in the file? |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
239 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
|
240 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
241 SHALIST=missing |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
242 break |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
243 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
244 # Remove it |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
245 SHALIST="$(echo "$SHALIST" | sed "s/$i//" )" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
246 done |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
247 # 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
|
248 [ -z "$SHALIST" ] && return 0 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
249 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
250 |
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
|
251 echo -n "Extracting '${PACKAGE}'" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
252 # 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
|
253 rm -rf "${BUILD}/temp" "${SRCTREE}/${PACKAGE}" 2>/dev/null |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
254 mkdir -p "${BUILD}"/{temp,packages} || dienow |
428
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 # Is it a bzip2 or gzip tarball? |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
257 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
|
258 [ "$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
|
259 [ "$FILENAME" != "${FILENAME/%\.tar\.gz/}" ] && DECOMPRESS="z" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
260 |
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
|
261 { 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
|
262 } | dotprogress |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
263 |
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
|
264 mv "${BUILD}/temp/"* "${SRCTREE}/${PACKAGE}" && |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
265 rmdir "${BUILD}/temp" && |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
266 echo "$SHA1TAR" > "$SHA1FILE" |
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 [ $? -ne 0 ] && dienow |
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 # Apply any patches to this package |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
271 |
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
|
272 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
|
273 do |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
274 if [ -f "$i" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
275 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
276 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
|
277 (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
|
278 sha1file "$i" >> "$SHA1FILE" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
279 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
280 done |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
281 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
282 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
283 function try_checksum() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
284 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
285 SUM="$(sha1file "$SRCDIR/$FILENAME" 2>/dev/null)" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
286 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
|
287 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
288 if [ -z "$SHA1" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
289 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
290 echo "No SHA1 for $FILENAME ($SUM)" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
291 else |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
292 echo "Confirmed $FILENAME" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
293 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
294 |
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
|
295 # 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
|
296 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
297 [ -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
|
298 EXTRACT_ONLY=1 setupfor "$(basename "$FILENAME")" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
299 return $? |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
300 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
301 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
302 return 1 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
303 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
304 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
305 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
306 function try_download() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
307 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
308 # 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
|
309 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
310 try_checksum && return 0 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
311 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
312 # 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
|
313 # 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
|
314 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
315 rm "$SRCDIR/$FILENAME" 2> /dev/null |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
316 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
317 # 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
|
318 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
319 if [ -n "$1" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
320 then |
668
e7eb5123258c
Support PREFERRED_MIRROR for USE_UNSTABLE.
Rob Landley <rob@landley.net>
parents:
665
diff
changeset
|
321 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
|
322 (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
|
323 touch -c "$SRCDIR/$FILENAME" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
324 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
325 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
326 try_checksum |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
327 } |
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 # 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
|
330 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
331 function download() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
332 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
333 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
|
334 [ -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
|
335 ALTFILENAME=alt-"$(noversion "$FILENAME" -0)" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
336 |
595
161e2bca18f4
Add slightly more debugging/status info to download.
Rob Landley <rob@landley.net>
parents:
582
diff
changeset
|
337 echo -ne "checking $FILENAME\r" |
161e2bca18f4
Add slightly more debugging/status info to download.
Rob Landley <rob@landley.net>
parents:
582
diff
changeset
|
338 |
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
|
339 # 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
|
340 # 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
|
341 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
|
342 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
567
diff
changeset
|
343 # 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
|
344 if unstable "$(basename "$FILENAME")" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
345 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
346 # 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
|
347 FILENAME="$ALTFILENAME" SHA1= try_download "$UNSTABLE" || |
e7eb5123258c
Support PREFERRED_MIRROR for USE_UNSTABLE.
Rob Landley <rob@landley.net>
parents:
665
diff
changeset
|
348 ([ ! -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
|
349 return $? |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
350 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
351 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
352 # 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
|
353 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
354 if [ ! -z "$PREFERRED_MIRROR" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
355 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
356 try_download "$PREFERRED_MIRROR/$FILENAME" && return 0 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
357 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
358 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
359 # Try standard locations |
582
d66eae57a344
Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents:
581
diff
changeset
|
360 # 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
|
361 |
582
d66eae57a344
Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents:
581
diff
changeset
|
362 try_download "$URL" && return 0 |
d66eae57a344
Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents:
581
diff
changeset
|
363 for i in $MIRROR_LIST |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
364 do |
582
d66eae57a344
Move mirror list into download.sh.
Rob Landley <rob@landley.net>
parents:
581
diff
changeset
|
365 try_download "$i/$FILENAME" && return 0 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
366 done |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
367 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
368 # Return failure. |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
369 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
370 echo "Could not download $FILENAME" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
371 echo -en "\e[0m" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
372 return 1 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
373 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
374 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
375 # Clean obsolete files out of the source directory |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
376 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
377 START_TIME=`date +%s` |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
378 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
379 function cleanup_oldfiles() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
380 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
381 for i in "${SRCDIR}"/* |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
382 do |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
383 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
|
384 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
385 echo Removing old file "$i" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
386 rm -rf "$i" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
387 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
388 done |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
389 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
390 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
391 # 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
|
392 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
393 function actually_dienow() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
394 { |
629 | 395 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
|
396 exit 1 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
397 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
398 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
399 trap actually_dienow SIGUSR1 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
400 TOPSHELL=$$ |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
401 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
402 function dienow() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
403 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
404 kill -USR1 $TOPSHELL |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
405 exit 1 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
406 } |
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 # 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
|
409 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
410 function dotprogress() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
411 { |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
412 x=0 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
413 while read i |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
414 do |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
415 x=$[$x + 1] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
416 if [[ "$x" -eq 25 ]] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
417 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
418 x=0 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
419 echo -n . |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
420 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
421 done |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
422 echo |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
423 } |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
424 |
835
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
425 function set_titlebar() |
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
426 { |
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
427 [ -z "$NO_TITLE_BAR" ] && |
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
428 echo -en "\033]2;$1\007" |
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
429 } |
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
430 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
431 # 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
|
432 # 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
|
433 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
434 function setupfor() |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
435 { |
897
850da666acc6
Redo command recording: no longer RECORD_COMMMANDS config entry, now sources/more/record-commands.sh run to set up the wrapper (either before or after host-tools.sh). General cleanup and simplification of code this interacted with, plus clean up bit rot in the reporting.
Rob Landley <rob@landley.net>
parents:
844
diff
changeset
|
436 export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.${ARCH_NAME}.${STAGE_NAME}.setupfor" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
437 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
438 # 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
|
439 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
440 PACKAGE="$1" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
441 unstable "$PACKAGE" && PACKAGE=alt-"$PACKAGE" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
442 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
443 # 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
|
444 cd "${SRCDIR}" && |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
445 extract "${PACKAGE}-"*.tar* || exit 1 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
446 |
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
|
447 # 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
|
448 [ ! -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
|
449 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
450 # Set CURSRC |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
451 CURSRC="$PACKAGE" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
452 if [ ! -z "$3" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
453 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
454 CURSRC="$3" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
455 unstable "$CURSRC" && CURSRC=alt-"$CURSRC" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
456 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
457 export CURSRC="${WORK}/${CURSRC}" |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
458 |
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
|
459 [ -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
|
460 |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
461 # Announce package, with easy-to-grep-for "===" marker. |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
462 |
727
cc0b6deda270
Cosmetic improvement, have === bars show stage name.
Rob Landley <rob@landley.net>
parents:
724
diff
changeset
|
463 echo "=== Building $PACKAGE ($ARCH_NAME $STAGE_NAME)" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
464 echo "Snapshot '$PACKAGE'..." |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
465 cd "${WORK}" || dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
466 if [ $# -lt 3 ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
467 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
468 rm -rf "${CURSRC}" || dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
469 fi |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
470 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
|
471 cp -${LINKTYPE}fR "${SRCTREE}/$PACKAGE/"* "${CURSRC}" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
472 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
473 [ $? -ne 0 ] && dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
474 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
475 # Do we have a separate working directory? |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
476 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
477 if [ -z "$2" ] |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
478 then |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
479 cd "$PACKAGE"* || dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
480 else |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
481 mkdir -p "$2" && cd "$2" || dienow |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
482 fi |
897
850da666acc6
Redo command recording: no longer RECORD_COMMMANDS config entry, now sources/more/record-commands.sh run to set up the wrapper (either before or after host-tools.sh). General cleanup and simplification of code this interacted with, plus clean up bit rot in the reporting.
Rob Landley <rob@landley.net>
parents:
844
diff
changeset
|
483 export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.${ARCH_NAME}.${STAGE_NAME}.$1" |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
484 |
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
485 # Change window title bar to package now |
835
f0b5901bca48
Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents:
820
diff
changeset
|
486 set_titlebar "$ARCH_NAME $STAGE_NAME $PACKAGE" |
815
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
487 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
488 # Ugly bug workaround: timestamp granularity in a lot of filesystems is only |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
489 # 1 second, so find -newer misses things installed in the same second, so we |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
490 # make sure it's a new second before we start actually doing anything. |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
491 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
492 if [ ! -z "$BINARY_PACKAGE_TARBALLS" ] |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
493 then |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
494 touch "${CURSRC}/FWL-TIMESTAMP" || dienow |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
495 TIME=$(date +%s) |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
496 while true |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
497 do |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
498 [ $TIME != "$(date +%s)" ] && break |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
499 sleep .1 |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
500 done |
8129df56091b
Extended setupfor/cleanup to create binary package tarballs if the configure option BINARY_PACKAGE_TARBALLS is set. These tarballs extract into the current directory and add all the changed files installed by this package build, so you can pick and choose when assembling your own filesystem.
Rob Landley <rob@landley.net>
parents:
798
diff
changeset
|
501 fi |
428
c88e25996320
Split function definitions out from include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
502 } |
440
59fe5a276991
Add getversion() and wait4background(), useful to build wrappers.
Rob Landley <rob@landley.net>
parents:
436
diff
changeset
|
503 |
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
|
504 # 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
|
505 |
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 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
|
507 { |
724
3ccce25660f4
Make MANIFEST generation less brittle.
Rob Landley <rob@landley.net>
parents:
720
diff
changeset
|
508 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
|
509 } |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
510 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
511 # 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
|
512 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
513 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
|
514 { |
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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 # 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
|
526 |
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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 |
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
|
533 # 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
|
534 |
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
|
535 EXTRACT_ONLY=1 setupfor "$1" >&2 |
817
a6cb42614a1d
Rename build/sources to build/packages to reduce confusion (since sources/packages got moved up to just packages, and this contains the extracted contents of that). And use $SOURCES instead of $TOP/sources in a few places.
Rob Landley <rob@landley.net>
parents:
815
diff
changeset
|
536 DIR="${BUILD}/packages/alt-$1" |
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
|
537 |
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
|
538 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
|
539 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
|
540 ( 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
|
541 $(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
|
542 ) |
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
|
543 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
|
544 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
|
545 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
|
546 ( 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
|
547 $(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
|
548 ) |
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
|
549 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
|
550 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
|
551 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
|
552 |
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
|
553 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
|
554 } |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
555 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
556 # 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
|
557 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
558 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
|
559 { |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
560 # 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
|
561 |
662
1fa9eb882e3b
Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents:
647
diff
changeset
|
562 [ -z "$FWL_VERS" ] && |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
563 FWL_VERS="mercurial rev $(cd "$TOP"; hg tip 2>/dev/null | sed -n 's/changeset: *\([0-9]*\).*/\1/p')" |
662
1fa9eb882e3b
Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents:
647
diff
changeset
|
564 |
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
|
565 cat << EOF |
662
1fa9eb882e3b
Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents:
647
diff
changeset
|
566 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
|
567 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
568 Build script: |
662
1fa9eb882e3b
Allow FWL revision number to be overridden in MANIFEST (for releases).
Rob Landley <rob@landley.net>
parents:
647
diff
changeset
|
569 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
|
570 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
571 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
|
572 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
|
573 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
|
574 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
|
575 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
576 Toolchain packages: |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
577 Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils) |
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
|
578 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
|
579 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
|
580 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
|
581 |
99e039a4b8bc
Move README generation to functions.sh, clean up build-all-target.sh option parsing.
Rob Landley <rob@landley.net>
parents:
461
diff
changeset
|
582 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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 } |
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
|
588 |
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
|
589 # 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
|
590 |
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
|
591 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
|
592 { |
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
|
593 [ "$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
|
594 |
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
|
595 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
|
596 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
|
597 } |
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
|
598 |
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
|
599 # Check if this target has a base architecture that's already been built. |
915
a541c5a96ff3
Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
Rob Landley <rob@landley.net>
parents:
904
diff
changeset
|
600 # If so, link to it and exit now. |
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
|
601 |
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
|
602 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
|
603 { |
898
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
604 blank_tempdir "$STAGE_DIR" |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
605 blank_tempdir "$WORK" |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
606 |
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
|
607 # 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
|
608 # 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
|
609 |
898
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
610 if [ "$ARCH" != "$ARCH_NAME" ] |
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
|
611 then |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
612 link_arch_name $STAGE_NAME-{"$ARCH","$ARCH_NAME"} |
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
613 [ -e $STAGE_NAME-"$ARCH".tar.bz2 ] && |
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
614 link_arch_name $STAGE_NAME-{"$ARCH","$ARCH_NAME"}.tar.bz2 |
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
|
615 |
898
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
616 if [ -e "$BUILD/$STAGE_NAME-$ARCH" ] |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
617 then |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
618 echo "=== Using existing ${STAGE_NAME}-$ARCH" |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
619 |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
620 return 1 |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
621 else |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
622 mkdir -p "$BUILD/$STAGE_NAME-$ARCH" || dienow |
db0f536aee7c
Fix hw-target builds so prerequisites build if they don't already exist.
Rob Landley <rob@landley.net>
parents:
897
diff
changeset
|
623 fi |
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
|
624 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
|
625 } |
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
|
626 |
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
|
627 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
|
628 { |
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
|
629 # 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
|
630 |
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
|
631 cd "$BUILD" || dienow |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
632 link_arch_name $STAGE_NAME-{$ARCH,$ARCH_NAME} |
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
|
633 |
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
|
634 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
|
635 then |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
636 echo -n creating "$STAGE_NAME-${ARCH}".tar.bz2 |
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
|
637 |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
638 { tar cjvf "$STAGE_NAME-${ARCH}".tar.bz2 "$STAGE_NAME-${ARCH}" || dienow |
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
|
639 } | 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
|
640 |
783
db06a8c1bfed
Lots of changes to move buildall.sh functionality into build.sh.
Rob Landley <rob@landley.net>
parents:
778
diff
changeset
|
641 link_arch_name $STAGE_NAME-{$ARCH,$ARCH_NAME}.tar.bz2 |
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
|
642 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
|
643 } |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
644 |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
645 # Filter out unnecessary noise |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
646 |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
647 maybe_quiet() |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
648 { |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
649 [ -z "$QUIET" ] && cat || grep "^===" |
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
650 } |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
651 |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
652 # Run a command either in foreground or background, depending on $FORK |
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
653 |
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
654 maybe_fork() |
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
655 { |
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
656 if [ -z "$FORK" ] |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
657 then |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
658 eval "$*" |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
659 else |
787
23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
Rob Landley <rob@landley.net>
parents:
783
diff
changeset
|
660 eval "$*" & |
776
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
661 fi |
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
662 } |
37c083cca810
Move doforklog to sources/functions.sh.
Rob Landley <rob@landley.net>
parents:
773
diff
changeset
|
663 |
778
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
664 # Kill a process and all its decendants |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
665 |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
666 function killtree() |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
667 { |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
668 local KIDS="" |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
669 |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
670 while [ $# -ne 0 ] |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
671 do |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
672 KIDS="$KIDS $(pgrep -P$1)" |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
673 shift |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
674 done |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
675 |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
676 KIDS="$(echo -n $KIDS)" |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
677 if [ ! -z "$KIDS" ] |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
678 then |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
679 # Depth first kill avoids reparent_to_init hiding stuff. |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
680 killtree $KIDS |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
681 kill $KIDS 2>/dev/null |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
682 fi |
e373d2b6d0b8
Add killtree and make stuff use it. Update smoketest-all.sh to use doforklog, allowing FORK=1 to run stuff in parallel.
Rob Landley <rob@landley.net>
parents:
777
diff
changeset
|
683 } |
796
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
684 |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
685 # Create colon-separated path for $HOSTTOOLS and all fallback directories |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
686 # (Fallback directories are to support ccache and distcc on the host.) |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
687 |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
688 function hosttools_path() |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
689 { |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
690 local X |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
691 |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
692 echo -n "$HOSTTOOLS" |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
693 X=1 |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
694 while [ -e "$HOSTTOOLS/fallback-$X" ] |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
695 do |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
696 echo -n ":$HOSTTOOLS/fallback-$X" |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
697 X=$[$X+1] |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
698 done |
5f793a1ca658
Teach host-tools.sh to create multiple symlinks in fallback directories for ccache and distcc.
Rob Landley <rob@landley.net>
parents:
787
diff
changeset
|
699 } |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
700 |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
701 |
903
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
702 # Search a colon-separated path for files matching a pattern. |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
703 |
903
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
704 # Arguments are 1) path to search, 2) pattern, 3) command to run on each file. |
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
705 # During command, $DIR/$FILE points to file found. |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
706 |
903
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
707 path_search() |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
708 { |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
709 # For each each $PATH element, loop through each file in that directory, |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
710 # and create a symlink to the wrapper with that name. In the case of |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
711 # duplicates, keep the first one. |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
712 |
903
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
713 echo "$1" | sed 's/:/\n/g' | while read DIR |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
714 do |
904
2ed667428dbd
Fix path_search to actually use the pattern argument.
Rob Landley <rob@landley.net>
parents:
903
diff
changeset
|
715 find "$DIR" -maxdepth 1 -mindepth 1 -name "$2" | sed 's@.*/@@' | \ |
2ed667428dbd
Fix path_search to actually use the pattern argument.
Rob Landley <rob@landley.net>
parents:
903
diff
changeset
|
716 while read FILE |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
717 do |
903
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
718 eval "$3" |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
719 |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
720 # Output is verbose. Pipe it to dotprogress. |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
721 |
903
5ffc758bf60a
Genericize search path traversal logic with pattern and command to apply to each file found.
Rob Landley <rob@landley.net>
parents:
899
diff
changeset
|
722 echo $FILE |
899
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
723 done |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
724 done |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
725 } |
726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
Rob Landley <rob@landley.net>
parents:
898
diff
changeset
|
726 |