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