comparison root-filesystem.sh @ 783:db06a8c1bfed

Lots of changes to move buildall.sh functionality into build.sh. Upgrade build.sh to be able to create static cross compilers and static native compilers via canadian cross. Teach build stages to use $STAGE_NAME for their output directory (and tarballs, and === notifications). Remove LFS style /tools support (since host-tools.sh performs an equivalent cleaning step and it's a pain to maintain it), add ROOT_NODIRS instead.
author Rob Landley <rob@landley.net>
date Sun, 05 Jul 2009 17:50:44 -0500
parents 5c6ebb711b72
children 81cf7ae7afce
comparison
equal deleted inserted replaced
782:5c6ebb711b72 783:db06a8c1bfed
8 8
9 read_arch_dir "$1" 9 read_arch_dir "$1"
10 10
11 # If this target has a base architecture that's already been built, use that. 11 # If this target has a base architecture that's already been built, use that.
12 12
13 check_for_base_arch root-filesystem || exit 0 13 check_for_base_arch || exit 0
14 14
15 # Die if our prerequisite isn't there. 15 # Die if our prerequisite isn't there.
16 16
17 for i in "$ARCH" "$FROM_ARCH" 17 for i in "$ARCH" "$FROM_ARCH"
18 do 18 do
24 done 24 done
25 25
26 # Announce start of stage. 26 # Announce start of stage.
27 27
28 echo -e "$NATIVE_COLOR" 28 echo -e "$NATIVE_COLOR"
29 echo "=== Building minimal native development environment" 29 echo "=== Building $STAGE_NAME"
30 30
31 blank_tempdir "$WORK" 31 blank_tempdir "$WORK"
32 blank_tempdir "$NATIVE_ROOT" 32 blank_tempdir "$STAGE_DIR"
33 33
34 # Determine which directory layout we're using 34 # Determine which directory layout we're using
35 35
36 if [ ! -z "${NATIVE_TOOLSDIR}" ] 36 if [ -z "$ROOT_NODIRS" ]
37 then 37 then
38 mkdir -p "${TOOLS}/bin" || dienow 38 ROOT_TOPDIR="$STAGE_DIR/usr"
39 39 mkdir -p "$STAGE_DIR"/{tmp,proc,sys,dev,home} || dienow
40 # Tell the wrapper script where to find the dynamic linker.
41 export UCLIBC_DYNAMIC_LINKER=/tools/lib/ld-uClibc.so.0
42 UCLIBC_TOPDIR="${NATIVE_ROOT}"
43 UCLIBC_DLPREFIX="/tools"
44 else
45 mkdir -p "${NATIVE_ROOT}"/{tmp,proc,sys,dev,home} || dienow
46 UCLIBC_TOPDIR="${TOOLS}"
47 for i in bin sbin lib etc 40 for i in bin sbin lib etc
48 do 41 do
49 mkdir -p "$TOOLS/$i" || dienow 42 mkdir -p "$ROOT_TOPDIR/$i" || dienow
50 ln -s "usr/$i" "${NATIVE_ROOT}/$i" || dienow 43 ln -s "usr/$i" "$STAGE_DIR/$i" || dienow
51 done 44 done
45 else
46 ROOT_TOPDIR="$STAGE_DIR"
47 mkdir -p "$STAGE_DIR/bin" || dienow
52 fi 48 fi
53 49
54 # Install Linux kernel headers. 50 # Install Linux kernel headers.
55 51
56 setupfor linux 52 setupfor linux
57 # Install Linux kernel headers (for use by uClibc). 53 # Install Linux kernel headers (for use by uClibc).
58 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="${TOOLS}" && 54 make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="$ROOT_TOPDIR" &&
59 # This makes some very old package builds happy. 55 # This makes some very old package builds happy.
60 ln -s ../sys/user.h "${TOOLS}/include/asm/page.h" && 56 ln -s ../sys/user.h "$ROOT_TOPDIR/include/asm/page.h" &&
61 cd .. 57 cd ..
62 58
63 cleanup linux 59 cleanup linux
64 60
65 # Build and install uClibc. (We could just copy the one from the compiler 61 # Build and install uClibc. (We could just copy the one from the compiler
71 67
72 # Alas, if we feed install and install_utils to make at the same time with 68 # Alas, if we feed install and install_utils to make at the same time with
73 # -j > 1, it dies. Not SMP safe. 69 # -j > 1, it dies. Not SMP safe.
74 for i in install install_utils 70 for i in install install_utils
75 do 71 do
76 make CROSS="${ARCH}-" KERNEL_HEADERS="${TOOLS}/include" \ 72 make CROSS="${ARCH}-" KERNEL_HEADERS="$ROOT_TOPDIR/include" \
77 PREFIX="${UCLIBC_TOPDIR}/" $VERBOSITY \ 73 PREFIX="$ROOT_TOPDIR/" $VERBOSITY \
78 RUNTIME_PREFIX="$UCLIBC_DLPREFIX/" DEVEL_PREFIX="$UCLIBC_DLPREFIX/" \ 74 RUNTIME_PREFIX="/" DEVEL_PREFIX="/" \
79 UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow 75 UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow
80 done 76 done
81 77
82 # There's no way to specify a prefix for the uClibc utils; rename them by hand. 78 # There's no way to specify a prefix for the uClibc utils; rename them by hand.
83 79
84 if [ ! -z "$PROGRAM_PREFIX" ] 80 if [ ! -z "$PROGRAM_PREFIX" ]
85 then 81 then
86 for i in ldd readelf 82 for i in ldd readelf
87 do 83 do
88 mv "${TOOLS}"/bin/{"$i","${PROGRAM_PREFIX}$i"} || dienow 84 mv "$ROOT_TOPDIR"/bin/{"$i","${PROGRAM_PREFIX}$i"} || dienow
89 done 85 done
90 fi 86 fi
91 87
92 cd .. 88 cd ..
93 89
96 if [ "$NATIVE_TOOLCHAIN" == "none" ] 92 if [ "$NATIVE_TOOLCHAIN" == "none" ]
97 then 93 then
98 # If we're not installing a compiler, delete the headers, static libs, 94 # If we're not installing a compiler, delete the headers, static libs,
99 # and example source code. 95 # and example source code.
100 96
101 rm -rf "${TOOLS}"/include && 97 rm -rf "$ROOT_TOPDIR"/include &&
102 rm -rf "${TOOLS}"/lib/*.a && 98 rm -rf "$ROOT_TOPDIR"/lib/*.a &&
103 rm -rf "${TOOLS}/src" || dienow 99 rm -rf "$ROOT_TOPDIR/src" || dienow
104 100
105 elif [ "$NATIVE_TOOLCHAIN" == "headers" ] 101 elif [ "$NATIVE_TOOLCHAIN" == "headers" ]
106 then 102 then
107 103
108 # If you want to use a compiler other than gcc, you need to keep the headers, 104 # If you want to use a compiler other than gcc, you need to keep the headers,
112 else 108 else
113 109
114 # Build and install native binutils 110 # Build and install native binutils
115 111
116 setupfor binutils build-binutils 112 setupfor binutils build-binutils
117 CC="${FROM_ARCH}-cc" AR="${FROM_ARCH}-ar" "${CURSRC}/configure" --prefix="${TOOLS}" \ 113 CC="${FROM_ARCH}-cc" AR="${FROM_ARCH}-ar" "${CURSRC}/configure" --prefix="$ROOT_TOPDIR" \
118 --build="${CROSS_HOST}" --host="${FROM_HOST}" --target="${CROSS_TARGET}" \ 114 --build="${CROSS_HOST}" --host="${FROM_HOST}" --target="${CROSS_TARGET}" \
119 --disable-nls --disable-shared --disable-multilib --disable-werror \ 115 --disable-nls --disable-shared --disable-multilib --disable-werror \
120 --program-prefix="$PROGRAM_PREFIX" $BINUTILS_FLAGS && 116 --program-prefix="$PROGRAM_PREFIX" $BINUTILS_FLAGS &&
121 make -j $CPUS configure-host && 117 make -j $CPUS configure-host &&
122 make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS" && 118 make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS" &&
123 make -j $CPUS install && 119 make -j $CPUS install &&
124 cd .. && 120 cd .. &&
125 mkdir -p "${TOOLS}/include" && 121 mkdir -p "$ROOT_TOPDIR/include" &&
126 cp binutils/include/libiberty.h "${TOOLS}/include" 122 cp binutils/include/libiberty.h "$ROOT_TOPDIR/include"
127 123
128 cleanup binutils build-binutils 124 cleanup binutils build-binutils
129 125
130 # Build and install native gcc, with c++ support this time. 126 # Build and install native gcc, with c++ support this time.
131 127
146 ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \ 142 ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \
147 ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \ 143 ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \
148 ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \ 144 ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \
149 ac_cv_path_AS_FOR_TARGET="${ARCH}-as" \ 145 ac_cv_path_AS_FOR_TARGET="${ARCH}-as" \
150 ac_cv_path_LD_FOR_TARGET="${ARCH}-ld" \ 146 ac_cv_path_LD_FOR_TARGET="${ARCH}-ld" \
151 "${CURSRC}/configure" --prefix="${TOOLS}" --disable-multilib \ 147 "${CURSRC}/configure" --prefix="$ROOT_TOPDIR" --disable-multilib \
152 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \ 148 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
153 --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \ 149 --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \
154 --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \ 150 --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
155 --disable-libstdcxx-pch --program-prefix="$PROGRAM_PREFIX" \ 151 --disable-libstdcxx-pch --program-prefix="$PROGRAM_PREFIX" \
156 $GCC_FLAGS && 152 $GCC_FLAGS &&
157 mkdir gcc && 153 mkdir gcc &&
158 ln -s `which "${ARCH}-gcc"` gcc/xgcc && 154 ln -s `which "${ARCH}-gcc"` gcc/xgcc &&
159 make -j $CPUS configure-host && 155 make -j $CPUS configure-host &&
160 make -j $CPUS all-gcc LDFLAGS="$STATIC_FLAGS" && 156 make -j $CPUS all-gcc LDFLAGS="$STATIC_FLAGS" &&
161 # Work around gcc bug; we disabled multilib but it doesn't always notice. 157 # Work around gcc bug; we disabled multilib but it doesn't always notice.
162 ln -s lib "$TOOLS/lib64" && 158 ln -s lib "$ROOT_TOPDIR/lib64" &&
163 make -j $CPUS install-gcc && 159 make -j $CPUS install-gcc &&
164 rm "$TOOLS/lib64" && 160 rm "$ROOT_TOPDIR/lib64" &&
165 ln -s "${PROGRAM_PREFIX}gcc" "${TOOLS}/bin/${PROGRAM_PREFIX}cc" && 161 ln -s "${PROGRAM_PREFIX}gcc" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}cc" &&
166 # Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build). 162 # Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build).
167 # But don't want to build the whole of libstdc++-v3 because 163 # But don't want to build the whole of libstdc++-v3 because
168 # A) we're using uClibc++ instead, B) the build breaks. 164 # A) we're using uClibc++ instead, B) the build breaks.
169 make -j $CPUS configure-target-libstdc++-v3 && 165 make -j $CPUS configure-target-libstdc++-v3 &&
170 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ && 166 cd "$CROSS_TARGET"/libstdc++-v3/libsupc++ &&
171 make -j $CPUS && 167 make -j $CPUS &&
172 mv .libs/libsupc++.a "$TOOLS"/lib && 168 mv .libs/libsupc++.a "$ROOT_TOPDIR"/lib &&
173 cd ../../../.. 169 cd ../../../..
174 170
175 cleanup gcc-core build-gcc 171 cleanup gcc-core build-gcc
176 172
177 # Move the gcc internal libraries and headers somewhere sane 173 # Move the gcc internal libraries and headers somewhere sane
178 174
179 mkdir -p "${TOOLS}"/gcc && 175 mkdir -p "$ROOT_TOPDIR"/gcc &&
180 mv "${TOOLS}"/lib/gcc/*/*/include "${TOOLS}"/gcc/include && 176 mv "$ROOT_TOPDIR"/lib/gcc/*/*/include "$ROOT_TOPDIR"/gcc/include &&
181 mv "${TOOLS}"/lib/gcc/*/* "${TOOLS}"/gcc/lib && 177 mv "$ROOT_TOPDIR"/lib/gcc/*/* "$ROOT_TOPDIR"/gcc/lib &&
182 178
183 # Rub gcc's nose in the binutils output. 179 # Rub gcc's nose in the binutils output.
184 cd "${TOOLS}"/libexec/gcc/*/*/ && 180 cd "$ROOT_TOPDIR"/libexec/gcc/*/*/ &&
185 cp -s "../../../../$CROSS_TARGET/bin/"* . && 181 cp -s "../../../../$CROSS_TARGET/bin/"* . &&
186 182
187 # build and install gcc wrapper script. 183 # build and install gcc wrapper script.
188 mv "${TOOLS}/bin/${PROGRAM_PREFIX}gcc" "${TOOLS}/bin/${PROGRAM_PREFIX}rawgcc" && 184 mv "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}gcc" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}rawgcc" &&
189 "${FROM_ARCH}-cc" "${SOURCES}"/toys/ccwrap.c -Os -s \ 185 "${FROM_ARCH}-cc" "${SOURCES}"/toys/ccwrap.c -Os -s \
190 -o "${TOOLS}/bin/${PROGRAM_PREFIX}gcc" -DGIMME_AN_S $STATIC_FLAGS \ 186 -o "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}gcc" -DGIMME_AN_S $STATIC_FLAGS \
191 -DGCC_UNWRAPPED_NAME='"'"${PROGRAM_PREFIX}rawgcc"'"' && 187 -DGCC_UNWRAPPED_NAME='"'"${PROGRAM_PREFIX}rawgcc"'"' &&
192 188
193 # Wrap C++ 189 # Wrap C++
194 mv "${TOOLS}/bin/${PROGRAM_PREFIX}g++" "${TOOLS}/bin/${PROGRAM_PREFIX}rawg++" && 190 mv "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}g++" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}rawg++" &&
195 ln "${TOOLS}/bin/${PROGRAM_PREFIX}gcc" "${TOOLS}/bin/${PROGRAM_PREFIX}g++" && 191 ln "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}gcc" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}g++" &&
196 rm "${TOOLS}/bin/${PROGRAM_PREFIX}c++" && 192 rm "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}c++" &&
197 ln -s "${PROGRAM_PREFIX}g++" "${TOOLS}/bin/${PROGRAM_PREFIX}c++" 193 ln -s "${PROGRAM_PREFIX}g++" "$ROOT_TOPDIR/bin/${PROGRAM_PREFIX}c++"
198 194
199 cleanup "${TOOLS}"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*} 195 cleanup "$ROOT_TOPDIR"/{lib/gcc,gcc/lib/install-tools,bin/${ARCH}-unknown-*}
200 196
201 # Tell future packages to link against the libraries in root-filesystem, 197 # Tell future packages to link against the libraries in the new root filesystem,
202 # rather than the ones in the cross compiler directory. 198 # rather than the ones in the cross compiler directory.
203 199
204 export WRAPPER_TOPDIR="${TOOLS}" 200 export WRAPPER_TOPDIR="$ROOT_TOPDIR"
205 201
206 # Build and install uClibc++ 202 # Build and install uClibc++
207 203
208 setupfor uClibc++ 204 setupfor uClibc++
209 CROSS= make defconfig && 205 CROSS= make defconfig &&
210 sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config && 206 sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config &&
211 sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config && 207 sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config &&
212 CROSS= make oldconfig && 208 CROSS= make oldconfig &&
213 CROSS="$ARCH"- make && 209 CROSS="$ARCH"- make &&
214 CROSS= make install PREFIX="${TOOLS}/c++" && 210 CROSS= make install PREFIX="$ROOT_TOPDIR/c++" &&
215 211
216 # Move libraries somewhere useful. 212 # Move libraries somewhere useful.
217 213
218 mv "${TOOLS}"/c++/lib/* "${TOOLS}"/lib && 214 mv "$ROOT_TOPDIR"/c++/lib/* "$ROOT_TOPDIR"/lib &&
219 rm -rf "${TOOLS}"/c++/{lib,bin} && 215 rm -rf "$ROOT_TOPDIR"/c++/{lib,bin} &&
220 ln -s libuClibc++.so "${TOOLS}"/lib/libstdc++.so && 216 ln -s libuClibc++.so "$ROOT_TOPDIR"/lib/libstdc++.so &&
221 ln -s libuClibc++.a "${TOOLS}"/lib/libstdc++.a && 217 ln -s libuClibc++.a "$ROOT_TOPDIR"/lib/libstdc++.a &&
222 cd .. 218 cd ..
223 219
224 cleanup uClibc++ 220 cleanup uClibc++
225 221
226 fi # End of NATIVE_TOOLCHAIN build 222 fi # End of NATIVE_TOOLCHAIN build
228 if [ "$NATIVE_TOOLCHAIN" != "only" ] 224 if [ "$NATIVE_TOOLCHAIN" != "only" ]
229 then 225 then
230 226
231 # Copy qemu setup script and so on. 227 # Copy qemu setup script and so on.
232 228
233 cp -r "${SOURCES}/native/." "${TOOLS}/" && 229 cp -r "${SOURCES}/native/." "$ROOT_TOPDIR/" &&
234 cp "$SRCDIR"/MANIFEST "${TOOLS}/src" && 230 cp "$SRCDIR"/MANIFEST "$ROOT_TOPDIR/src" &&
235 cp "${WORK}/config-uClibc" "${TOOLS}/src/config-uClibc" || dienow 231 cp "${WORK}/config-uClibc" "$ROOT_TOPDIR/src/config-uClibc" || dienow
236
237 if [ -z "${NATIVE_TOOLSDIR}" ]
238 then
239 sed -i -e 's@/tools/@/usr/@g' "${TOOLS}/sbin/init.sh" || dienow
240 fi
241 232
242 # Build and install toybox 233 # Build and install toybox
243 234
244 setupfor toybox 235 setupfor toybox
245 make defconfig && 236 make defconfig &&
246 if [ -z "$USE_TOYBOX" ] 237 if [ -z "$USE_TOYBOX" ]
247 then 238 then
248 CFLAGS="$CFLAGS $STATIC_FLAGS" make CROSS="${ARCH}-" && 239 CFLAGS="$CFLAGS $STATIC_FLAGS" make CROSS="${ARCH}-" &&
249 cp toybox "$TOOLS/bin" && 240 cp toybox "$ROOT_TOPDIR/bin" &&
250 ln -s toybox "$TOOLS/bin/patch" && 241 ln -s toybox "$ROOT_TOPDIR/bin/patch" &&
251 ln -s toybox "$TOOLS/bin/oneit" && 242 ln -s toybox "$ROOT_TOPDIR/bin/oneit" &&
252 ln -s toybox "$TOOLS/bin/netcat" && 243 ln -s toybox "$ROOT_TOPDIR/bin/netcat" &&
253 cd .. 244 cd ..
254 else 245 else
255 CFLAGS="$CFLAGS $STATIC_FLAGS" \ 246 CFLAGS="$CFLAGS $STATIC_FLAGS" \
256 make install_flat PREFIX="${TOOLS}"/bin CROSS="${ARCH}-" && 247 make install_flat PREFIX="$ROOT_TOPDIR"/bin CROSS="${ARCH}-" &&
257 cd .. 248 cd ..
258 fi 249 fi
259 250
260 cleanup toybox 251 cleanup toybox
261 252
262 # Build and install busybox 253 # Build and install busybox
263 254
264 setupfor busybox 255 setupfor busybox
265 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && 256 make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" &&
266 cp .config "${TOOLS}"/src/config-busybox && 257 cp .config "$ROOT_TOPDIR"/src/config-busybox &&
267 LDFLAGS="$LDFLAGS $STATIC_FLAGS" \ 258 LDFLAGS="$LDFLAGS $STATIC_FLAGS" \
268 make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY && 259 make -j $CPUS CROSS_COMPILE="${ARCH}-" $VERBOSITY &&
269 make busybox.links && 260 make busybox.links &&
270 cp busybox "${TOOLS}/bin" 261 cp busybox "$ROOT_TOPDIR/bin"
271 262
272 [ $? -ne 0 ] && dienow 263 [ $? -ne 0 ] && dienow
273 264
274 for i in $(sed 's@.*/@@' busybox.links) 265 for i in $(sed 's@.*/@@' busybox.links)
275 do 266 do
276 # Allowed to fail. 267 # Allowed to fail.
277 ln -s busybox "${TOOLS}/bin/$i" 2>/dev/null 268 ln -s busybox "$ROOT_TOPDIR/bin/$i" 2>/dev/null
278 done 269 done
279 cd .. 270 cd ..
280 271
281 cleanup busybox 272 cleanup busybox
282 273
283 # Build and install make 274 # Build and install make
284 275
285 setupfor make 276 setupfor make
286 CC="${ARCH}-cc" ./configure --prefix="${TOOLS}" --build="${CROSS_HOST}" \ 277 CC="${ARCH}-cc" ./configure --prefix="$ROOT_TOPDIR" --build="${CROSS_HOST}" \
287 --host="${CROSS_TARGET}" && 278 --host="${CROSS_TARGET}" &&
288 make -j $CPUS && 279 make -j $CPUS &&
289 make -j $CPUS install && 280 make -j $CPUS install &&
290 cd .. 281 cd ..
291 282
293 284
294 # Build and install bash. (Yes, this is an old version. It's intentional.) 285 # Build and install bash. (Yes, this is an old version. It's intentional.)
295 286
296 setupfor bash 287 setupfor bash
297 # Remove existing /bin/sh link (busybox) so the bash install doesn't get upset. 288 # Remove existing /bin/sh link (busybox) so the bash install doesn't get upset.
298 #rm "$TOOLS"/bin/sh 289 #rm "$ROOT_TOPDIR"/bin/sh
299 # wire around some tests ./configure can't run when cross-compiling. 290 # wire around some tests ./configure can't run when cross-compiling.
300 cat > config.cache << EOF && 291 cat > config.cache << EOF &&
301 ac_cv_func_setvbuf_reversed=no 292 ac_cv_func_setvbuf_reversed=no
302 bash_cv_sys_named_pipes=yes 293 bash_cv_sys_named_pipes=yes
303 bash_cv_have_mbstate_t=yes 294 bash_cv_have_mbstate_t=yes
304 bash_cv_getenv_redef=no 295 bash_cv_getenv_redef=no
305 EOF 296 EOF
306 CC="${ARCH}-cc" RANLIB="${ARCH}-ranlib" ./configure --prefix="${TOOLS}" \ 297 CC="${ARCH}-cc" RANLIB="${ARCH}-ranlib" ./configure --prefix="$ROOT_TOPDIR" \
307 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \ 298 --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --cache-file=config.cache \
308 --without-bash-malloc --disable-readline && 299 --without-bash-malloc --disable-readline &&
309 # note: doesn't work with -j 300 # note: doesn't work with -j
310 make && 301 make &&
311 make install && 302 make install &&
312 # Make bash the default shell. 303 # Make bash the default shell.
313 ln -sf bash "${TOOLS}/bin/sh" && 304 ln -sf bash "$ROOT_TOPDIR/bin/sh" &&
314 cd .. 305 cd ..
315 306
316 cleanup bash 307 cleanup bash
317 308
318 setupfor distcc 309 setupfor distcc
319 CC="${ARCH}-cc" ./configure --host="${CROSS_TARGET}" --prefix="${TOOLS}" \ 310 CC="${ARCH}-cc" ./configure --host="${CROSS_TARGET}" --prefix="$ROOT_TOPDIR" \
320 --with-included-popt --disable-Werror && 311 --with-included-popt --disable-Werror &&
321 make -j $CPUS && 312 make -j $CPUS &&
322 make -j $CPUS install && 313 make -j $CPUS install &&
323 mkdir -p "${TOOLS}/distcc" || dienow 314 mkdir -p "$ROOT_TOPDIR/distcc" || dienow
324 315
325 for i in gcc cc g++ c++ 316 for i in gcc cc g++ c++
326 do 317 do
327 ln -s ../bin/distcc "${TOOLS}/distcc/$i" || dienow 318 ln -s ../bin/distcc "$ROOT_TOPDIR/distcc/$i" || dienow
328 done 319 done
329 cd .. 320 cd ..
330 321
331 cleanup distcc 322 cleanup distcc
332 323
333 # Put statically and dynamically linked hello world programs on there for 324 # Put statically and dynamically linked hello world programs on there for
334 # test purposes. 325 # test purposes.
335 326
336 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os -s -o "${TOOLS}/bin/hello-dynamic" && 327 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os -s -o "$ROOT_TOPDIR/bin/hello-dynamic" &&
337 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os -s -static -o "${TOOLS}/bin/hello-static" 328 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os -s -static -o "$ROOT_TOPDIR/bin/hello-static"
338 329
339 [ $? -ne 0 ] && dienow 330 [ $? -ne 0 ] && dienow
340 331
341 fi # End of NATIVE_TOOLCHAIN != only 332 fi # End of NATIVE_TOOLCHAIN != only
342 333
343 # Delete some unneeded files 334 # Delete some unneeded files
344 335
345 rm -rf "${TOOLS}"/{info,man,libexec/gcc/*/*/install-tools} 336 rm -rf "$ROOT_TOPDIR"/{info,man,libexec/gcc/*/*/install-tools}
346 337
347 # Clean up and package the result 338 # Clean up and package the result
348 339
349 "${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*} 340 "${ARCH}-strip" "$ROOT_TOPDIR"/{bin/*,sbin/*,libexec/gcc/*/*/*}
350 "${ARCH}-strip" --strip-unneeded "${TOOLS}"/lib/*.so 341 "${ARCH}-strip" --strip-unneeded "$ROOT_TOPDIR"/lib/*.so
351 342
352 create_stage_tarball root-filesystem 343 create_stage_tarball
353 344
354 # Color back to normal 345 # Color back to normal
355 echo -e "\e[0mBuild complete" 346 echo -e "\e[0mBuild complete"