Mercurial > hg > aboriginal
changeset 62:4125b672b00c
Get i686 cross-compiling to work like armv4l cross-compiling by lying to
the darn thing with different tuples. (The target is i686-unknown-linux-gnu
and the host is i686-walrus-linux-gnu.) Then it stops assuming it's not
cross compiling. (Remove residue from previous attempts to figure out how
to lie to gcc properly.)
Also make the work directory say $ARCH, so two architectures can build at
once in parallel.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 25 Dec 2006 19:05:11 -0500 |
parents | eb42ad9e8f81 |
children | 89cf9497824e |
files | include.sh mini-native.sh |
diffstat | 2 files changed, 17 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/include.sh Mon Dec 25 16:31:51 2006 -0500 +++ b/include.sh Mon Dec 25 19:05:11 2006 -0500 @@ -141,33 +141,6 @@ done } -# Yet more FSF brain damage: If your host and target are the same, obviously -# you can't be cross compiling. (Nevermind that one is glibc and the other is -# uClibc, or one toolchain may have TLS and the other doesn't...) -# Hit configure with a very large rock until it stops moving. -function force_cross_compile() -{ - (find "${CURSRC}" -name "configure" || dienow) | - xargs sed -i -e "s/\(cross_compiling=\)[a-z]*/\1yes/" || dienow -} - - -# Make sure we're _not_ using the host toolchain to build anything. -OLDPATH="$PATH" -function block_host_toolchain() -{ - mkdir -p "${WORK}/block" && - echo '#!/bin/sh\necho "Ran $0" >&2\nexit 1' > "${WORK}/block/die_die_die" && - chmod +x "${WORK}/block/die_die_die" && - for i in "${WORK}/block/"{cc,gcc,ld,nm,ar,as,ranlib,strip,objcopy,objdump,c++} - do - ln -s die_die_die "$i" || dienow - done && - export PATH="${CROSS}/bin:${WORK}/block:$OLDPATH" - - [ $? -ne 0 ] && dienow -} - # Setup umask 022 @@ -180,9 +153,8 @@ export SRCDIR="${SOURCES}/packages" export LINKDIR="${SOURCES}/build-links" export BUILD="${TOP}/build" -export WORK="${BUILD}/temp" export FROMSRC=../packages -mkdir -p "${SRCDIR}" "${WORK}" "${LINKDIR}" +mkdir -p "${SRCDIR}" "${LINKDIR}" # For bash: check the $PATH for new executables added after startup. set +h @@ -210,14 +182,21 @@ # Which platform are we building for? - export CROSS_HOST=`uname -m`-unknown-linux-gnu + export WORK="${BUILD}/temp-$ARCH" + mkdir -p "${WORK}" + # Say "unknown" in two different ways so it doesn't assume we're NOT + # cross compiling when the host and target are the same processor. (If host + # and target match, the binutils/gcc/make builds won't use the cross compiler + # during mini-native.sh, and the host compiler links binaries against the + # wrong libc.) + export CROSS_HOST=`uname -m`-walrus-linux-gnu export CROSS_TARGET=${ARCH}-unknown-linux-gnu # Read the relevant config file. source "${TOP}/sources/configs/${ARCH}" - # Add the cross compiler to the start of the path. + # Setup directories and add the cross compiler to the start of the path. export CROSS="${BUILD}/cross-compiler-$ARCH" export NATIVE="${BUILD}/mini-native-$ARCH"
--- a/mini-native.sh Mon Dec 25 16:31:51 2006 -0500 +++ b/mini-native.sh Mon Dec 25 19:05:11 2006 -0500 @@ -60,9 +60,10 @@ # Build and install native binutils setupfor binutils build-binutils -CC="${ARCH}"-gcc AR="${ARCH}"-ar "${CURSRC}/configure" --prefix="${TOOLS}" \ - --build="${CROSS_HOST}" --host=${CROSS_TARGET} --target=${CROSS_TARGET} \ - --disable-nls --disable-shared --disable-multilib $BINUTILS_FLAGS && +CC="${ARCH}-gcc" AR="${ARCH}-ar" "${CURSRC}/configure" --prefix="${TOOLS}" \ + --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \ + --disable-nls --disable-shared --disable-multilib --program-prefix= \ + $BINUTILS_FLAGS && make configure-host && make && make install && @@ -87,13 +88,12 @@ CC="${ARCH}-gcc" GCC_FOR_TARGET="${ARCH}-gcc" CC_FOR_TARGET="${ARCH}-gcc" \ AR="${ARCH}-ar" AR_FOR_TARGET="${ARCH}-ar" AS="${ARCH}-ar" LD="${ARCH}-ld" \ NM="${ARCH}-nm" NM_FOR_TARGET="${ARCH}-nm" \ - "${CURSRC}/configure" \ - --prefix="${TOOLS}" --disable-multilib \ + "${CURSRC}/configure" --prefix="${TOOLS}" --disable-multilib \ --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \ --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \ --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \ - --disable-libstdcxx-pch && -make all-gcc && + --disable-libstdcxx-pch --program-prefix="" && +make all-gcc && make install-gcc && ln -s gcc "${TOOLS}/bin/cc" && cd .. &&