Mercurial > hg > aboriginal
annotate include.sh @ 74:752ca43084d7
Added tag 0.0.1 for changeset 8b75dee28f40
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 29 Dec 2006 20:00:27 -0500 |
parents | 4125b672b00c |
children | 6dd38c925bc4 |
rev | line source |
---|---|
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/sh |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 function download() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 { |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 FILENAME=`echo "$URL" | sed 's .*/ '` |
52
6d6551a37687
Add make to mini-native (required one more option switched on in uClibc), add
Rob Landley <rob@landley.net>
parents:
47
diff
changeset
|
6 BASENAME=`echo "$FILENAME" | sed -r -e 's/-*([0-9\.]|-rc|[0-9][a-zA-Z])*(\.tar\..z2*)$/\2/'` |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 |
36
2f1a6a4645ed
Why didn't "hg mv build.sh cross-compiler.sh" figure out what build.sh had
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
8 if [ ! -z "$LINKDIR" ] |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 then |
36
2f1a6a4645ed
Why didn't "hg mv build.sh cross-compiler.sh" figure out what build.sh had
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
10 rm -f "$LINKDIR/$BASENAME" 2> /dev/null |
2f1a6a4645ed
Why didn't "hg mv build.sh cross-compiler.sh" figure out what build.sh had
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
11 ln -s "$FROMSRC/$FILENAME" "$LINKDIR/$BASENAME" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 # The extra "" is so we test the sha1sum after the last download. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 for i in "$URL" http://www.landley.net/code/firmware/mirror/"$FILENAME" "" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 do |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 # Return success if we have a valid copy of the file |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 # Test first (so we don't re-download a file we've already got). |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 SUM=`cat "$SRCDIR/$FILENAME" | sha1sum | awk '{print $1}'` |
41 | 23 if [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ] |
24 then | |
25 touch "$SRCDIR/$FILENAME" | |
26 echo "No SHA1 for $FILENAME" | |
27 return 0 | |
28 elif [ x"$SUM" == x"$SHA1" ] | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 touch "$SRCDIR/$FILENAME" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 echo "Confirmed $FILENAME" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 return 0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 # If there's a corrupted file, delete it. In theory it would be nice |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 # to resume downloads, but wget creates "*.1" files instead. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 rm "$SRCDIR/$FILENAME" 2> /dev/null |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 # If we have another source, try to download file. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 if [ -n "$i" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 wget -P "$SRCDIR" "$i" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 done |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
47 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 # Return failure. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 echo "Could not download $FILENAME" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 return 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 |
41 | 54 # Clean obsolete files out of the source directory |
55 | |
56 START_TIME=`date +%s` | |
57 | |
58 function cleanup_oldfiles() | |
59 { | |
60 for i in "${SRCDIR}"/* | |
61 do | |
62 if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ] | |
63 then | |
64 echo Removing old file "$i" | |
65 rm -rf "$i" | |
66 fi | |
67 done | |
68 } | |
69 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
70 function dienow() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
71 { |
47
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
72 echo -e "\e[31mExiting due to errors\e[0m" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
73 exit 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
74 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
75 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
76 function dotprogress() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
77 { |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
78 x=0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
79 while read i |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
80 do |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
81 x=$[$x + 1] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
82 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
|
83 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
84 x=0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
85 echo -n . |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
86 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
87 done |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
88 echo |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
89 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
90 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
91 # Extract package $1, use work directory $2 (or $1 if no $2), use source |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
92 # directory $3 (or $1 if no $3) |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
94 function setupfor() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
95 { |
41 | 96 # Is it a bzip2 or gzip tarball? |
97 | |
36
2f1a6a4645ed
Why didn't "hg mv build.sh cross-compiler.sh" figure out what build.sh had
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
98 FILE="${LINKDIR}/$1" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 if [ -f "${FILE}".tar.bz2 ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
100 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 FILE="${FILE}".tar.bz2 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
102 DECOMPRESS="j" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
103 else |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
104 FILE="${FILE}".tar.gz |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
105 DECOMPRESS="z" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
106 fi |
41 | 107 |
108 # Announce package, with easy-to-grep-for "===" marker. Extract it. | |
109 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
110 echo "=== Building $1" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
111 echo -n "Extracting" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 cd "${WORK}" && |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
113 { tar xv${DECOMPRESS}f "$FILE" || dienow |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
114 } | dotprogress |
41 | 115 |
116 # Do we have a separate working directory? | |
117 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
118 if [ -z "$2" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
119 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
120 cd "$1"* || dienow |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
121 else |
47
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
122 mkdir -p "$2" && |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
123 cd "$2" || dienow |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
124 fi |
41 | 125 |
126 # Set CURSRC | |
127 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
128 export CURSRC="$1" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
129 [ ! -z "$3" ] && CURSRC="$3" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
130 export CURSRC=`echo "${WORK}/${CURSRC}"*` |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
131 [ ! -d "${CURSRC}" ] && dienow |
41 | 132 |
133 # Apply any patches to this package | |
134 | |
135 for i in "${SOURCES}/patches/$1"* | |
136 do | |
137 if [ -f "$i" ] | |
138 then | |
139 (cd "${CURSRC}" && patch -p1 -i "$i") || dienow | |
140 fi | |
141 done | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
142 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
143 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
144 # Setup |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
145 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
146 umask 022 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
147 unset CFLAGS CXXFLAGS |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
148 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
149 # Find/create directories |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
150 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
151 TOP=`pwd` |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
152 export SOURCES="${TOP}/sources" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
153 export SRCDIR="${SOURCES}/packages" |
36
2f1a6a4645ed
Why didn't "hg mv build.sh cross-compiler.sh" figure out what build.sh had
Rob Landley <rob@landley.net>
parents:
35
diff
changeset
|
154 export LINKDIR="${SOURCES}/build-links" |
41 | 155 export BUILD="${TOP}/build" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
156 export FROMSRC=../packages |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
157 mkdir -p "${SRCDIR}" "${LINKDIR}" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
158 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
159 # For bash: check the $PATH for new executables added after startup. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
160 set +h |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
161 |
47
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
162 # Are we doing a short build? |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
163 |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
164 if [ "$1" == "--short" ] |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
165 then |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
166 export BUILD_SHORT=1 |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
167 shift |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
168 fi |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
169 |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
170 # Get target platform from first command line argument. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
171 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
172 if [ -z "$NO_ARCH" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
173 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
174 ARCH="$(echo "$1" | sed 's@.*/@@')" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
175 if [ ! -f "${TOP}/sources/configs/${ARCH}" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
176 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
177 echo "Usage: $0 ARCH" |
35
25bfa6ac9f84
Make the "supported architecutes" list have sane line breaks.
Rob Landley <rob@landley.net>
parents:
34
diff
changeset
|
178 echo "Supported architectures: " |
25bfa6ac9f84
Make the "supported architecutes" list have sane line breaks.
Rob Landley <rob@landley.net>
parents:
34
diff
changeset
|
179 (cd "${TOP}/sources/configs" && ls) |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
180 exit 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
181 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
182 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
183 # Which platform are we building for? |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
184 |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
185 export WORK="${BUILD}/temp-$ARCH" |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
186 mkdir -p "${WORK}" |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
187 # Say "unknown" in two different ways so it doesn't assume we're NOT |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
188 # cross compiling when the host and target are the same processor. (If host |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
189 # and target match, the binutils/gcc/make builds won't use the cross compiler |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
190 # during mini-native.sh, and the host compiler links binaries against the |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
191 # wrong libc.) |
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
192 export CROSS_HOST=`uname -m`-walrus-linux-gnu |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
193 export CROSS_TARGET=${ARCH}-unknown-linux-gnu |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
194 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
195 # Read the relevant config file. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
196 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
197 source "${TOP}/sources/configs/${ARCH}" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
198 |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
199 # Setup directories and add the cross compiler to the start of the path. |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
200 |
41 | 201 export CROSS="${BUILD}/cross-compiler-$ARCH" |
202 export NATIVE="${BUILD}/mini-native-$ARCH" | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
203 export PATH=${CROSS}/bin:"$PATH" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
204 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
205 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
206 [ -z "$CLEANUP" ] && CLEANUP="rm -rf" |