Mercurial > hg > aboriginal
annotate include.sh @ 399:4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 28 Sep 2008 05:45:13 -0500 |
parents | a7daae215647 |
children | c36ed884fda5 |
rev | line source |
---|---|
173
8b4c243a212e
Add better debug info to a status report, and stop fighting ubuntu so much
Rob Landley <rob@landley.net>
parents:
170
diff
changeset
|
1 #!/bin/bash |
138
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
2 |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
3 |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
4 [ -e config ] && source config |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
5 |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
6 # What host compiler should we use? |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
7 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
8 [ -z "$CC" ] && CC=gcc |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
9 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
10 # How many processors should make -j use? |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
11 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
12 if [ -z "$CPUS" ] |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
13 then |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
14 export CPUS=$[$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)+0] |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
15 [ "$CPUS" -lt 1 ] && CPUS=1 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
16 fi |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
17 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
18 umask 022 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
19 unset CFLAGS CXXFLAGS |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
20 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
21 # This tells gcc to aggressively garbage collect its internal data |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
22 # structures. Without this, gcc triggers the OOM killer trying to rebuild |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
23 # itself in 128 megs of ram, which is the QEMU default size. Don't do |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
24 # this on a 64 bit host or gcc will slow to a crawl due to insufficient memory. |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
25 [ "$(uname -m)" != "x86_64" ] && |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
26 export CFLAGS="--param ggc-min-expand=0 --param ggc-min-heapsize=8192" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
27 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
28 # Find/create directories |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
29 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
30 TOP=`pwd` |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
31 export SOURCES="${TOP}/sources" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
32 export SRCDIR="${SOURCES}/packages" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
33 export FROMSRC=../packages |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
34 export BUILD="${TOP}/build" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
35 export HOSTTOOLS="${BUILD}/host" |
352
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
36 |
357
5c61d556fe0c
Make forkbomb.sh --fork work with RECORD_COMMANDS.
Rob Landley <rob@landley.net>
parents:
352
diff
changeset
|
37 [ -z "$WRAPPY_LOGDIR" ] && WRAPPY_LOGDIR="$BUILD" |
5c61d556fe0c
Make forkbomb.sh --fork work with RECORD_COMMANDS.
Rob Landley <rob@landley.net>
parents:
352
diff
changeset
|
38 |
352
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
39 # Adjust $PATH |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
40 |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
41 if [ "$PATH" != "$HOSTTOOLS" ] |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
42 then |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
43 if [ -f "$HOSTTOOLS/busybox" ] |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
44 then |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
45 PATH="$HOSTTOOLS" |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
46 else |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
47 PATH="${HOSTTOOLS}:$PATH" |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
48 fi |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
49 fi |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
50 |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
51 STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'` |
357
5c61d556fe0c
Make forkbomb.sh --fork work with RECORD_COMMANDS.
Rob Landley <rob@landley.net>
parents:
352
diff
changeset
|
52 export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.setupfor" |
352
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
53 if [ -f "$BUILD/wrapdir/wrappy" ] |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
54 then |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
55 export WRAPPY_REALPATH="$PATH" |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
56 PATH="$BUILD/wrapdir" |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
57 fi |
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
58 |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
59 mkdir -p "${SRCDIR}" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
60 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
61 # Tell bash not to cache the $PATH because we modify it. Without this, bash |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
62 # won't find new executables added after startup. |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
63 set +h |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
64 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
65 # Get target platform from first command line argument. |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
66 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
67 if [ -z "$NO_ARCH" ] |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
68 then |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
69 ARCH_NAME="$1" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
70 ARCH="$(echo "$1" | sed 's@.*/@@')" |
387
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
71 if [ ! -f "${TOP}/sources/targets/${ARCH}/details" ] |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
72 then |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
73 echo "Supported architectures: " |
387
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
74 (cd "${TOP}/sources/targets" && ls) |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
75 exit 1 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
76 fi |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
77 |
387
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
78 # Read the relevant config file. |
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
79 |
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
80 CONFIG_DIR="${TOP}/sources/targets/${ARCH}" |
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
81 source "${CONFIG_DIR}/details" |
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
82 |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
83 # Which platform are we building for? |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
84 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
85 export WORK="${BUILD}/temp-$ARCH" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
86 mkdir -p "${WORK}" |
387
f0ceae67ebd0
Convert sources/configs/$ARCH files to sources/targets/$ARCH directories.
Rob Landley <rob@landley.net>
parents:
378
diff
changeset
|
87 |
351
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
88 # Say "unknown" in two different ways so it doesn't assume we're NOT |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
89 # cross compiling when the host and target are the same processor. (If host |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
90 # and target match, the binutils/gcc/make builds won't use the cross compiler |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
91 # during mini-native.sh, and the host compiler links binaries against the |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
92 # wrong libc.) |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
93 [ -z "$CROSS_HOST" ] && export CROSS_HOST=`uname -m`-walrus-linux |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
94 [ -z "$CROSS_TARGET" ] && export CROSS_TARGET=${ARCH}-unknown-linux |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
95 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
96 # Setup directories and add the cross compiler to the start of the path. |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
97 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
98 export CROSS="${BUILD}/cross-compiler-$ARCH" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
99 export NATIVE="${BUILD}/mini-native-$ARCH" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
100 export PATH="${CROSS}/bin:$PATH" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
101 else |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
102 export WORK="${BUILD}/host-temp" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
103 mkdir -p "${WORK}" |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
104 fi |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
105 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
106 [ $? -ne 0 ] && dienow |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
107 |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
108 # Everything after here is utility functions used by the other scripts. |
7f529baf0b57
Reorganize include.sh to put config options at the top, minor cleanups.
Rob Landley <rob@landley.net>
parents:
340
diff
changeset
|
109 |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
110 # Figure out if we're using the stable or unstable versions of a package. |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
111 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
112 function unstable() |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
113 { |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
114 [ ! -z "$(echo ,"$USE_UNSTABLE", | grep ,"$1",)" ] |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
115 } |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
116 |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
117 # Strip the version number off a tarball |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
118 |
301
309b574a5059
Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
119 function cleanup() |
309b574a5059
Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
120 { |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
121 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
122 [ $? -ne 0 ] && dienow |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
123 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
124 for i in "$@" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
125 do |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
126 unstable "$i" && i=alt-"$PACKAGE" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
127 rm -rf "$i" || dienow |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
128 done |
301
309b574a5059
Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
129 } |
309b574a5059
Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
Rob Landley <rob@landley.net>
parents:
290
diff
changeset
|
130 |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
131 # Give filename.tar.ext minus the version number. |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
132 |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
133 function noversion() |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
134 { |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
135 echo "$1" | sed -e 's/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\6/' |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
136 } |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
137 |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
138 # Give package name, minus file's version number and archive extension. |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
139 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
140 function basename() |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
141 { |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
142 noversion $1 | sed 's/\.tar\..z2*$//' |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
143 } |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
144 |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
145 # output the sha1sum of a file |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
146 function sha1file() |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
147 { |
237
735ee8a5ca35
Fix the path to calculate the tarball sha1sum, use the sha1file function more
Rob Landley <rob@landley.net>
parents:
236
diff
changeset
|
148 sha1sum "$@" | awk '{print $1}' |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
149 } |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
150 |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
151 # Extract tarball named in $1 and apply all relevant patches into |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
152 # "$BUILD/sources/$1". Record sha1sum of tarball and patch files in |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
153 # sha1-for-source.txt. Re-extract if tarball or patches change. |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
154 |
220
8d2d0feff1ef
The "caller" built-in isn't available in bash 2.x.
Rob Landley <rob@landley.net>
parents:
214
diff
changeset
|
155 function extract() |
8d2d0feff1ef
The "caller" built-in isn't available in bash 2.x.
Rob Landley <rob@landley.net>
parents:
214
diff
changeset
|
156 { |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
157 SRCTREE="${BUILD}/sources" |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
158 BASENAME="$(basename "$1")" |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
159 SHA1FILE="$(echo "${SRCTREE}/${BASENAME}/sha1-for-source.txt")" |
237
735ee8a5ca35
Fix the path to calculate the tarball sha1sum, use the sha1file function more
Rob Landley <rob@landley.net>
parents:
236
diff
changeset
|
160 SHA1TAR="$(sha1file "${SRCDIR}/$1")" |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
161 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
162 # Sanity check: don't ever "rm -rf /". Just don't. |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
163 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
164 if [ -z "$BASENAME" ] || [ -z "$SRCTREE" ] |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
165 then |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
166 dienow |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
167 fi |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
168 |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
169 # If it's already extracted and up to date (including patches), do nothing. |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
170 SHALIST=$(cat "$SHA1FILE" 2> /dev/null) |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
171 if [ ! -z "$SHALIST" ] |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
172 then |
237
735ee8a5ca35
Fix the path to calculate the tarball sha1sum, use the sha1file function more
Rob Landley <rob@landley.net>
parents:
236
diff
changeset
|
173 for i in "$SHA1TAR" $(sha1file "${SOURCES}/patches/$BASENAME"* 2>/dev/null) |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
174 do |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
175 # Is this sha1 in the file? |
248
f32b23bbf83a
Properly detect a short sha1list during tarball extraction (I.E. notice if
Rob Landley <rob@landley.net>
parents:
246
diff
changeset
|
176 if [ -z "$(echo "$SHALIST" | sed -n "s/$i/$i/p" )" ] |
f32b23bbf83a
Properly detect a short sha1list during tarball extraction (I.E. notice if
Rob Landley <rob@landley.net>
parents:
246
diff
changeset
|
177 then |
f32b23bbf83a
Properly detect a short sha1list during tarball extraction (I.E. notice if
Rob Landley <rob@landley.net>
parents:
246
diff
changeset
|
178 SHALIST=missing |
f32b23bbf83a
Properly detect a short sha1list during tarball extraction (I.E. notice if
Rob Landley <rob@landley.net>
parents:
246
diff
changeset
|
179 break |
f32b23bbf83a
Properly detect a short sha1list during tarball extraction (I.E. notice if
Rob Landley <rob@landley.net>
parents:
246
diff
changeset
|
180 fi |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
181 # Remove it |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
182 SHALIST="$(echo "$SHALIST" | sed "s/$i//" )" |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
183 done |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
184 # If we matched all the sha1sums, nothing more to do. |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
185 [ -z "$SHALIST" ] && return 0 |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
186 fi |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
187 |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
188 echo -n "Extracting '${BASENAME}'" |
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
189 # Delete the old tree (if any). Create new empty working directories. |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
190 rm -rf "${BUILD}/temp" "${SRCTREE}/${BASENAME}" 2>/dev/null |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
191 mkdir -p "${BUILD}"/{temp,sources} || dienow |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
192 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
193 # Is it a bzip2 or gzip tarball? |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
194 DECOMPRESS="" |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
195 [ "$1" != "${1/%\.tar\.bz2/}" ] && DECOMPRESS="j" |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
196 [ "$1" != "${1/%\.tar\.gz/}" ] && DECOMPRESS="z" |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
197 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
198 cd "${WORK}" && |
252
aa03feec947a
Minor tweaks: one error check was missed, use hard links instead of
Rob Landley <rob@landley.net>
parents:
248
diff
changeset
|
199 { tar -xv${DECOMPRESS} -f "${SRCDIR}/$1" -C "${BUILD}/temp" || dienow |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
200 } | dotprogress |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
201 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
202 mv "${BUILD}/temp/"* "${SRCTREE}/${BASENAME}" && |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
203 rmdir "${BUILD}/temp" && |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
204 echo "$SHA1TAR" > "$SHA1FILE" |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
205 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
206 [ $? -ne 0 ] && dienow |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
207 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
208 # Apply any patches to this package |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
209 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
210 ls "${SOURCES}/patches/$BASENAME"* 2> /dev/null | sort | while read i |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
211 do |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
212 if [ -f "$i" ] |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
213 then |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
214 echo "Applying $i" |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
215 (cd "${SRCTREE}/${BASENAME}" && patch -p1 -i "$i") || dienow |
237
735ee8a5ca35
Fix the path to calculate the tarball sha1sum, use the sha1file function more
Rob Landley <rob@landley.net>
parents:
236
diff
changeset
|
216 sha1file "$i" >> "$SHA1FILE" |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
217 fi |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
218 done |
220
8d2d0feff1ef
The "caller" built-in isn't available in bash 2.x.
Rob Landley <rob@landley.net>
parents:
214
diff
changeset
|
219 } |
8d2d0feff1ef
The "caller" built-in isn't available in bash 2.x.
Rob Landley <rob@landley.net>
parents:
214
diff
changeset
|
220 |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
221 function try_checksum() |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
222 { |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
223 SUM="$(sha1file "$SRCDIR/$FILENAME" 2>/dev/null)" |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
224 if [ x"$SUM" == x"$SHA1" ] || [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ] |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
225 then |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
226 touch "$SRCDIR/$FILENAME" |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
227 if [ -z "$SHA1" ] |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
228 then |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
229 echo "No SHA1 for $FILENAME ($SUM)" |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
230 else |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
231 echo "Confirmed $FILENAME" |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
232 fi |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
233 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
234 [ -z "$EXTRACT_ALL" ] && return 0 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
235 extract "$FILENAME" |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
236 return $? |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
237 fi |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
238 |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
239 return 1 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
240 } |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
241 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
242 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
243 function try_download() |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
244 { |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
245 # Return success if we have a valid copy of the file |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
246 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
247 try_checksum && return 0 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
248 |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
249 # If there's a corrupted file, delete it. In theory it would be nice |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
250 # to resume downloads, but wget creates "*.1" files instead. |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
251 |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
252 rm "$SRCDIR/$FILENAME" 2> /dev/null |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
253 |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
254 # If we have another source, try to download file. |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
255 |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
256 if [ -n "$1" ] |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
257 then |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
258 wget -t 2 -T 20 -O "$SRCDIR/$FILENAME" "$1" || return 2 |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
259 fi |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
260 |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
261 try_checksum |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
262 } |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
263 |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
264 # Confirm a file matches sha1sum, else try to download it from mirror list. |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
265 |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
266 function download() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
267 { |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
268 FILENAME=`echo "$URL" | sed 's .*/ '` |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
269 ALTFILENAME=alt-"$(noversion "$FILENAME" -0)" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
270 |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
271 # Is there an unstable version to download, and is it selected? |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
272 if [ ! -z "$UNSTABLE" ] && unstable "$(basename "$FILENAME")" |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
273 then |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
274 # Keep old version around, if present. |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
275 touch -c "$SRCDIR/$FILENAME" 2>/dev/null |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
276 |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
277 # Download new one as alt-packagename.tar.ext |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
278 FILENAME="$ALTFILENAME" SHA1= try_download "$UNSTABLE" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
279 return $? |
398
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
280 fi |
a7daae215647
Implement unstable package download logic, with examples. (Try "USE_UNSTABLE=uClibc,linux ./download.sh" for example.)
Rob Landley <rob@landley.net>
parents:
396
diff
changeset
|
281 |
396 | 282 # If environment variable specifies a preferred mirror, try that first. |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
283 |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
284 [ -z "$PREFERRED_MIRROR" ] || try_download "$PREFERRED_MIRROR/$FILENAME" |
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
285 |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
286 # Try standard locations |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
287 |
340
595332f94fea
Add timeout to wget, and add another mirror (impactlinux.com) so there's a
Rob Landley <rob@landley.net>
parents:
329
diff
changeset
|
288 for i in "$URL" http://impactlinux.com/firmware/mirror/"$FILENAME" \ |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
289 http://landley.net/code/firmware/mirror/"$FILENAME" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
290 do |
362
06f29c81ac8e
Teach download to fetch from $PREFERRED_MIRROR first, if set.
Rob Landley <rob@landley.net>
parents:
357
diff
changeset
|
291 try_download "$i" && return 0 |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
292 done |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
293 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
294 # Return failure. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
295 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
296 echo "Could not download $FILENAME" |
81
6dd38c925bc4
Upgrade some packages, and other cleanups.
Rob Landley <rob@landley.net>
parents:
62
diff
changeset
|
297 echo -en "\e[0m" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
298 return 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
299 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
300 |
41 | 301 # Clean obsolete files out of the source directory |
302 | |
303 START_TIME=`date +%s` | |
304 | |
305 function cleanup_oldfiles() | |
306 { | |
307 for i in "${SRCDIR}"/* | |
308 do | |
309 if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ] | |
310 then | |
311 echo Removing old file "$i" | |
312 rm -rf "$i" | |
313 fi | |
314 done | |
315 } | |
316 | |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
317 function actually_dienow() |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
318 { |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
319 echo -e "\e[31mExiting due to errors\e[0m" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
320 exit 1 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
321 } |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
322 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
323 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
324 trap actually_dienow SIGUSR1 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
325 TOPSHELL=$$ |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
326 |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
327 function dienow() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
328 { |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
329 kill -USR1 $TOPSHELL |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
330 exit 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
331 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
332 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
333 function dotprogress() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
334 { |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
335 x=0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
336 while read i |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
337 do |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
338 x=$[$x + 1] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
339 if [[ "$x" -eq 25 ]] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
340 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
341 x=0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
342 echo -n . |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
343 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
344 done |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
345 echo |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
346 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
347 |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
348 # Extract package $1, use out-of-tree build directory $2 (or $1 if no $2) |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
349 # Use symlink directory $3 (or $1 if no $3) |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
350 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
351 function setupfor() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
352 { |
357
5c61d556fe0c
Make forkbomb.sh --fork work with RECORD_COMMANDS.
Rob Landley <rob@landley.net>
parents:
352
diff
changeset
|
353 export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.setupfor" |
352
1782b77fae15
Add command logging. Set RECORD_COMMANDS=1 to log every command line run
Rob Landley <rob@landley.net>
parents:
351
diff
changeset
|
354 |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
355 # Figure out whether we're using an unstable package. |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
356 |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
357 PACKAGE="$1" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
358 unstable "$PACKAGE" && PACKAGE=alt-"$PACKAGE" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
359 |
236
9c48cf5b65f6
Teach extract to check patch files for changes, not just tarballs.
Rob Landley <rob@landley.net>
parents:
222
diff
changeset
|
360 # Make sure the source is already extracted and up-to-date. |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
361 cd "${SRCDIR}" && |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
362 extract "${PACKAGE}-"*.tar* || exit 1 |
41 | 363 |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
364 # Set CURSRC |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
365 CURSRC="$PACKAGE" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
366 if [ ! -z "$3" ] |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
367 then |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
368 CURSRC="$3" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
369 unstable "$CURSRC" && CURSRC=alt-"$CURSRC" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
370 fi |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
371 export CURSRC="${WORK}/${CURSRC}" |
41 | 372 |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
373 # Announce package, with easy-to-grep-for "===" marker. |
41 | 374 |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
375 echo "=== Building $PACKAGE ($ARCH_NAME)" |
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
376 echo "Snapshot '$PACKAGE'..." |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
301
diff
changeset
|
377 cd "${WORK}" || dienow |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
301
diff
changeset
|
378 if [ $# -lt 3 ] |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
301
diff
changeset
|
379 then |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
301
diff
changeset
|
380 rm -rf "${CURSRC}" || dienow |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
301
diff
changeset
|
381 fi |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
382 mkdir -p "${CURSRC}" && |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
383 cp -lfR "${SRCTREE}/$PACKAGE/"* "${CURSRC}" |
222
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
384 |
8b0d2080707c
Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents:
220
diff
changeset
|
385 [ $? -ne 0 ] && dienow |
41 | 386 |
387 # Do we have a separate working directory? | |
388 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
389 if [ -z "$2" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
390 then |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
391 cd "$PACKAGE"* || dienow |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
392 else |
399
4e11cfb255e2
Break config out from include.sh, so environment variables users can edit to affect the build are collected together in one place with nothing else in it.
Rob Landley <rob@landley.net>
parents:
398
diff
changeset
|
393 mkdir -p "$2" && cd "$2" || dienow |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
394 fi |
357
5c61d556fe0c
Make forkbomb.sh --fork work with RECORD_COMMANDS.
Rob Landley <rob@landley.net>
parents:
352
diff
changeset
|
395 export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.$1" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
396 } |