Adjusted build_cross_tools_gcc4 and configure to be able to build PPC

build tools as well. The configure option --build-cross-tools-gcc4 has a
new parameter to specify the architecture.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15382 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-12-06 22:45:11 +00:00
parent e7a77b5b71
commit 20ab75e64c
2 changed files with 42 additions and 21 deletions

View File

@ -1,20 +1,21 @@
# parameters <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]
# parameters <machine> <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]
# get and check the parameters
if [ $# \< 2 ]; then
echo Usage: $0 '<haiku sourcedir> <buildtools dir> [ <haiku output dir> ]' >&2
if [ $# -lt 3 ]; then
echo Usage: $0 '<machine> <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]' >&2
exit 1
fi
haikuSourceDir=$1
buildToolsDir=$2
haikuMachine=$1
haikuSourceDir=$2
buildToolsDir=$3
if [ $(uname) = "FreeBSD" ]; then make="gmake"; else make="make"; fi
if [ $# \< 3 ]; then
if [ $# -lt 4 ]; then
haikuOutputDir=$haikuSourceDir/generated
else
haikuOutputDir=$3
haikuOutputDir=$4
fi
if [ ! -d $haikuSourceDir ]; then
@ -72,12 +73,13 @@ rm -rf $installDir $objDir
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \
$tmpLibDir || exit 1
mkdir -p $installDir/lib/gcc/i586-pc-haiku/$gccVersion
mkdir -p $installDir/lib/gcc/$haikuMachine/$gccVersion
# build binutils
cd $binutilsObjDir
CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \
--prefix=$installDir --target=i586-pc-haiku --disable-nls \
--prefix=$installDir --target=$haikuMachine --disable-nls \
--disable-shared || exit 1
$make || exit 1
$make install || exit 1
@ -108,7 +110,7 @@ copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix
# configure gcc
cd $gccObjDir
CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure --prefix=$installDir \
--target=i586-pc-haiku --disable-nls --disable-shared \
--target=$haikuMachine --disable-nls --disable-shared \
--enable-languages=c,c++ --with-headers=$tmpIncludeDir \
--with-libs=$tmpLibDir || exit 1
@ -128,7 +130,7 @@ $make install || {
# remove the system headers from the installation dir
# Only the ones from the source tree should be used.
sysIncludeDir=$installDir/i586-pc-haiku/sys-include
sysIncludeDir=$installDir/$haikuMachine/sys-include
rm -rf $sysIncludeDir/be $sysIncludeDir/posix
# remove the objects dir

39
configure vendored
View File

@ -28,11 +28,13 @@ options:
They will be compiled and placed in the output
directory under "cross-tools". The HAIKU_* tools
variables will be set accordingly.
--build-cross-tools-gcc4 <build tools dir>
--build-cross-tools-gcc4 <arch> <build tools dir>
Like "--build-cross-tools" just that gcc 4 will
be used for cross-compilation. Note, that the
resulting Haiku installation built with gcc 4
will not be binary compatible with BeOS R5.
<arch> specifies the target architecture, either
"x86" or "ppc".
--target=TARGET Select build target platform. [default=${target}]
valid targets=r5,bone,dano,haiku
--include-gpl-addons Include GPL licensed add-ons.
@ -61,12 +63,24 @@ EOF
#
assertparam()
{
if [ $2 \< 2 ]; then
if [ $2 -lt 2 ]; then
echo $0: \`$1\': Parameter expected.
exit 1
fi
}
# assertparams
#
# Checks whether at least a certain number of parameters is left.
#
assertparams()
{
if [ $3 -le $2 ]; then
echo $0: \`$1\': Not enough parameters.
exit 1
fi
}
# standard_gcc_settings
#
# Sets the variables for a GCC platform.
@ -165,8 +179,6 @@ cd $currentDir
platform=`uname`
haikuGCCVersion=
haikuGCCMachine=i586-pc-beos
# TODO: Should be specifiable via parameters, when configure builds the
# cross tools.
haikuStaticLibStdCxx=
haikuSharedLibStdCxx=
haikuStaticLibSupCxx=
@ -180,6 +192,7 @@ target=haiku
crossToolsPrefix=
buildCrossTools=
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
buildCrossToolsMachine=
set_default_value HAIKU_AR ar
set_default_value HAIKU_CC gcc
@ -195,7 +208,7 @@ set_default_value HAIKU_UNARFLAGS x
# parse parameters
#
while [ $# \> 0 ] ; do
while [ $# -gt 0 ] ; do
case "$1" in
--include-gpl-addons) include_gpl_addons=1; shift 1;;
--floppy) assertparam "$1" $#; floppy=$2; shift 2;;
@ -203,10 +216,16 @@ while [ $# \> 0 ] ; do
--target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;;
--cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;;
--build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;;
--build-cross-tools-gcc4) assertparam "$1" $#; buildCrossTools=$2;
--build-cross-tools-gcc4) assertparams "$1" 2 $#; buildCrossTools=$3;
buildCrossToolsScript="${buildCrossToolsScript}_gcc4";
haikuGCCMachine=i586-pc-haiku;
shift 2;;
case "$2" in
x86) haikuGCCMachine=i586-pc-haiku;;
ppc) haikuGCCMachine=powerpc-apple-haiku;;
*) echo "Unsupported target architecture: $2"
exit 1;;
esac
buildCrossToolsMachine=$haikuGCCMachine
shift 3;;
--help | -h) usage; exit 0;;
*) echo Invalid argument: \`$1\'; exit 1;;
esac
@ -252,8 +271,8 @@ mkdir -p $buildOutputDir || exit 1
# build cross tools from sources
if [ -n "$buildCrossTools" ]; then
"$buildCrossToolsScript" "$sourceDir" "$buildCrossTools" \
$outputDir || exit 1
"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
"$buildCrossTools" $outputDir || exit 1
crossToolsPrefix=$outputDir/cross-tools/bin/${haikuGCCMachine}-
fi