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:
@@ -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
|
# get and check the parameters
|
||||||
if [ $# \< 2 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
echo Usage: $0 '<haiku sourcedir> <buildtools dir> [ <haiku output dir> ]' >&2
|
echo Usage: $0 '<machine> <haiku sourcedir> <buildtools dir> [ <haiku output dir> ]' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
haikuSourceDir=$1
|
haikuMachine=$1
|
||||||
buildToolsDir=$2
|
haikuSourceDir=$2
|
||||||
|
buildToolsDir=$3
|
||||||
|
|
||||||
if [ $(uname) = "FreeBSD" ]; then make="gmake"; else make="make"; fi
|
if [ $(uname) = "FreeBSD" ]; then make="gmake"; else make="make"; fi
|
||||||
|
|
||||||
if [ $# \< 3 ]; then
|
if [ $# -lt 4 ]; then
|
||||||
haikuOutputDir=$haikuSourceDir/generated
|
haikuOutputDir=$haikuSourceDir/generated
|
||||||
else
|
else
|
||||||
haikuOutputDir=$3
|
haikuOutputDir=$4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $haikuSourceDir ]; then
|
if [ ! -d $haikuSourceDir ]; then
|
||||||
@@ -72,12 +73,13 @@ rm -rf $installDir $objDir
|
|||||||
|
|
||||||
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \
|
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \
|
||||||
$tmpLibDir || exit 1
|
$tmpLibDir || exit 1
|
||||||
mkdir -p $installDir/lib/gcc/i586-pc-haiku/$gccVersion
|
mkdir -p $installDir/lib/gcc/$haikuMachine/$gccVersion
|
||||||
|
|
||||||
|
|
||||||
# build binutils
|
# build binutils
|
||||||
cd $binutilsObjDir
|
cd $binutilsObjDir
|
||||||
CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \
|
CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \
|
||||||
--prefix=$installDir --target=i586-pc-haiku --disable-nls \
|
--prefix=$installDir --target=$haikuMachine --disable-nls \
|
||||||
--disable-shared || exit 1
|
--disable-shared || exit 1
|
||||||
$make || exit 1
|
$make || exit 1
|
||||||
$make install || exit 1
|
$make install || exit 1
|
||||||
@@ -108,7 +110,7 @@ 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 --prefix=$installDir \
|
||||||
--target=i586-pc-haiku --disable-nls --disable-shared \
|
--target=$haikuMachine --disable-nls --disable-shared \
|
||||||
--enable-languages=c,c++ --with-headers=$tmpIncludeDir \
|
--enable-languages=c,c++ --with-headers=$tmpIncludeDir \
|
||||||
--with-libs=$tmpLibDir || exit 1
|
--with-libs=$tmpLibDir || exit 1
|
||||||
|
|
||||||
@@ -128,7 +130,7 @@ $make install || {
|
|||||||
|
|
||||||
# remove the system headers from the installation dir
|
# remove the system headers from the installation dir
|
||||||
# Only the ones from the source tree should be used.
|
# 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
|
rm -rf $sysIncludeDir/be $sysIncludeDir/posix
|
||||||
|
|
||||||
# remove the objects dir
|
# remove the objects dir
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ options:
|
|||||||
They will be compiled and placed in the output
|
They will be compiled and placed in the output
|
||||||
directory under "cross-tools". The HAIKU_* tools
|
directory under "cross-tools". The HAIKU_* tools
|
||||||
variables will be set accordingly.
|
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
|
Like "--build-cross-tools" just that gcc 4 will
|
||||||
be used for cross-compilation. Note, that the
|
be used for cross-compilation. Note, that the
|
||||||
resulting Haiku installation built with gcc 4
|
resulting Haiku installation built with gcc 4
|
||||||
will not be binary compatible with BeOS R5.
|
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}]
|
--target=TARGET Select build target platform. [default=${target}]
|
||||||
valid targets=r5,bone,dano,haiku
|
valid targets=r5,bone,dano,haiku
|
||||||
--include-gpl-addons Include GPL licensed add-ons.
|
--include-gpl-addons Include GPL licensed add-ons.
|
||||||
@@ -61,12 +63,24 @@ EOF
|
|||||||
#
|
#
|
||||||
assertparam()
|
assertparam()
|
||||||
{
|
{
|
||||||
if [ $2 \< 2 ]; then
|
if [ $2 -lt 2 ]; then
|
||||||
echo $0: \`$1\': Parameter expected.
|
echo $0: \`$1\': Parameter expected.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# standard_gcc_settings
|
||||||
#
|
#
|
||||||
# Sets the variables for a GCC platform.
|
# Sets the variables for a GCC platform.
|
||||||
@@ -165,8 +179,6 @@ cd $currentDir
|
|||||||
platform=`uname`
|
platform=`uname`
|
||||||
haikuGCCVersion=
|
haikuGCCVersion=
|
||||||
haikuGCCMachine=i586-pc-beos
|
haikuGCCMachine=i586-pc-beos
|
||||||
# TODO: Should be specifiable via parameters, when configure builds the
|
|
||||||
# cross tools.
|
|
||||||
haikuStaticLibStdCxx=
|
haikuStaticLibStdCxx=
|
||||||
haikuSharedLibStdCxx=
|
haikuSharedLibStdCxx=
|
||||||
haikuStaticLibSupCxx=
|
haikuStaticLibSupCxx=
|
||||||
@@ -180,6 +192,7 @@ target=haiku
|
|||||||
crossToolsPrefix=
|
crossToolsPrefix=
|
||||||
buildCrossTools=
|
buildCrossTools=
|
||||||
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
||||||
|
buildCrossToolsMachine=
|
||||||
|
|
||||||
set_default_value HAIKU_AR ar
|
set_default_value HAIKU_AR ar
|
||||||
set_default_value HAIKU_CC gcc
|
set_default_value HAIKU_CC gcc
|
||||||
@@ -195,7 +208,7 @@ set_default_value HAIKU_UNARFLAGS x
|
|||||||
|
|
||||||
# parse parameters
|
# parse parameters
|
||||||
#
|
#
|
||||||
while [ $# \> 0 ] ; do
|
while [ $# -gt 0 ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--include-gpl-addons) include_gpl_addons=1; shift 1;;
|
--include-gpl-addons) include_gpl_addons=1; shift 1;;
|
||||||
--floppy) assertparam "$1" $#; floppy=$2; shift 2;;
|
--floppy) assertparam "$1" $#; floppy=$2; shift 2;;
|
||||||
@@ -203,10 +216,16 @@ while [ $# \> 0 ] ; do
|
|||||||
--target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;;
|
--target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;;
|
||||||
--cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;;
|
--cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;;
|
||||||
--build-cross-tools) assertparam "$1" $#; buildCrossTools=$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";
|
buildCrossToolsScript="${buildCrossToolsScript}_gcc4";
|
||||||
haikuGCCMachine=i586-pc-haiku;
|
case "$2" in
|
||||||
shift 2;;
|
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;;
|
--help | -h) usage; exit 0;;
|
||||||
*) echo Invalid argument: \`$1\'; exit 1;;
|
*) echo Invalid argument: \`$1\'; exit 1;;
|
||||||
esac
|
esac
|
||||||
@@ -252,8 +271,8 @@ mkdir -p $buildOutputDir || exit 1
|
|||||||
|
|
||||||
# build cross tools from sources
|
# build cross tools from sources
|
||||||
if [ -n "$buildCrossTools" ]; then
|
if [ -n "$buildCrossTools" ]; then
|
||||||
"$buildCrossToolsScript" "$sourceDir" "$buildCrossTools" \
|
"$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \
|
||||||
$outputDir || exit 1
|
"$buildCrossTools" $outputDir || exit 1
|
||||||
crossToolsPrefix=$outputDir/cross-tools/bin/${haikuGCCMachine}-
|
crossToolsPrefix=$outputDir/cross-tools/bin/${haikuGCCMachine}-
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user