Mercurial > hg > aboriginal
changeset 301:309b574a5059
Redo the $CLEANUP logic to a cleanup function in include.sh (meaning if a
package build breaks its source isn't deleted), and comment host-tools.sh more.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 21 Feb 2008 04:47:54 -0600 |
parents | 86455766b85d |
children | eb2aa88277e2 |
files | cross-compiler.sh host-tools.sh include.sh mini-native.sh |
diffstat | 4 files changed, 73 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/cross-compiler.sh Sat Feb 16 23:23:11 2008 -0600 +++ b/cross-compiler.sh Thu Feb 21 04:47:54 2008 -0600 @@ -4,9 +4,6 @@ source include.sh -# A little debugging trick... -#CLEANUP=echo - rm -rf "${CROSS}" mkdir -p "${CROSS}" || dienow @@ -25,10 +22,9 @@ make -j $CPUS install && cd .. && mkdir -p "${CROSS}/include" && -cp binutils/include/libiberty.h "${CROSS}/include" && -$CLEANUP binutils build-binutils +cp binutils/include/libiberty.h "${CROSS}/include" -[ $? -ne 0 ] && dienow +cleanup binutils build-binutils # Build and install gcc @@ -53,7 +49,7 @@ mv "${CROSS}"/lib/gcc/*/* "${CROSS}"/gcc/lib && ln -s ${CROSS_TARGET} ${CROSS}/tools && ln -sf ../../../../tools/bin/ld ${CROSS}/libexec/gcc/*/*/collect2 && -$CLEANUP "${CROSS}"/{lib/gcc,gcc/lib/install-tools} && +rm -rf "${CROSS}"/{lib/gcc,gcc/lib/install-tools} && # Build and install gcc wrapper script. @@ -65,10 +61,9 @@ # Run toolchain fixup and cleanup chmod +x fixup-toolchain.sh && -./fixup-toolchain.sh && -$CLEANUP "${CURSRC}" build-gcc +./fixup-toolchain.sh -[ $? -ne 0 ] && dienow +cleanup "${CURSRC}" build-gcc # Set up symlinks for distcc @@ -83,10 +78,9 @@ setupfor linux && # Install Linux kernel headers (for use by uClibc). make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${CROSS}" && -cd .. && -$CLEANUP linux +cd .. -[ $? -ne 0 ] && dienow +cleanup linux # Build and install uClibc @@ -105,10 +99,9 @@ make CROSS= headers KERNEL_HEADERS=/usr/include && $CC -Os -s -I include utils/readelf.c -o "${CROSS}/bin/${ARCH}-readelf" && $CC -Os -s -I ldso/include utils/ldd.c -o "${CROSS}/bin/${ARCH}-ldd" && -cd .. && -$CLEANUP uClibc +cd .. -[ $? -ne 0 ] && dienow +cleanup uClibc cat > "${CROSS}"/README << EOF && Cross compiler for $ARCH
--- a/host-tools.sh Sat Feb 16 23:23:11 2008 -0600 +++ b/host-tools.sh Thu Feb 21 04:47:54 2008 -0600 @@ -14,6 +14,21 @@ mkdir -p "${HOSTTOOLS}" || dienow +# Here are the utilities the build needs that this script doesn't +# build, but which me must instead use from the host system. + +# The first seven are from packages already in mini-native. +# The last six need to be added to toybox. (The build breaks if we use +# the busybox versions.) + +for i in ar as nm cc gcc make ld bzip2 cp find install od sort +do + [ ! -f "${HOSTTOOLS}/$i" ] && (ln -s `which $i` "${HOSTTOOLS}/$i" || dienow) +done + +# Yes this is an old version of busybox. We're gradually replacing busybox +# with toybox, one command at a time. + # Build busybox if [ -z "$(which busybox)" ] then @@ -29,10 +44,9 @@ do ln -s busybox "${HOSTTOOLS}"/$i || dienow done - cd .. && - $CLEANUP busybox + cd .. - [ $? -ne 0 ] && dienow + cleanup busybox fi # Build toybox @@ -43,12 +57,15 @@ make && make instlist && make install_flat PREFIX="${HOSTTOOLS}" && - cd .. && - $CLEANUP toybox + cd .. - [ $? -ne 0 ] && dienow + cleanup toybox fi +# This is optionally used by mini-native to accelerate native builds when +# running under qemu. It's not used to build mini-native, or to build +# the cross compiler. + # Build distcc if [ -z "$(which distcc)" ] then @@ -56,14 +73,13 @@ ./configure --with-included-popt && make -j "$CPUS" && cp distcc distccd "${HOSTTOOLS}" && - cd .. && - $CLEANUP distcc + cd .. - [ $? -ne 0 ] && dienow + cleanup distcc fi # As a temporary measure, build User Mode Linux and use _that_ to package -# the ext2 image to boot qemu with. +# the ext2 image to boot qemu with. (Replace this with toybox gene2fs.) if [ -z "$(which linux)" ] then @@ -81,21 +97,21 @@ make ARCH=um allnoconfig KCONFIG_ALLCONFIG=mini.conf && make -j "$CPUS" ARCH=um && cp linux "${HOSTTOOLS}" && - cd .. && - $CLEANUP linux + cd .. - [ $? -ne 0 ] && dienow + cleanup linux fi +# Everything after here is stuff we _could_ build, but currently don't. + # Build squashfs #setupfor squashfs #cd squashfs-tools && #make && #cp mksquashfs unsquashfs "${HOSTTOOLS}" && -#cd .. && -#$CLEANUP squashfs* +#cd .. # -#[ $? -ne 0 ] && dienow +#cleanup squashfs # we can't reliably build qemu because who knows what gcc version the host # has? so until qemu is fixed to build with an arbitrary c compiler, @@ -113,12 +129,8 @@ # ./configure --disable-gcc-check --disable-gfx-check --prefix="${CROSS}" && # make && # make install && -# cd .. && -# $CLEANUP qemu-* - -for i in ar as nm cc gcc make ld bzip2 cp find install od sort -do - [ ! -f "${HOSTTOOLS}/$i" ] && (ln -s `which $i` "${HOSTTOOLS}/$i" || dienow) -done +# cd .. +# +# cleanup qemu echo -e "\e[32mHost tools build complete.\e[0m"
--- a/include.sh Sat Feb 16 23:23:11 2008 -0600 +++ b/include.sh Thu Feb 21 04:47:54 2008 -0600 @@ -2,6 +2,16 @@ # Strip the version number off a tarball +function cleanup() +{ + if [ $? -ne 0 ] + then + dienow + else + rm -rf "$@" + fi +} + function noversion() { echo "$1" | sed -e 's/-*\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/\6/' @@ -317,7 +327,6 @@ [ $? -ne 0 ] && dienow -[ -z "$CLEANUP" ] && CLEANUP="rm -rf" [ -z "$CC" ] && CC=gcc if [ -z "$CPUS" ] then
--- a/mini-native.sh Sat Feb 16 23:23:11 2008 -0600 +++ b/mini-native.sh Thu Feb 21 04:47:54 2008 -0600 @@ -25,10 +25,9 @@ make ARCH="${KARCH}" allnoconfig KCONFIG_ALLCONFIG="${WORK}/miniconfig-linux" && make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" && cp "${KERNEL_PATH}" "${BUILD}/zImage-${ARCH}" && -cd .. && -$CLEANUP linux +cd .. -[ $? -ne 0 ] && dienow +cleanup linux # Build and install uClibc. (We could just copy the one from the compiler # toolchain, but this is cleaner.) @@ -41,10 +40,9 @@ all install_runtime install_dev utils && # utils_install wants to put stuff in usr/bin instead of bin. install -m 755 utils/{readelf,ldd,ldconfig} "${TOOLS}/bin" && -cd .. && -$CLEANUP uClibc +cd .. -[ $? -ne 0 ] && dienow +cleanup uClibc # Build and install busybox @@ -59,10 +57,9 @@ do ln -s busybox "${TOOLS}/bin/$i" || dienow done -cd .. && -$CLEANUP busybox +cd .. -[ $? -ne 0 ] && dienow +cleanup busybox if [ -z "${BUILD_SHORT}" ] then @@ -79,10 +76,9 @@ make -j $CPUS install && cd .. && mkdir -p "${TOOLS}/include" && -cp binutils/include/libiberty.h "${TOOLS}/include" && -$CLEANUP binutils build-binutils +cp binutils/include/libiberty.h "${TOOLS}/include" -[ $? -ne 0 ] && dienow +cleanup binutils build-binutils # Build and install native gcc, with c++ support this time. @@ -106,24 +102,20 @@ make -j $CPUS all-gcc && make -j $CPUS install-gcc && ln -s gcc "${TOOLS}/bin/cc" && -cd .. && -$CLEANUP gcc-core build-gcc +cd .. -[ $? -ne 0 ] && dienow +cleanup gcc-core build-gcc -# Move the gcc internal libraries and headers somewhere sane. +# Move the gcc internal libraries and headers somewhere sane, and +# build and install gcc wrapper script. mkdir -p "${TOOLS}"/gcc && mv "${TOOLS}"/lib/gcc/*/*/include "${TOOLS}"/gcc/include && mv "${TOOLS}"/lib/gcc/*/* "${TOOLS}"/gcc/lib && -$CLEANUP "${TOOLS}"/{lib/gcc,gcc/lib/install-tools} && - -# Build and install gcc wrapper script. - mv "${TOOLS}/bin/gcc" "${TOOLS}/bin/gcc-unwrapped" && "${ARCH}-gcc" "${TOP}"/sources/toys/gcc-uClibc.c -Os -s -o "${TOOLS}/bin/gcc" -[ $? -ne 0 ] && dienow +cleanup "${TOOLS}"/{lib/gcc,gcc/lib/install-tools} # Build and install make @@ -132,10 +124,9 @@ --host="${CROSS_TARGET}" && make -j $CPUS && make -j $CPUS install && -cd .. && -$CLEANUP make +cd .. -[ $? -ne 0 ] && dienow +cleanup make # Build and install bash. (Yes, this is an old version. I prefer it.) # I plan to replace it with toysh anyway. @@ -156,22 +147,20 @@ make install && # Make bash the default shell. ln -s bash "${TOOLS}/bin/sh" && -cd .. && -$CLEANUP bash +cd .. -[ $? -ne 0 ] && dienow +cleanup bash setupfor distcc ./configure --host="${ARCH}" --prefix="${TOOLS}" --with-included-popt && make -j $CPUS && make -j $CPUS install && -cd .. && -$CLEANUP distcc && mkdir -p "${TOOLS}/distcc" && ln -s ../bin/distcc "${TOOLS}/distcc/gcc" && ln -s ../bin/distcc "${TOOLS}/distcc/cc" +cd .. -[ $? -ne 0 ] && dienow +cleanup distcc # Put statically and dynamically linked hello world programs on there for # test purposes, and a qemu setup script.