Mercurial > hg > aboriginal
annotate build.sh @ 1:9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
author | landley@driftwood |
---|---|
date | Sun, 13 Aug 2006 22:29:11 -0400 |
parents | |
children | 1b721a51e9c6 |
rev | line source |
---|---|
1
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
1 #!/bin/sh |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
2 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
3 function dienow() |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
4 { |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
5 echo "Exiting due to errors" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
6 exit 1 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
7 } |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
8 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
9 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
10 function dotprogress() |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
11 { |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
12 x=0 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
13 while read i |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
14 do |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
15 x=$[$x + 1] |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
16 if [[ "$x" -eq 25 ]] |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
17 then |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
18 x=0 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
19 echo -n . |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
20 fi |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
21 done |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
22 echo |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
23 } |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
24 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
25 function setupfor() |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
26 { |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
27 echo "=== Building $1" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
28 echo -n "Extracting" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
29 cd "${WORK}" && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
30 tar xvjf "${SOURCES}/${STAGE}/$1".tar.bz2 | dotprogress |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
31 cd "$1"* || dienow |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
32 } |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
33 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
34 # Setup |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
35 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
36 umask 022 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
37 unset CFLAGS CXXFLAGS |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
38 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
39 ARCH=x86_64 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
40 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
41 # Find/create directories |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
42 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
43 TOP=`pwd` |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
44 export CROSS="${TOP}/build/cross-compiler" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
45 export WORK="${TOP}/build/temp" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
46 export SOURCES="${TOP}/sources" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
47 mkdir -p "${CROSS}" "${WORK}" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
48 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
49 [ $? -ne 0 ] && dienow |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
50 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
51 # For bash: check the $PATH for new executables added after startup. |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
52 set +h |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
53 # Put the cross compiler in the path |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
54 export PATH=`pwd`/cross:/bin:/usr/bin |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
55 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
56 # Which platform are we building for? |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
57 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
58 [ "$ARCH" == x86_64 ] && export BUILD64="-m64" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
59 export LFS_HOST=i686-pc-linux-gnu |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
60 export LFS_TARGET=${ARCH}-unknown-linux-gnu |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
61 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
62 export STAGE=build-cross |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
63 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
64 echo === Install linux-headers. |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
65 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
66 setupfor linux-headers |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
67 #cd "${WORK}" |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
68 #tar xvjf "${SOURCES}"/build-cross/linux-headers.tar.bz2 && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
69 #cd linux-headers* && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
70 mkdir "${CROSS}"/include && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
71 mv include/asm-${ARCH} "${CROSS}"/include/asm && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
72 mv include/asm-generic "${CROSS}"/include && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
73 mv include/linux "${CROSS}"/include && |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
74 cd .. |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
75 rm -rf linux-headers* |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
76 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
77 [ $? -ne 0 ] && dienow |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
78 |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
79 setupfor binutils |
9add2b1ccdfa
First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff
changeset
|
80 /bin/sh |