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
+11 -7
View File
@@ -20,6 +20,11 @@ additionalMakeArgs=$*
# additional flags for the binutils build. Should there ever be any other # additional flags for the binutils build. Should there ever be any other
# flags than -jN, we need to handle this differently. # 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 if [ ! -d $haikuSourceDir ]; then
echo "ERROR: No such directory: \"$haikuSourceDir\"" >&2 echo "ERROR: No such directory: \"$haikuSourceDir\"" >&2
@@ -101,8 +106,8 @@ fi
# build binutils # build binutils
cd $binutilsObjDir cd $binutilsObjDir
CFLAGS="-O2" CXXFLAGS="-O2" $buildToolsDir/binutils/configure \ CFLAGS="-O2" CXXFLAGS="-O2" $buildToolsDir/binutils/configure \
--prefix=$installDir --target=i586-pc-haiku --disable-nls \ --prefix=$installDir $buildHostSpec --target=i586-pc-haiku \
--enable-shared=yes --disable-werror || exit 1 --disable-nls --enable-shared=yes --disable-werror || exit 1
make $additionalMakeArgs || exit 1 make $additionalMakeArgs || exit 1
make $additionalMakeArgs install || exit 1 make $additionalMakeArgs install || exit 1
@@ -146,10 +151,10 @@ case `uname` in
;; ;;
esac esac
CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" $buildToolsDir/gcc/configure \ CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" $buildToolsDir/gcc/configure \
--prefix=$installDir \ --prefix=$installDir $buildHostSpec --target=i586-pc-haiku \
--target=i586-pc-haiku --disable-nls --enable-shared=yes \ --disable-nls --enable-shared=yes --enable-languages=c,c++ \
--enable-languages=c,c++ --with-headers=$tmpIncludeDir \ --with-headers=$tmpIncludeDir --with-libs=$tmpLibDir \
--with-libs=$tmpLibDir || exit 1 || exit 1
unset CC unset CC
# hack the Makefile to avoid trouble with stuff we don't need anyway # 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!" echo "binutils and gcc for cross compilation have been built successfully!"
+14 -5
View File
@@ -50,6 +50,12 @@ arm-*)
;; ;;
esac 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 if [ ! -d $haikuSourceDir ]; then
echo "No such directory: \"$haikuSourceDir\"" >&2 echo "No such directory: \"$haikuSourceDir\"" >&2
exit 1 exit 1
@@ -134,8 +140,9 @@ export LC_ALL=POSIX
# build binutils # build binutils
cd $binutilsObjDir cd $binutilsObjDir
CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \ CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \
--prefix=$installDir --target=$haikuMachine --disable-nls \ --prefix=$installDir $buildHostSpec --target=$haikuMachine \
--disable-shared --disable-werror $binutilsConfigureArgs || exit 1 --disable-nls --disable-shared --disable-werror $binutilsConfigureArgs \
|| exit 1
$MAKE $additionalMakeArgs || exit 1 $MAKE $additionalMakeArgs || exit 1
$MAKE $additionalMakeArgs install || exit 1 $MAKE $additionalMakeArgs install || exit 1
@@ -191,11 +198,13 @@ copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix
# configure gcc # configure gcc
cd $gccObjDir cd $gccObjDir
CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure --prefix=$installDir \ CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure \
--target=$haikuMachine --disable-nls --disable-shared --with-system-zlib \ --prefix=$installDir $buildHostSpec --target=$haikuMachine \
--disable-nls --disable-shared --with-system-zlib \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \ --enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-headers=$tmpIncludeDir --with-libs=$tmpLibDir \ --with-headers=$tmpIncludeDir --with-libs=$tmpLibDir \
$gccConfigureArgs || exit 1 $gccConfigureArgs \
|| exit 1
# make gcc # make gcc
$MAKE $additionalMakeArgs || { $MAKE $additionalMakeArgs || {