Mercurial > hg > control-images
annotate common/bootstrap/build-one-package.sh @ 17:a90ac7ed5d64
Add X of Y progress indicator.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 30 Oct 2011 22:27:54 -0500 |
parents | bcd2e358d57f |
children | a051c841d782 |
rev | line source |
---|---|
0
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/ash |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Yes, ash. Because neither bash 2 nor hush support -o pipefail |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 set -o pipefail |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 source /mnt/functions.sh || exit 1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 # build $1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 |
17 | 11 set_titlebar "$1$X_OF_Y" |
0
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 # Three types of /mnt/build scripts: |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 # |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 # $1.nosrc - no source code in /mnt/build, perform no setup/cleanup. |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 # $1.sh - source is symlink tree to "/mnt/build/$1". This is faster and uses |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 # less disk space but confuses some packages. |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 # $1.nolink - source is conventional copy of /mnt/build/$1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 if [ ! -e "/mnt/build/$1.nosrc" ] |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 then |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 [ -e "/mnt/build/$1.nolink" ] && LINKTYPE=dp || LINKTYPE=s |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 # Snapshot source from /mnt/build/$1 to /home/$1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 cd /home && |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 rm -rf "/home/$1" && |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 cp -${LINKTYPE}fR "/mnt/packages/$1" "$1" && |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 cd "$1" || exit 1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 # Lobotomize config.guess so it won't complain about unknown target types. |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 # 99% of packages do not care, but autoconf throws a temper tantrum if |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 # the version of autoconf that created this back when the package shipped |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 # didn't know what a microblaze or hexagon was. Repeat after me: |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 # "Autoconf is useless" |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 for guess in $(find . -name config.guess) |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 do |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 rm "$guess" && |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 echo -e "#!/bin/sh\ngcc -dumpmachine" > "$guess" || exit 1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 done |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 EXT=sh |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 else |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 EXT=nosrc |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 fi |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
47 # Call package build script |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 mkdir -p /home/log |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 time "/mnt/build/$1".* 2>&1 | tee "/home/log/$1.log" |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 if [ $? -ne 0 ] |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 then |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 echo "$1" died >&2 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 exit 1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 fi |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 # Delete copy of source if build succeeded |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
59 if [ ! -z "$LINKTYPE" ] |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
60 then |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
61 cd /home && |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
62 rm -rf "$1" && |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
63 sync || exit 1 |
bcd2e358d57f
Start by copying the existing control image building infrastructure from Aboriginal Linux, and shuffling the layout around a bit.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
64 fi |