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')
This commit is contained in:
Oliver Tappe 2013-06-14 16:04:26 +02:00
parent 9454a953cc
commit df69e209bb
2 changed files with 25 additions and 12 deletions

View File

@ -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!"

View File

@ -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 || {