mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-03 05:28:53 +02:00
HaikuPorter now does not care what is in ARCHITECTURES when building for a SECONDARY_ARCHITECTURE.
157 lines
4.2 KiB
Bash
157 lines
4.2 KiB
Bash
SUMMARY="C/C++ cross-compiler for target ${effectiveTargetMachineTriple}"
|
|
DESCRIPTION="The standard compiler for the ${effectiveTargetMachineTriple} \
|
|
platform."
|
|
HOMEPAGE="http://gcc.gnu.org"
|
|
srcGitRev="3ad9ac2317f63b65937473c4fbe37c9e93e3a116"
|
|
SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
|
|
CHECKSUM_SHA256="85499c650421b68f9830d3fb2ddfafb8789a3e1ffce75e8dd27aaed678135df0"
|
|
SOURCE_FILENAME="$portVersionedName.tar.gz"
|
|
REVISION="3"
|
|
LICENSE="
|
|
GNU GPL v2
|
|
GNU LGPL v2
|
|
"
|
|
COPYRIGHT="1988-2013 Free Software Foundation, Inc."
|
|
PATCHES="gcc-4.8.3_2014_05_28.patchset"
|
|
|
|
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"
|
|
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.8.3$secondaryArchSuffix = $portVersion compat >= 4
|
|
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 4
|
|
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
|
|
"
|
|
REQUIRES="
|
|
haiku$secondaryArchSuffix
|
|
cmd:as$secondaryArchSuffix
|
|
"
|
|
BUILD_REQUIRES="
|
|
"
|
|
BUILD_PREREQUIRES="
|
|
haiku${secondaryArchSuffix}_devel
|
|
cmd:autoconf
|
|
cmd:awk
|
|
cmd:find
|
|
cmd:flex
|
|
cmd:gcc$secondaryArchSuffix
|
|
cmd:ld$secondaryArchSuffix
|
|
cmd:make
|
|
cmd:makeinfo
|
|
cmd:sed
|
|
cmd:strip
|
|
cmd:tar
|
|
cmd:xargs
|
|
"
|
|
|
|
SOURCE_DIR="buildtools-$srcGitRev/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
|
|
if [ $effectiveTargetArchitecture == x86_64 ]; then
|
|
# disable multilib support, as x86_64 by default tries to build the
|
|
# 32-bit libraries, too, which fails as no 32-bit libroot is available
|
|
additionalConfigureFlags+=" --disable-multilib"
|
|
fi
|
|
|
|
CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" "$sourceDir/configure" \
|
|
--build=$effectiveTargetMachineTriple \
|
|
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
|
|
--docdir=$docDir --enable-threads=posix \
|
|
--disable-nls --enable-shared --with-gnu-ld \
|
|
--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
|
|
|
|
### Disable ASLR ##########################################
|
|
|
|
echo "Add SYS:ENV attribute to disable ASLR"
|
|
|
|
cd $installDir
|
|
for f in bin/*; do
|
|
if [ -r "$f" ]; then
|
|
addattr SYS:ENV DISABLE_ASLR=1 $f
|
|
fi
|
|
done
|
|
for f in cc1 cc1plus collect2 lto1; do
|
|
addattr SYS:ENV DISABLE_ASLR=1 \
|
|
lib/gcc/$effectiveTargetMachineTriple/*/$f
|
|
done
|
|
|
|
### Symlinks ##############################################
|
|
|
|
echo "Creating required symlinks"
|
|
|
|
# create missing cc symlink
|
|
ln -sf gcc $installDir/bin/cc
|
|
|
|
# make all tools available via default paths
|
|
mkdir -p $binDir
|
|
for f in c++ cc cpp g++ gcc gcov; do
|
|
symlinkRelative -sfn $installDir/bin/$f $binDir
|
|
done
|
|
|
|
### Cleanup ###############################################
|
|
|
|
echo "Cleanup"
|
|
rm -rf $installDir/info
|
|
rm -rf $installDir/share
|
|
}
|