comparison build.sh @ 941:7dd3fb4dd333

Minor cleanups and comments, introduce check_prerequisite function.
author Rob Landley <rob@landley.net>
date Tue, 22 Dec 2009 11:51:52 -0600
parents a541c5a96ff3
children fc134a13357e
comparison
equal deleted inserted replaced
940:ae8c6e0831ee 941:7dd3fb4dd333
2 2
3 # Run all the steps needed to build a system image from scratch. 3 # Run all the steps needed to build a system image from scratch.
4 4
5 # If run with no arguments, list architectures. 5 # If run with no arguments, list architectures.
6 6
7 ARCH="$1"
8
9 if [ $# -ne 1 ] 7 if [ $# -ne 1 ]
10 then 8 then
11 echo "Usage: $0 ARCH" 9 echo "Usage: $0 ARCH"
12 . sources/include.sh 10 . sources/include.sh
13 read_arch_dir 11 read_arch_dir
14
15 exit 1
16 fi 12 fi
13 ARCH="$1"
17 14
18 # Download source code and build host tools. 15 # Download source code and build host tools.
19 16
20 ./download.sh || exit 1 17 time ./download.sh || exit 1
21 18
22 # host-tools populates one directory with every command the build needs, 19 # host-tools populates one directory with every command the build needs,
23 # so we can ditch the old $PATH afterwards. 20 # so we can ditch the old $PATH afterwards.
24 21
25 time ./host-tools.sh || exit 1 22 time ./host-tools.sh || exit 1
23
24 # A function to skip stages that have already been done (because the
25 # tarball they create is already there).
26 26
27 not_already() 27 not_already()
28 { 28 {
29 if [ -f "build/$1-$ARCH.tar.bz2" ] 29 if [ -f "build/$1-$ARCH.tar.bz2" ]
30 then 30 then
33 fi 33 fi
34 34
35 return 0 35 return 0
36 } 36 }
37 37
38 echo "=== Building ARCH $1" 38 # Do we need to build the simple cross compiler?
39 39
40 # Do we need to build the cross compiler? 40 # This version has no thread support, no libgcc_s.so, doesn't include
41 41 # uClibc++, and is dynamically linked against the host's shared libraries.
42 # This version is --disable shared, doesn't include uClibc++, and is
43 # dynamically linked against the host's shared libraries.
44 42
45 if not_already cross-compiler 43 if not_already cross-compiler
46 then 44 then
47 # If we need to build cross compiler, assume root filesystem is stale. 45 # If we need to build cross compiler, assume root filesystem is stale.
48 46