From df69e209bbacd07fdfea9d9efcfc8e1c0dfedaa0 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 14 Jun 2013 16:04:26 +0200 Subject: [PATCH] Fix #7824: failure to build a cross-compiler on Haiku. * force creation of a cross-compiler for both gcc2 and gcc4 when building on Haiku (by suffixing the build and host machine with '_buildhost') --- build/scripts/build_cross_tools | 18 +++++++++++------- build/scripts/build_cross_tools_gcc4 | 19 ++++++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/build/scripts/build_cross_tools b/build/scripts/build_cross_tools index e637c489ba..b35bd8107d 100755 --- a/build/scripts/build_cross_tools +++ b/build/scripts/build_cross_tools @@ -20,6 +20,11 @@ additionalMakeArgs=$* # additional flags for the binutils build. Should there ever be any other # flags than -jN, we need to handle this differently. +if [ `uname -o` = 'Haiku' ]; then + # force cross-build if building on Haiku: + buildhostMachine=i586-pc-haiku_buildhost + buildHostSpec="--build=$buildhostMachine --host=$buildhostMachine" +fi if [ ! -d $haikuSourceDir ]; then echo "ERROR: No such directory: \"$haikuSourceDir\"" >&2 @@ -101,8 +106,8 @@ fi # build binutils cd $binutilsObjDir CFLAGS="-O2" CXXFLAGS="-O2" $buildToolsDir/binutils/configure \ - --prefix=$installDir --target=i586-pc-haiku --disable-nls \ - --enable-shared=yes --disable-werror || exit 1 + --prefix=$installDir $buildHostSpec --target=i586-pc-haiku \ + --disable-nls --enable-shared=yes --disable-werror || exit 1 make $additionalMakeArgs || exit 1 make $additionalMakeArgs install || exit 1 @@ -146,10 +151,10 @@ case `uname` in ;; esac CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" $buildToolsDir/gcc/configure \ - --prefix=$installDir \ - --target=i586-pc-haiku --disable-nls --enable-shared=yes \ - --enable-languages=c,c++ --with-headers=$tmpIncludeDir \ - --with-libs=$tmpLibDir || exit 1 + --prefix=$installDir $buildHostSpec --target=i586-pc-haiku \ + --disable-nls --enable-shared=yes --enable-languages=c,c++ \ + --with-headers=$tmpIncludeDir --with-libs=$tmpLibDir \ + || exit 1 unset CC # hack the Makefile to avoid trouble with stuff we don't need anyway @@ -192,4 +197,3 @@ rm -rf $objDir echo "binutils and gcc for cross compilation have been built successfully!" - diff --git a/build/scripts/build_cross_tools_gcc4 b/build/scripts/build_cross_tools_gcc4 index 07c68eadc6..cfd4705e76 100755 --- a/build/scripts/build_cross_tools_gcc4 +++ b/build/scripts/build_cross_tools_gcc4 @@ -50,6 +50,12 @@ arm-*) ;; esac +if [ `uname -o` = 'Haiku' ]; then + # force cross-build if building on Haiku: + buildhostMachine=${haikuMachine}_buildhost + buildHostSpec="--build=$buildhostMachine --host=$buildhostMachine" +fi + if [ ! -d $haikuSourceDir ]; then echo "No such directory: \"$haikuSourceDir\"" >&2 exit 1 @@ -134,8 +140,9 @@ export LC_ALL=POSIX # build binutils cd $binutilsObjDir CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \ - --prefix=$installDir --target=$haikuMachine --disable-nls \ - --disable-shared --disable-werror $binutilsConfigureArgs || exit 1 + --prefix=$installDir $buildHostSpec --target=$haikuMachine \ + --disable-nls --disable-shared --disable-werror $binutilsConfigureArgs \ + || exit 1 $MAKE $additionalMakeArgs || exit 1 $MAKE $additionalMakeArgs install || exit 1 @@ -191,11 +198,13 @@ copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix # configure gcc cd $gccObjDir -CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure --prefix=$installDir \ - --target=$haikuMachine --disable-nls --disable-shared --with-system-zlib \ +CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure \ + --prefix=$installDir $buildHostSpec --target=$haikuMachine \ + --disable-nls --disable-shared --with-system-zlib \ --enable-languages=c,c++ --enable-lto --enable-frame-pointer \ --with-headers=$tmpIncludeDir --with-libs=$tmpLibDir \ - $gccConfigureArgs || exit 1 + $gccConfigureArgs \ + || exit 1 # make gcc $MAKE $additionalMakeArgs || {