annotate build.sh @ 27:8b75dee28f40 0.0.1

For some reason, `""` doesn't work. But "$("")" does.
author Rob Landley <rob@landley.net>
date Tue, 05 Dec 2006 23:00:12 -0500
parents f5cd9e1c2367
children bf2e771f4ba5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
3 # Memo: How should I pass this in?
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
4
15
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
5 ARCH=armv4l
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
6 CLEANUP=echo #rm -rf
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
7
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
8 if [ $ARCH == armv4l ]
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
9 then
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
10 KARCH=arm
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
11 # GCC_FLAGS="--with-float=soft"
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
12 fi
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
13
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
14 if [ $ARCH = armv5l ]
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
15 then
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
16 KARCH=arm
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
17 GCC_FLAGS="--with-float=soft --without-fp --with-cpu=xscale"
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
18 # --target=armv5l-linux
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
19 fi
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
20
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
21 if [ $ARCH == x86_64 ]
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
22 then
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
23 KARCH=$ARCH
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
24 GCC_FLAGS="-m64"
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
25 fi
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
26
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
27 function dienow()
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
28 {
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
29 echo "Exiting due to errors"
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
30 exit 1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
31 }
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 function dotprogress()
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 x=0
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
37 while read i
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
38 do
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
39 x=$[$x + 1]
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
40 if [[ "$x" -eq 25 ]]
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
41 then
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
42 x=0
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
43 echo -n .
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
44 fi
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
45 done
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
46 echo
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
47 }
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
48
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
49 # Extract package $1, use work directory $2 (or $1 if no $2), use source
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
50 # directory $3 (or $1 if no $3)
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
51
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
52 function setupfor()
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
53 {
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
54 echo "=== Building $1"
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
55 echo -n "Extracting"
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
56 cd "${WORK}" &&
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
57 { tar xvjf "${SOURCES}/${STAGE}/$1".tar.bz2 || dienow
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
58 } | dotprogress
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
59 if [ -z "$2" ]
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
60 then
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
61 cd "$1"* || dienow
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
62 else
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
63 mkdir "$2"
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
64 cd "$2" || dienow
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
65 fi
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
66 export CURSRC="$1"
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
67 [ ! -z "$3" ] && CURSRC="$3"
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
68 export CURSRC=`echo "${WORK}/${CURSRC}"*`
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
69 [ ! -d "${CURSRC}" ] && dienow
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
70 }
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
71
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
72 # Setup
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
73
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
74 umask 022
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
75 unset CFLAGS CXXFLAGS
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 # Find/create directories
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 TOP=`pwd`
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
80 export SOURCES="${TOP}/sources"
21
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
81 export CROSS="${TOP}/build/cross-compiler"
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
82 export WORK="${TOP}/build/temp"
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
83 mkdir -p "${CROSS}" "${WORK}"
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
84
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
85 [ $? -ne 0 ] && dienow
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
86
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
87 # 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
88 set +h
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
89 # Put the cross compiler in the path
23
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
90 export PATH=${CROSS}/bin:"$PATH"
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
91
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
92 # Which platform are we building for?
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
93
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
94 export CROSS_HOST=i686-pc-linux-gnu
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
95 export CROSS_TARGET=${ARCH}-unknown-linux-gnu
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
96
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
97 export STAGE=build-cross
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
98
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
99 # Install the linux kernel headers.
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
100
9
6cd344d090de Switch in make headers_install, fix the uclibc cleanup stage to actually work,
Rob Landley <rob@landley.net>
parents: 8
diff changeset
101 setupfor linux
15
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
102 make headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${CROSS}"
1
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
103
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
104 [ $? -ne 0 ] && dienow
9add2b1ccdfa First version of new build script. Does nothing, but does it correctly.
landley@driftwood
parents:
diff changeset
105
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
106 # Build and install binutils
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
107
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
108 setupfor binutils build-binutils
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
109 "${CURSRC}/configure" --prefix="${CROSS}" --host=${CROSS_HOST} \
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
110 --target=${CROSS_TARGET} --with-lib-path=lib --disable-nls \
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
111 --disable-shared --enable-64-bit-bfd --disable-multilib &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
112 make configure-host &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
113 make &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
114 make install &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
115 cd .. &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
116 cp binutils-*/include/libiberty.h "${CROSS}/include" &&
15
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
117 $CLEANUP binutils-* build-binutils
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
118
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
119 [ $? -ne 0 ] && dienow
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
120
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
121 # Build and install gcc
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
122
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
123 setupfor gcc-core build-gcc gcc-
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
124 "${CURSRC}/configure" --prefix="${CROSS}" --host=${CROSS_HOST} \
15
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
125 --target=${CROSS_TARGET} \
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
126 --disable-multilib --disable-nls --disable-shared $GCC_FLAGS \
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
127 --disable-threads --enable-languages=c
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
128 #--with-local-prefix="${CROSS}" \
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
129 # --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99 \
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
130 # --enable-long-long --enable-threads=posix &&
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
131 make all-gcc &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
132 make install-gcc &&
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
133 cd .. &&
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
134
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
135 # Move the gcc internal libraries and headers somewhere sane.
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
136
21
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
137 mkdir -p "${CROSS}"/gcc &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
138 mv "${CROSS}"/lib/gcc/*/*/include "${CROSS}"/gcc/include &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
139 mv "${CROSS}"/lib/gcc/*/* "${CROSS}"/gcc/lib &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
140 $CLEANUP "${CURSRC}" build-gcc "${CROSS}"/{lib/gcc,gcc/lib/install-tools} &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
141
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
142 # Build and install gcc wrapper script.
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
143
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
144 GCCNAME="$(echo "${CROSS}"/bin/*-gcc)" &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
145 mv "$GCCNAME" "${CROSS}"/bin/gcc-unwrapped &&
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
146 gcc "${TOP}"/sources/toys/gcc-uClibc.c -Os -s -o "$GCCNAME"
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
147
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
148 [ $? -ne 0 ] && dienow
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
149
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
150 # Build and install uClibc
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
151
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
152 setupfor uClibc
23
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
153
21
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
154 cp "${TOP}"/sources/configs/uClibc-config-"${KARCH}" .config &&
23
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
155 (yes "" | make CROSS="${CROSS_TARGET}"- oldconfig) &&
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
156 make CROSS="${CROSS_TARGET}"- KERNEL_SOURCE="${CROSS}" &&
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
157 #make CROSS="${CROSS_TARGET}"- utils &&
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
158 # The kernel headers are already installed, but uClibc's install will try to
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
159 # be "helpful" and copy them over themselves, at which point hilarity ensues.
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
160 # Make it not do that.
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
161 rm include/{asm,asm-generic,linux} &&
23
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
162 make CROSS="${CROSS_TARGET}"- KERNEL_SOURCE="${CROSS}"/ \
21
c4e1bd04035d Build uClibc under the wrapper script. (There's got to be a better way to
Rob Landley <rob@landley.net>
parents: 18
diff changeset
163 RUNTIME_PREFIX="${CROSS}"/ DEVEL_PREFIX="${CROSS}"/ \
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
164 install_runtime install_dev &&
22
775c1fdc1730 Minor cleanup on the wrapper script (much more cleanup needed before it's
Rob Landley <rob@landley.net>
parents: 21
diff changeset
165 # The uClibc build uses ./include instead of ${CROSS}/include, so the symlinks
775c1fdc1730 Minor cleanup on the wrapper script (much more cleanup needed before it's
Rob Landley <rob@landley.net>
parents: 21
diff changeset
166 # need to come back. (Yes, it links against the _headers_ from the source,
775c1fdc1730 Minor cleanup on the wrapper script (much more cleanup needed before it's
Rob Landley <rob@landley.net>
parents: 21
diff changeset
167 # but against the _libraries_ from the destination. Hence needing to install
775c1fdc1730 Minor cleanup on the wrapper script (much more cleanup needed before it's
Rob Landley <rob@landley.net>
parents: 21
diff changeset
168 # libc.so before building utils.)
23
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
169 ln -s "${CROSS}"/include/linux include/linux &&
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
170 ln -s "${CROSS}"/include/asm include/asm &&
a5e004e33daa Balance quotes, add some missing quotes, preserve old $PATH.
Rob Landley <rob@landley.net>
parents: 22
diff changeset
171 ln -s "${CROSS}"/include/asm-generic include/asm-generic &&
22
775c1fdc1730 Minor cleanup on the wrapper script (much more cleanup needed before it's
Rob Landley <rob@landley.net>
parents: 21
diff changeset
172 make CROSS=${CROSS_TARGET}- RUNTIME_PREFIX="${CROSS}"/ install_utils &&
8
0068264ad65a Some work I did back in october but hadn't checked in yet: let setupfor()
Rob Landley <rob@landley.net>
parents: 3
diff changeset
173 cd .. &&
15
11b76d1cc1cd Trying to build an arm toolchain (so I can test "hello world" with arm
Rob Landley <rob@landley.net>
parents: 9
diff changeset
174 $CLEANUP uClibc-*
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
175
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
176 [ $? -ne 0 ] && dienow
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
177
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
178 # A quick hello world program to test the cross-compiler out.
17
1202bdb44025 Build for the wrapper script. (Which still doesn't work right.)
Rob Landley <rob@landley.net>
parents: 15
diff changeset
179
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
180 cat > "$WORK"/hello.c << 'EOF' &&
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
181 #include <stdio.h>
17
1202bdb44025 Build for the wrapper script. (Which still doesn't work right.)
Rob Landley <rob@landley.net>
parents: 15
diff changeset
182
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
183 int main(int argc, char *argv[])
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
184 {
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
185 printf("Hello world!\n");
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
186 return 0;
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
187 }
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
188 EOF
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
189
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
190 # Build something dynamic, then static, to verify header/library paths.
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
191
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
192 "$GCCNAME" -Os "$WORK"/hello.c -o "$WORK"/hello &&
24
60ad658c5aab One more missing path in the qemu-arm check. (Notice I'm not building qemu
Rob Landley <rob@landley.net>
parents: 23
diff changeset
193 "$GCCNAME" -Os -static "$WORK"/hello.c -o "$WORK"/hello &&
27
8b75dee28f40 For some reason, `""` doesn't work. But "$("")" does.
Rob Landley <rob@landley.net>
parents: 26
diff changeset
194 [ x"$(qemu-${KARCH} "${WORK}"/hello)" == x"Hello world!" ] &&
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
195 echo Cross-toolchain seems to work.
17
1202bdb44025 Build for the wrapper script. (Which still doesn't work right.)
Rob Landley <rob@landley.net>
parents: 15
diff changeset
196
3
1b721a51e9c6 Extract headers, build cross-binutils, build cross-gcc. Needs a C library.
landley@driftwood
parents: 1
diff changeset
197 [ $? -ne 0 ] && dienow
18
eaf7a8d5e697 Managed to get a working toolchain, with wrapper script, to build a hello
Rob Landley <rob@landley.net>
parents: 17
diff changeset
198