annotate include.sh @ 125:2dd9f480ff4e 0.2.0

Set PATH for run-mini-native.sh and add more obvious arch display info when building multiple architectures at once.
author Rob Landley <rob@landley.net>
date Tue, 06 Mar 2007 15:08:27 -0500
parents d5e9d5cf0172
children 7dffe9648a56
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
101
9b7fcdfbe11c Add a third mirror, with older versions.
Rob Landley <rob@landley.net>
parents: 98
diff changeset
16 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
17 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
18 do
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 # 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
20
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 # 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
22
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 SUM=`cat "$SRCDIR/$FILENAME" | sha1sum | awk '{print $1}'`
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
24 if [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ]
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
25 then
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
26 touch "$SRCDIR/$FILENAME"
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
27 echo "No SHA1 for $FILENAME"
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
28 return 0
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
29 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
30 then
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 touch "$SRCDIR/$FILENAME"
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 echo "Confirmed $FILENAME"
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 return 0
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 fi
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
35
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
36 # 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
37 # 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
38
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 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
40
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 # 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
42
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 if [ -n "$i" ]
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 then
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 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
46 fi
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
47 done
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
48
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 # Return failure.
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
50
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 echo "Could not download $FILENAME"
81
6dd38c925bc4 Upgrade some packages, and other cleanups.
Rob Landley <rob@landley.net>
parents: 62
diff changeset
52 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
53 return 1
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 }
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
55
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
56 # Clean obsolete files out of the source directory
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
57
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
58 START_TIME=`date +%s`
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
59
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
60 function cleanup_oldfiles()
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
61 {
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
62 for i in "${SRCDIR}"/*
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
63 do
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
64 if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ]
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
65 then
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
66 echo Removing old file "$i"
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
67 rm -rf "$i"
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
68 fi
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
69 done
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
70 }
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
71
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
72 function dienow()
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
73 {
47
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
74 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
75 exit 1
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 }
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 function dotprogress()
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
79 {
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
80 x=0
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
81 while read i
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
82 do
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
83 x=$[$x + 1]
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
84 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
85 then
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
86 x=0
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
87 echo -n .
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
88 fi
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
89 done
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
90 echo
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 }
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
92
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
93 # 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
94 # 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
95
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
96 function setupfor()
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
97 {
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
98 # Is it a bzip2 or gzip tarball?
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
99
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
100 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
101 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
102 then
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
103 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
104 DECOMPRESS="j"
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
105 else
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
106 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
107 DECOMPRESS="z"
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
108 fi
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
109
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
110 # Announce package, with easy-to-grep-for "===" marker. Extract it.
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
111
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
112 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
113 echo -n "Extracting"
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
114 cd "${WORK}" &&
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
115 { 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
116 } | dotprogress
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
117
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
118 # Do we have a separate working directory?
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
119
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
120 if [ -z "$2" ]
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
121 then
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
122 cd "$1"* || dienow
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
123 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
124 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
125 cd "$2" || dienow
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
126 fi
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
127
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
128 # Set CURSRC
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
129
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
130 export CURSRC="$1"
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
131 [ ! -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
132 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
133 [ ! -d "${CURSRC}" ] && dienow
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
134
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
135 # Apply any patches to this package
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
136
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
137 for i in "${SOURCES}/patches/$1"*
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
138 do
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
139 if [ -f "$i" ]
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
140 then
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
141 (cd "${CURSRC}" && patch -p1 -i "$i") || dienow
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
142 fi
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
143 done
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
144 }
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 # Setup
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
147
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
148 umask 022
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
149 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
150 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
151
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
152 # Find/create directories
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
153
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
154 TOP=`pwd`
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
155 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
156 export SRCDIR="${SOURCES}/packages"
98
b6b4386a6c83 Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
157 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
158 export LINKDIR="${SOURCES}/build-links"
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
159 export BUILD="${TOP}/build"
98
b6b4386a6c83 Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
160 export HOSTTOOLS="${BUILD}/host"
b6b4386a6c83 Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
161 export WORK="${BUILD}/host-temp"
b6b4386a6c83 Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
162 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
163 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
164
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
165 # 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
166 set +h
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
167
47
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
168 # 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
169
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
170 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
171 then
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
172 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
173 shift
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
174 fi
edaa86240321 Turnerize the build script and teach cross-compile.sh to build qemu when
Rob Landley <rob@landley.net>
parents: 41
diff changeset
175
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
176 # 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
177
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
178 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
179 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
180 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
181 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
182 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
183 then
35
25bfa6ac9f84 Make the "supported architecutes" list have sane line breaks.
Rob Landley <rob@landley.net>
parents: 34
diff changeset
184 echo "Supported architectures: "
25bfa6ac9f84 Make the "supported architecutes" list have sane line breaks.
Rob Landley <rob@landley.net>
parents: 34
diff changeset
185 (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
186 exit 1
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
187 fi
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
188
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
189 # 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
190
62
4125b672b00c Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents: 60
diff changeset
191 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
192 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
193 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
194 # 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
195 # 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
196 # 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
197 # 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
198 # wrong libc.)
92
f46f4cda9d81 Apparently binutils/gcc got fixed sometime since the 3.1 days...
Rob Landley <rob@landley.net>
parents: 81
diff changeset
199 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
200 [ -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
201 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
202
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
203 # 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
204
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
205 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
206
62
4125b672b00c Get i686 cross-compiling to work like armv4l cross-compiling by lying to
Rob Landley <rob@landley.net>
parents: 60
diff changeset
207 # 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
208
41
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
209 export CROSS="${BUILD}/cross-compiler-$ARCH"
3baa8ab7ee6d Largeish update.
Rob Landley <rob@landley.net>
parents: 36
diff changeset
210 export NATIVE="${BUILD}/mini-native-$ARCH"
96
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 92
diff changeset
211 export PATH="${CROSS}/bin:${HOSTTOOLS}:$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
212 export IMAGE="${BUILD}/image-${ARCH}.ext2"
34
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
213 fi
98
b6b4386a6c83 Make host-tools.sh work when run standalone.
Rob Landley <rob@landley.net>
parents: 96
diff changeset
214 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
215
ad1cfcb043c7 Cleaup pass: Break out shell functions and variable definitions into include.sh.
Rob Landley <rob@landley.net>
parents:
diff changeset
216 [ -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
217 [ -z "$CC" ] && CC=gcc