mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
* Added build_cross_tools_gcc4 script which builds gcc 4 and binutils
from the sources. Added respective configure option --build-cross-tools-gcc4. * Fixed running "configure --build-cross-tools" from another directory than the source dir. The parameter to the script was missing and thus the tools were created in <sources>/generated. * Removed stdc++ lib header dir ".../debug". One is supposed to include <debug/...> to get the debug headers. * The stdc++ lib header dirs are now listed one per line in the generated BuildConfig. This works around the 512 bytes jam line length limit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15020 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6b95c59bd8
commit
29ef597dc6
136
build/scripts/build_cross_tools_gcc4
Executable file
136
build/scripts/build_cross_tools_gcc4
Executable file
@ -0,0 +1,136 @@
|
||||
# parameters <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
|
||||
exit 1
|
||||
fi
|
||||
|
||||
haikuSourceDir=$1
|
||||
buildToolsDir=$2
|
||||
|
||||
if [ $# \< 3 ]; then
|
||||
haikuOutputDir=$haikuSourceDir/generated
|
||||
else
|
||||
haikuOutputDir=$3
|
||||
fi
|
||||
|
||||
if [ ! -d $haikuSourceDir ]; then
|
||||
echo "No such directory: \"$haikuSourceDir\"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $buildToolsDir ]; then
|
||||
echo "No such directory: \"$buildToolsDir\"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# create the output dir
|
||||
mkdir -p $haikuOutputDir || exit 1
|
||||
|
||||
|
||||
# get absolute paths
|
||||
currentDir=$(pwd)
|
||||
|
||||
cd $haikuSourceDir
|
||||
haikuSourceDir=$(pwd)
|
||||
cd $currentDir
|
||||
|
||||
cd $buildToolsDir
|
||||
buildToolsDir=$(pwd)
|
||||
cd $currentDir
|
||||
|
||||
cd $haikuOutputDir
|
||||
haikuOutputDir=$(pwd)
|
||||
|
||||
binutilsSourceDir=$buildToolsDir/binutils
|
||||
gccSourceDir=$buildToolsDir/gcc4
|
||||
|
||||
|
||||
# get gcc version
|
||||
gccVersion=$(grep "const char version_string" $gccSourceDir/gcc/version.c \
|
||||
| sed -e 's@.*"\(.*\)".*@\1@')
|
||||
|
||||
if [ -z "$gccVersion" ]; then
|
||||
echo "Failed to find out gcc version." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# create the object and installation directories for the cross compilation tools
|
||||
installDir=$haikuOutputDir/cross-tools
|
||||
objDir=$haikuOutputDir/cross-tools-build
|
||||
binutilsObjDir=$objDir/binutils
|
||||
gccObjDir=$objDir/gcc
|
||||
tmpIncludeDir=$objDir/sysincludes
|
||||
tmpLibDir=$objDir/syslibs
|
||||
|
||||
rm -rf $installDir $objDir
|
||||
|
||||
mkdir -p $installDir $objDir $binutilsObjDir $gccObjDir $tmpIncludeDir \
|
||||
$tmpLibDir || exit 1
|
||||
mkdir -p $installDir/lib/gcc/i586-pc-beos/$gccVersion
|
||||
|
||||
# build binutils
|
||||
cd $binutilsObjDir
|
||||
CFLAGS="-O2" CXXFLAGS="-O2" $binutilsSourceDir/configure \
|
||||
--prefix=$installDir --target=i586-pc-beos --disable-nls \
|
||||
--enable-shared=yes || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
|
||||
export PATH=$PATH:$installDir/bin
|
||||
|
||||
|
||||
# build gcc
|
||||
|
||||
# prepare the include files
|
||||
copy_headers()
|
||||
{
|
||||
sourceDir=$1
|
||||
targetDir=$2
|
||||
|
||||
headers="$(find $sourceDir -name \*\.h | grep -v /.svn)"
|
||||
headers="$(echo $headers | sed -e s@$sourceDir/@@g)"
|
||||
for f in $headers; do
|
||||
headerTargetDir=$targetDir/$(dirname $f)
|
||||
mkdir -p $headerTargetDir
|
||||
cp $sourceDir/$f $headerTargetDir
|
||||
done
|
||||
}
|
||||
|
||||
copy_headers $haikuSourceDir/headers/os $tmpIncludeDir/be
|
||||
copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix
|
||||
|
||||
# configure gcc
|
||||
cd $gccObjDir
|
||||
CFLAGS="-O2" CXXFLAGS="-O2" $gccSourceDir/configure --prefix=$installDir \
|
||||
--target=i586-pc-beos --disable-nls --enable-shared=yes \
|
||||
--enable-languages=c,c++ --with-headers=$tmpIncludeDir \
|
||||
--with-libs=$tmpLibDir || exit 1
|
||||
|
||||
# make gcc
|
||||
make || {
|
||||
echo "ERROR: Building gcc failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# install gcc
|
||||
make install || {
|
||||
echo "ERROR: Installing the cross compiler failed." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# cleanup
|
||||
|
||||
# remove the system headers from the installation dir
|
||||
# Only the ones from the source tree should be used.
|
||||
sysIncludeDir=$installDir/i586-pc-beos/sys-include
|
||||
rm -rf $sysIncludeDir/be $sysIncludeDir/posix
|
||||
|
||||
# remove the objects dir
|
||||
rm -rf $objDir
|
||||
|
||||
|
||||
echo "binutils and gcc for cross compilation have been built successfully!"
|
20
configure
vendored
20
configure
vendored
@ -28,6 +28,11 @@ 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>
|
||||
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.
|
||||
--target=TARGET Select build target platform. [default=${target}]
|
||||
valid targets=r5,bone,dano,haiku
|
||||
--include-gpl-addons Include GPL licensed add-ons.
|
||||
@ -89,8 +94,11 @@ standard_gcc_settings()
|
||||
haikuSharedLibSupCxx=`$HAIKU_CC -print-file-name=libsupc++.so`
|
||||
local headers=$gccdir/../../../../include/c++/$haikuGCCVersion
|
||||
haikuCxxHeadersDir=$headers
|
||||
for d in $haikuGCCMachine backward ext debug; do
|
||||
haikuCxxHeadersDir="$haikuCxxHeadersDir $headers/$d"
|
||||
for d in $haikuGCCMachine backward ext; do
|
||||
# Note: We need the line break, otherwise the line might become
|
||||
# too long for jam (512 bytes max).
|
||||
haikuCxxHeadersDir="$haikuCxxHeadersDir
|
||||
$headers/$d"
|
||||
done
|
||||
|
||||
if [ $haikuStaticLibStdCxx = libstdc++.a ]; then
|
||||
@ -168,6 +176,7 @@ include_gpl_addons=0
|
||||
target=haiku
|
||||
crossToolsPrefix=
|
||||
buildCrossTools=
|
||||
buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
|
||||
|
||||
set_default_value HAIKU_AR ar
|
||||
set_default_value HAIKU_CC gcc
|
||||
@ -191,6 +200,9 @@ 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;
|
||||
buildCrossToolsScript="${buildCrossToolsScript}_gcc4";
|
||||
shift 2;;
|
||||
--help | -h) usage; exit 0;;
|
||||
*) echo Invalid argument: \`$1\'; exit 1;;
|
||||
esac
|
||||
@ -236,8 +248,8 @@ mkdir -p $buildOutputDir || exit 1
|
||||
|
||||
# build cross tools from sources
|
||||
if [ -n "$buildCrossTools" ]; then
|
||||
"$sourceDir/build/scripts/build_cross_tools" "$sourceDir" \
|
||||
"$buildCrossTools" || exit 1
|
||||
"$buildCrossToolsScript" "$sourceDir" "$buildCrossTools" \
|
||||
$outputDir || exit 1
|
||||
crossToolsPrefix=$outputDir/cross-tools/bin/i586-pc-beos-
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user