comparison build.sh @ 781:d8c780ed3686

Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
author Rob Landley <rob@landley.net>
date Sat, 04 Jul 2009 20:31:32 -0500
parents 759adf5a0fe9
children 037488e9889d
comparison
equal deleted inserted replaced
780:7f0e808e3be0 781:d8c780ed3686
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # If run with no arguments, list architectures. 3 # If run with no arguments, list architectures.
4 4
5 if [ $# -eq 0 ] 5 if [ $# -ne 1 ]
6 then 6 then
7 echo "Usage: $0 ARCH [ARCH...]" 7 echo "Usage: $0 ARCH"
8 . sources/include.sh 8 . sources/include.sh
9 read_arch_dir 9 read_arch_dir
10 10
11 exit 1 11 exit 1
12 fi 12 fi
18 # host-tools populates one directory with every command the build needs, 18 # host-tools populates one directory with every command the build needs,
19 # so we can ditch the old $PATH afterwards. 19 # so we can ditch the old $PATH afterwards.
20 20
21 time ./host-tools.sh || exit 1 21 time ./host-tools.sh || exit 1
22 22
23 # Run the steps in order for each architecture listed on the command line 23 echo "=== Building ARCH $1"
24 for i in "$@"
25 do
26 echo "=== Building ARCH $i"
27 24
28 if [ -f "build/cross-compiler-$i.tar.bz2" ] 25 # Do we need to build the cross compiler?
29 then
30 echo "=== Skipping cross-compiler-$i (already there)"
31 else
32 rm -rf "build/root-filesystem-$i.tar.bz2"
33 time ./cross-compiler.sh $i || exit 1
34 fi
35 echo "=== native ($i)"
36 if [ -f "build/root-filesystem-$i.tar.bz2" ]
37 then
38 echo "=== Skipping root-filesystem-$i (already there)"
39 else
40 rm -rf "build/system-image-$i.tar.bz2"
41 time ./root-filesystem.sh $i || exit 1
42 fi
43 26
44 if [ -f "build/system-image-$i.tar.bz2" ] 27 if [ -f "build/cross-compiler-$1.tar.bz2" ]
45 then 28 then
46 echo "=== Skipping system-image-$i (already there)" 29 echo "=== Skipping cross-compiler-$1 (already there)"
47 else 30 else
48 time ./system-image.sh $i || exit 1 31 # If we need to build cross compiler, assume root filesystem is stale.
49 fi 32
50 done 33 rm -rf "build/root-filesystem-$1.tar.bz2"
34 time ./cross-compiler.sh $1 || exit 1
35 fi
36
37 # Do we need to build the root filesystem?
38
39 if [ -f "build/root-filesystem-$1.tar.bz2" ]
40 then
41 echo "=== Skipping root-filesystem-$1 (already there)"
42 else
43 # If we need to build root filesystem, assume system image is stale.
44
45 rm -rf "build/system-image-$1.tar.bz2"
46 time ./root-filesystem.sh $1 || exit 1
47 fi
48
49 if [ -f "build/system-image-$1.tar.bz2" ]
50 then
51 echo "=== Skipping system-image-$1 (already there)"
52 else
53 time ./system-image.sh $1 || exit 1
54 fi