Files
haikuports/sys-devel/gcc/gcc-4.7.3_2013_08_03.recipe
Ingo Weinhold bc4b3458b2 Add recipes for binutils/gcc 4
The directory layout has changed similarly to that of the gcc 2 couple,
i.e. we install in develop/tools[/<arch>] instead of separate
subdirectories, so gcc finds the matching gas and ld.

Only tested the secondary architecture build so far.
2013-08-11 19:02:06 +02:00

131 lines
3.4 KiB
Plaintext

SUMMARY="C/C++ cross-compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="Standard compiler for x86 platform."
HOMEPAGE="http://gcc.gnu.org"
LICENSE="
GNU GPL v2
GNU LGPL v2
"
COPYRIGHT="1988-2013 Free Software Foundation, Inc."
SRC_URI="
git+file://$portBaseDir/../binutils/download/BuildtoolsPM.git#7a87db2a172a406b79540188a23e52491ad3b741
git+git://github.com/haiku/BuildtoolsPM.git#7a87db2a172a406b79540188a23e52491ad3b741
"
REVISION="1"
ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
# x86_gcc2 is fine as primary target architecture as long as we're building
# for a different secondary architecture.
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
gcc$secondaryArchSuffix = $portVersion compat >= 4
cmd:c++$secondaryArchSuffix = $portVersion compat >= 4
cmd:cc$secondaryArchSuffix = $portVersion compat >= 4
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 4
cmd:g++$secondaryArchSuffix = $portVersion compat >= 4
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 4
cmd:gcc_4.7.3$secondaryArchSuffix = $portVersion compat >= 4
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES="
haiku$secondaryArchSuffix >= $haikuVersion
"
BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
cmd:autoconf
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:makeinfo
cmd:sed
cmd:strip
cmd:tar
"
SOURCE_DIR="gcc-$portVersion/gcc"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
BUILD()
{
rm -rf $objectsDir
# Touch some files generated by bison, so that bison won't run to update
# them. Fixes issues with newer bison versions.
# And while at it, touch gperf target, too (as gperf may not be installed).
(cd $sourceDir/gcc; touch c-parse.c c-parse.h cexp.c cp/parse.c \
cp/parse.h c-gperf.h)
mkdir -p $objectsDir
cd $objectsDir
local additionalConfigureFlags
if [ -n "$secondaryArchSuffix" ]; then
additionalConfigureFlags="\
--with-hybrid-secondary=${effectiveTargetArchitecture}"
fi
CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" "$sourceDir/configure" \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir \
--disable-nls --enable-shared \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -c 7-) \
$additionalConfigureFlags
make $jobArgs
}
INSTALL()
{
cd $objectsDir
make install-strip
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in gmp libquadmath mpc mpfr; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Strip #################################################
echo "Strip debug info"
cd $installDir
strip --strip-debug bin/*
for f in cc1 cc1plus collect2 lto1; do
strip --strip-debug lib/gcc/$effectiveTargetMachineTriple/*/$f
done
strip --strip-debug lib/*.a
### Symlinks ##############################################
echo "Creating required symlinks"
# make all tools available via default paths
mkdir -p $binDir
for f in c++ cpp g++ gcc gcov; do
symlinkRelative -sfn $installDir/bin/$f $binDir
done
### Cleanup ###############################################
echo "Cleanup"
rm -rf $installDir/info
rm -rf $installDir/share
}