Mercurial > hg > aboriginal
annotate include.sh @ 156:ad6b2ba3ea2d
Added tag 0.2.1 for changeset ce1ca3d0f95b
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 09 Apr 2007 12:10:09 -0400 |
parents | ce1ca3d0f95b |
children | 729dd17a7b74 |
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 |
138
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
3 temp=`ls -l /bin/sh | sed 's/.*-> //'` |
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
4 if [ "$temp" == "dash" ] |
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
5 then |
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
6 echo "Error: your /bin/sh points to dash." |
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
7 exit 1 |
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
8 fi |
7dffe9648a56
Installing bash but not using it. Yeah, there's a political agenda at work
Rob Landley <rob@landley.net>
parents:
125
diff
changeset
|
9 |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 function download() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 { |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 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
|
13 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
|
14 |
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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 # 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
|
22 |
101
9b7fcdfbe11c
Add a third mirror, with older versions.
Rob Landley <rob@landley.net>
parents:
98
diff
changeset
|
23 for i in "$URL" http://www.landley.net/code/firmware/mirror/"$FILENAME" \ |
9b7fcdfbe11c
Add a third mirror, with older versions.
Rob Landley <rob@landley.net>
parents:
98
diff
changeset
|
24 http://engineering.timesys.com/~landley/mirror/"$FILENAME" "" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 do |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 # 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
|
27 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 # 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
|
29 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 SUM=`cat "$SRCDIR/$FILENAME" | sha1sum | awk '{print $1}'` |
41 | 31 if [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ] |
32 then | |
33 touch "$SRCDIR/$FILENAME" | |
34 echo "No SHA1 for $FILENAME" | |
35 return 0 | |
36 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
|
37 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 touch "$SRCDIR/$FILENAME" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 echo "Confirmed $FILENAME" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 return 0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 # 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
|
44 # 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
|
45 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 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
|
47 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 # 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
|
49 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 if [ -n "$i" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 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
|
53 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 done |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 # Return failure. |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 echo "Could not download $FILENAME" |
81
6dd38c925bc4
Upgrade some packages, and other cleanups.
Rob Landley <rob@landley.net>
parents:
62
diff
changeset
|
59 echo -en "\e[0m" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
60 return 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
61 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
62 |
41 | 63 # Clean obsolete files out of the source directory |
64 | |
65 START_TIME=`date +%s` | |
66 | |
67 function cleanup_oldfiles() | |
68 { | |
69 for i in "${SRCDIR}"/* | |
70 do | |
71 if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ] | |
72 then | |
73 echo Removing old file "$i" | |
74 rm -rf "$i" | |
75 fi | |
76 done | |
77 } | |
78 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
79 function dienow() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
80 { |
47
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
81 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
|
82 exit 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
83 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
84 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
85 function dotprogress() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
86 { |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
87 x=0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
88 while read i |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
89 do |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
90 x=$[$x + 1] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
91 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
|
92 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 x=0 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
94 echo -n . |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
95 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
96 done |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
97 echo |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
98 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
100 # 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
|
101 # 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
|
102 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
103 function setupfor() |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
104 { |
41 | 105 # Is it a bzip2 or gzip tarball? |
106 | |
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
|
107 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
|
108 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
|
109 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
110 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
|
111 DECOMPRESS="j" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
112 else |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
113 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
|
114 DECOMPRESS="z" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
115 fi |
41 | 116 |
117 # Announce package, with easy-to-grep-for "===" marker. Extract it. | |
118 | |
125
2dd9f480ff4e
Set PATH for run-mini-native.sh and add more obvious arch display info when
Rob Landley <rob@landley.net>
parents:
124
diff
changeset
|
119 echo "=== Building $1 ($ARCH_NAME)" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
120 echo -n "Extracting" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
121 cd "${WORK}" && |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
122 { 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
|
123 } | dotprogress |
41 | 124 |
125 # Do we have a separate working directory? | |
126 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
127 if [ -z "$2" ] |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
128 then |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
129 cd "$1"* || dienow |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
130 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
|
131 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
|
132 cd "$2" || dienow |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
133 fi |
41 | 134 |
135 # Set CURSRC | |
136 | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
137 export CURSRC="$1" |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
138 [ ! -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
|
139 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
|
140 [ ! -d "${CURSRC}" ] && dienow |
41 | 141 |
142 # Apply any patches to this package | |
143 | |
144 for i in "${SOURCES}/patches/$1"* | |
145 do | |
146 if [ -f "$i" ] | |
147 then | |
148 (cd "${CURSRC}" && patch -p1 -i "$i") || dienow | |
149 fi | |
150 done | |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
151 } |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
152 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
153 # Setup |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
154 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
155 umask 022 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
156 unset CFLAGS CXXFLAGS |
124
d5e9d5cf0172
According to http://hostingfu.com/article/compiling-with-gcc-on-low-memory-vps
Rob Landley <rob@landley.net>
parents:
120
diff
changeset
|
157 export CFLAGS="--param ggc-min-expand=0 --param ggc-min-heapsize=8192" |
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 # Find/create directories |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
160 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
161 TOP=`pwd` |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
162 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
|
163 export SRCDIR="${SOURCES}/packages" |
98
b6b4386a6c83
Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
164 export FROMSRC=../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
|
165 export LINKDIR="${SOURCES}/build-links" |
41 | 166 export BUILD="${TOP}/build" |
98
b6b4386a6c83
Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
167 export HOSTTOOLS="${BUILD}/host" |
b6b4386a6c83
Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
168 export WORK="${BUILD}/host-temp" |
b6b4386a6c83
Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
169 export PATH="${HOSTTOOLS}:$PATH" |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
170 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
|
171 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
172 # 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
|
173 set +h |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
174 |
47
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
175 # 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
|
176 |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
177 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
|
178 then |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
179 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
|
180 shift |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
181 fi |
edaa86240321
Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
182 |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
183 # 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
|
184 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
185 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
|
186 then |
125
2dd9f480ff4e
Set PATH for run-mini-native.sh and add more obvious arch display info when
Rob Landley <rob@landley.net>
parents:
124
diff
changeset
|
187 ARCH_NAME="$1" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
188 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
|
189 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
|
190 then |
35
25bfa6ac9f84
Make the "supported architecutes" list have sane line breaks.
Rob Landley <rob@landley.net>
parents:
34
diff
changeset
|
191 echo "Supported architectures: " |
25bfa6ac9f84
Make the "supported architecutes" list have sane line breaks.
Rob Landley <rob@landley.net>
parents:
34
diff
changeset
|
192 (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
|
193 exit 1 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
194 fi |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
195 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
196 # 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
|
197 |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
198 export WORK="${BUILD}/temp-$ARCH" |
107
72f414b2939d
Have to make the include directory before we can put config files in it.
Rob Landley <rob@landley.net>
parents:
101
diff
changeset
|
199 rm -rf "${WORK}" |
72f414b2939d
Have to make the include directory before we can put config files in it.
Rob Landley <rob@landley.net>
parents:
101
diff
changeset
|
200 mkdir -p "${WORK}" |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
201 # 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
|
202 # 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
|
203 # 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
|
204 # 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
|
205 # wrong libc.) |
92
f46f4cda9d81
Apparently binutils/gcc got fixed sometime since the 3.1 days...
Rob Landley <rob@landley.net>
parents:
81
diff
changeset
|
206 export CROSS_HOST=`uname -m`-walrus-linux |
120
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
115
diff
changeset
|
207 [ -z "$CROSS_TARGET" ] && CROSS_TARGET=${ARCH}-unknown-linux |
c91ceb05bc1c
Make host-tools not rebuild stuff that's already there, fix yet more corner
Rob Landley <rob@landley.net>
parents:
115
diff
changeset
|
208 export CROSS_TARGET |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
209 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
210 # 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
|
211 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
212 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
|
213 |
62
4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents:
60
diff
changeset
|
214 # 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
|
215 |
41 | 216 export CROSS="${BUILD}/cross-compiler-$ARCH" |
217 export NATIVE="${BUILD}/mini-native-$ARCH" | |
145
b174c242934b
Remove redundant $PATH element pointed out by George Boudreau.
Rob Landley <rob@landley.net>
parents:
138
diff
changeset
|
218 export PATH="${CROSS}/bin:$PATH" |
108
b66d638a3844
Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents:
107
diff
changeset
|
219 export IMAGE="${BUILD}/image-${ARCH}.ext2" |
155
ce1ca3d0f95b
Put zImage-$ARCH in build directory, not mini-native-$ARCH, and eliminate
Rob Landley <rob@landley.net>
parents:
145
diff
changeset
|
220 |
ce1ca3d0f95b
Put zImage-$ARCH in build directory, not mini-native-$ARCH, and eliminate
Rob Landley <rob@landley.net>
parents:
145
diff
changeset
|
221 |
ce1ca3d0f95b
Put zImage-$ARCH in build directory, not mini-native-$ARCH, and eliminate
Rob Landley <rob@landley.net>
parents:
145
diff
changeset
|
222 emulator_command image-$ARCH.ext2 zImage-$ARCH \ |
ce1ca3d0f95b
Put zImage-$ARCH in build directory, not mini-native-$ARCH, and eliminate
Rob Landley <rob@landley.net>
parents:
145
diff
changeset
|
223 "rw init=/tools/bin/sh panic=1 PATH=/tools/bin" > "$BUILD/run-$ARCH.sh" && |
ce1ca3d0f95b
Put zImage-$ARCH in build directory, not mini-native-$ARCH, and eliminate
Rob Landley <rob@landley.net>
parents:
145
diff
changeset
|
224 chmod +x "$BUILD/run-$ARCH.sh" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
225 fi |
98
b6b4386a6c83
Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents:
96
diff
changeset
|
226 mkdir -p "${WORK}" |
34
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
227 |
ad1cfcb043c7
Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
228 [ -z "$CLEANUP" ] && CLEANUP="rm -rf" |
110
62f6268ff61b
Build uClibc's readelf and ldd by hand to work around inadequate cross-compile
Rob Landley <rob@landley.net>
parents:
108
diff
changeset
|
229 [ -z "$CC" ] && CC=gcc |