comparison root-filesystem.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 f2b4d7297c9d
children fc134a13357e
comparison
equal deleted inserted replaced
940:ae8c6e0831ee 941:7dd3fb4dd333
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Build a root filesystem for a given target. 3 # Build a root filesystem for a given target.
4 4
5 # Get lots of predefined environment variables and shell functions.
6
7 source sources/include.sh || exit 1 5 source sources/include.sh || exit 1
8
9 # Parse the sources/targets/$1 directory
10
11 read_arch_dir "$1" 6 read_arch_dir "$1"
12
13 # If this target has a base architecture that's already been built, use that.
14
15 check_for_base_arch || exit 0 7 check_for_base_arch || exit 0
8 check_prerequisite "${ARCH}-cc"
9 check_prerequisite "${FROM_ARCH}-cc"
16 10
17 # Announce start of stage. 11 # Announce start of stage.
18 12
19 echo "=== Building $STAGE_NAME" 13 echo "=== Building $STAGE_NAME"
20
21 # Die if our prerequisite isn't there.
22
23 for i in "$ARCH" "$FROM_ARCH"
24 do
25 if [ -z "$(which "${i}-cc")" ]
26 then
27 [ -z "$FAIL_QUIET" ] && echo No "${i}-cc" in '$PATH'. >&2
28 exit 1
29 fi
30 done
31 14
32 # Determine which directory layout we're using 15 # Determine which directory layout we're using
33 16
34 if [ -z "$ROOT_NODIRS" ] 17 if [ -z "$ROOT_NODIRS" ]
35 then 18 then
55 then 38 then
56 # If we're not installing a compiler, delete the headers, static libs, 39 # If we're not installing a compiler, delete the headers, static libs,
57 # and example source code. 40 # and example source code.
58 41
59 rm -rf "$ROOT_TOPDIR"/include && 42 rm -rf "$ROOT_TOPDIR"/include &&
60 rm -rf "$ROOT_TOPDIR"/lib/*.a && 43 rm -rf "$ROOT_TOPDIR"/lib/*.[ao] &&
61 rm -rf "$ROOT_TOPDIR/src" || dienow 44 rm -rf "$ROOT_TOPDIR/src" || dienow
62 45
63 elif [ "$NATIVE_TOOLCHAIN" == "headers" ] 46 elif [ "$NATIVE_TOOLCHAIN" == "headers" ]
64 then 47 then
65 48