gcc: remove outdated recipes.

This commit is contained in:
Adrien Destugues
2018-10-12 20:15:20 +02:00
parent f7d7002611
commit 6ad8a8a7e9
25 changed files with 0 additions and 29442 deletions

View File

@@ -1,181 +0,0 @@
SUMMARY="The GNU C/C++ compiler"
DESCRIPTION="The standard compiler for x86_gcc2 platform, ABI-compatible with \
BeOS R5."
SUMMARY_syslibs_devel="C/C++-runtime static libraries, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's c/c++-runtime libraries that is required by Haiku's \
build system when building Haiku."
HOMEPAGE="http://gcc.gnu.org"
COPYRIGHT="1988-2000 Free Software Foundation, Inc."
LICENSE="GNU GPL v2
GNU LGPL v2"
REVISION="1"
srcGitRev="e5a1aa929a5e26ccff8d56228634ef6ba0078212"
SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="1e19de45203765ff494649b25df44aa1cb13a787c55ed57d3d18f8d95ff72397"
SOURCE_DIR="buildtools-$srcGitRev/legacy/gcc"
ARCHITECTURES="x86_gcc2 !x86"
SECONDARY_ARCHITECTURES="x86_gcc2"
PROVIDES="
gcc$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:cc$secondaryArchSuffix
cmd:c++$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:c++filt$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:g++$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:gcov$secondaryArchSuffix = 1.5 compat >= 1.5
cmd:i586_pc_haiku_gcc$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:protoize$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:unprotoize$secondaryArchSuffix = $portVersion compat >= 2.95.3
"
REQUIRES="
haiku$secondaryArchSuffix
binutils$secondaryArchSuffix
"
PROVIDES_syslibs_devel="
gcc_syslibs_devel$secondaryArchSuffix = $portVersion compat >= 2.95.3
"
REQUIRES_syslibs_devel=""
BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:autoconf
gcc$secondaryArchSuffix
cmd:find
cmd:flex
cmd:make
cmd:sed
cmd:tar
cmd:makeinfo
"
BUILD_PACKAGE_ACTIVATION_PHASE=INSTALL
gccDir=$(pwd)
relativeGccInstallDir="develop/tools$secondaryArchSubDir"
gccInstallDir="$prefix/$relativeGccInstallDir"
gccObjectsDir=$gccDir/../gcc-obj
BUILD()
{
rm -rf $gccObjectsDir
# 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 gcc; touch c-parse.c c-parse.h cexp.c cp/parse.c \
cp/parse.h c-gperf.h)
mkdir -p $gccObjectsDir
cd $gccObjectsDir
local additionalConfigureFlags
if [ -n "$secondaryArchSuffix" ]; then
additionalConfigureFlags="\
--with-hybrid-secondary=${effectiveTargetArchitecture}"
fi
CFLAGS="-O2" CXXFLAGS="-O2" "$gccDir/configure" \
--prefix=$gccInstallDir \
--disable-nls --enable-shared --enable-languages=c,c++ \
$additionalConfigureFlags
make bootstrap
}
INSTALL()
{
cd $gccObjectsDir
make install
rm $gccInstallDir/lib/libiberty.a
# only needed for building gcc
### HTML documentation ####################################
local html_base=$docDir
if [ ! -d "$html_base" ]; then
echo "Building HTML documentation..."
mkdir -p $html_base
cd $html_base
makeinfo --html "$gccDir/gcc/cpp.texi"
makeinfo --html "$gccDir/gcc/gcc.texi"
makeinfo --force --html "$gccDir/libio/iostream.texi" \
&& true
# some errors
ln -sf cpp/index.html $html_base/cpp.html
ln -sf gcc/index.html $html_base/gcc.html
ln -sf iostream/index.html $html_base/iostream.html
fi
### Symlinks ##############################################
echo "Creating required symlinks"
# convert to absolute links to relative ones
cd $gccInstallDir/bin
ln -sfn g++ c++
ln -sfn gcc cc
ln -sfn gcc $effectiveTargetMachineTriple-gcc
# make all tools available via default paths
echo "Symlinking binaries into default path"
mkdir -p $binDir
symlinkRelative -s $gccInstallDir/bin/* $binDir
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of static libraries (libgcc.a)
# exist in $developLibDir. These are put into a separate package
# (gcc_syslibs_devel), which is used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $gccInstallDir
gccLibDir=lib/gcc-lib/$effectiveTargetMachineTriple/2.95.3-*
# libgcc
cp $gccLibDir/libgcc.a $developLibDir/
### Strip #################################################
echo "Strip debug info"
cd $gccInstallDir
strip --strip-debug bin/*
strip --strip-debug $gccLibDir/* &>/dev/null || true
### Cleanup ###############################################
echo "Cleanup"
cd $gccInstallDir
rm -rf info
rm -rf share
rm man/man1/cccp.1
### C++ includes ##########################################
echo "Install C++ includes & library"
rm -rf $gccInstallDir/include/g++
ln -snf /boot/system/develop/headers/c++/2.95.3 $gccInstallDir/include/g++
ln -snf /boot/system/lib$secondaryArchSubDir/libstdc++.r4.so $gccInstallDir/lib/
### Sub Packages ##########################################
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a
rm -rf $libDir
rm -rf $developLibDir
}

View File

@@ -1,183 +0,0 @@
SUMMARY="The GNU C/C++ compiler"
DESCRIPTION="The standard compiler for x86_gcc2 platform, ABI-compatible with \
BeOS R5."
SUMMARY_syslibs_devel="C/C++-runtime static libraries, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's c/c++-runtime libraries that is required by Haiku's \
build system when building Haiku."
HOMEPAGE="http://gcc.gnu.org"
COPYRIGHT="1988-2000 Free Software Foundation, Inc."
LICENSE="GNU GPL v2
GNU LGPL v2"
REVISION="4"
srcGitRev="d86116d57a09505802ed6a38adc43ef294f7f364"
SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="9eef41dcd1582b84e677f3dcb14faa2dd42707352556d05860470e2a99b7e505"
SOURCE_DIR="buildtools-$srcGitRev/legacy/gcc"
SOURCE_FILENAME="gcc-$portVersion.tar.gz"
ARCHITECTURES="x86_gcc2 !x86"
SECONDARY_ARCHITECTURES="x86_gcc2"
PROVIDES="
gcc$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:cc$secondaryArchSuffix
cmd:c++$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:c++filt$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:g++$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:gcov$secondaryArchSuffix = 1.5 compat >= 1.5
cmd:i586_pc_haiku_gcc$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:protoize$secondaryArchSuffix = $portVersion compat >= 2.95.3
cmd:unprotoize$secondaryArchSuffix = $portVersion compat >= 2.95.3
"
REQUIRES="
haiku$secondaryArchSuffix
binutils$secondaryArchSuffix
"
PROVIDES_syslibs_devel="
gcc_syslibs_devel$secondaryArchSuffix = $portVersion compat >= 2.95.3
devel:libgcc
"
REQUIRES_syslibs_devel=""
BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:autoconf
gcc$secondaryArchSuffix
cmd:find
cmd:flex
cmd:make
cmd:sed
cmd:tar
cmd:makeinfo_4.13
"
BUILD_PACKAGE_ACTIVATION_PHASE=INSTALL
gccDir=$(pwd)
relativeGccInstallDir="develop/tools$secondaryArchSubDir"
gccInstallDir="$prefix/$relativeGccInstallDir"
gccObjectsDir=$gccDir/../gcc-obj
BUILD()
{
rm -rf $gccObjectsDir
# 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 gcc; touch c-parse.c c-parse.h cexp.c cp/parse.c \
cp/parse.h c-gperf.h)
mkdir -p $gccObjectsDir
cd $gccObjectsDir
local additionalConfigureFlags
if [ -n "$secondaryArchSuffix" ]; then
additionalConfigureFlags="\
--with-hybrid-secondary=${effectiveTargetArchitecture}"
fi
CFLAGS="-O2" CXXFLAGS="-O2" "$gccDir/configure" \
--prefix=$gccInstallDir \
--disable-nls --enable-shared --enable-languages=c,c++ \
$additionalConfigureFlags
make bootstrap
}
INSTALL()
{
cd $gccObjectsDir
make install
rm $gccInstallDir/lib/libiberty.a
# only needed for building gcc
### HTML documentation ####################################
local html_base=$docDir
if [ ! -d "$html_base" ]; then
echo "Building HTML documentation..."
mkdir -p $html_base
cd $html_base
makeinfo-4.13 --html "$gccDir/gcc/cpp.texi"
makeinfo-4.13 --html "$gccDir/gcc/gcc.texi"
makeinfo-4.13 --force --html "$gccDir/libio/iostream.texi" \
&& true
# some errors
ln -sf cpp/index.html $html_base/cpp.html
ln -sf gcc/index.html $html_base/gcc.html
ln -sf iostream/index.html $html_base/iostream.html
fi
### Symlinks ##############################################
echo "Creating required symlinks"
# convert to absolute links to relative ones
cd $gccInstallDir/bin
ln -sfn g++ c++
ln -sfn gcc cc
ln -sfn gcc $effectiveTargetMachineTriple-gcc
# make all tools available via default paths
echo "Symlinking binaries into default path"
mkdir -p $binDir
symlinkRelative -s $gccInstallDir/bin/* $binDir
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of static libraries (libgcc.a)
# exist in $developLibDir. These are put into a separate package
# (gcc_syslibs_devel), which is used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $gccInstallDir
gccLibDir=lib/gcc-lib/$effectiveTargetMachineTriple/2.95.3-*
# libgcc
cp $gccLibDir/libgcc.a $developLibDir/
### Strip #################################################
echo "Strip debug info"
cd $gccInstallDir
strip --strip-debug bin/*
strip --strip-debug $gccLibDir/* &>/dev/null || true
### Cleanup ###############################################
echo "Cleanup"
cd $gccInstallDir
rm -rf info
rm -rf share
rm man/man1/cccp.1
### C++ includes ##########################################
echo "Install C++ includes & library"
rm -rf $gccInstallDir/include/g++
ln -snf /boot/system/develop/headers/c++/2.95.3 $gccInstallDir/include/g++
ln -snf /boot/system/lib$secondaryArchSubDir/libstdc++.r4.so $gccInstallDir/lib/
### Sub Packages ##########################################
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a
rm -rf $libDir
rm -rf $developLibDir
}

View File

@@ -1,156 +0,0 @@
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
}

View File

@@ -1,319 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
srcGitRev="4947d64591fdd9764dad9ff6835ffbef1618e17f"
SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="cb9261a3d3ab6e9c4ca5f2cd772a46439490ce525062c5fd2b2d04f50ad45619"
REVISION="2"
LICENSE="
GNU GPL v2
GNU LGPL v2
"
COPYRIGHT="1988-2013 Free Software Foundation, Inc."
if [ $effectiveTargetArchitecture = x86_64 ]; then
PATCHES="gcc-4.8.3_buildfixes_for_x86_64.patchset"
fi
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"
SECONDARY_ARCHITECTURES="x86"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.19"
libgccSoVersion="1"
libgccLibVersion="1"
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
"
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
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
echo "### libsupc++"
# Build a shared libsupc++ from libsupc++.a (hacking the gcc build system
# to build a shared libsupc++ yields pretty much the same result, so we
# use this simpler approach).
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
gcc -nodefaultlibs -shared -o .libs/libsupc++.so -Xlinker --whole-archive \
.libs/libsupc++.a
# build kernel version of libsupc++.a (without threads or TLS)
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
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
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$libstdcxxDir/libsupc++/.libs/libsupc++.so \
$gccLibDir/
strip --strip-debug $gccLibDir/libsupc++.so
cp $gccLibDir/libsupc++.so $libDir/
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug lib/*.a \
$gccLibDir/*.a \
$developLibDir/*.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 \
$gccLibDir/$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
### Sub Packages ##########################################
packageEntries "syslibs" \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc_syslibs$secondaryArchSuffix = $portVersion compat >= 4
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 4
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc_syslibs_devel$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs_devel=""

View File

@@ -1,319 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
srcGitRev="1a00a76b58ae57d24bd4d774f6323c4ea62dd1e7"
SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="822f5944c9866eebbe293edcc6ba524e5b1e409114350a681ec88e4d6b747dc2"
REVISION="1"
LICENSE="
GNU GPL v2
GNU LGPL v2
"
COPYRIGHT="1988-2014 Free Software Foundation, Inc."
if [ $effectiveTargetArchitecture = x86_64 ]; then
PATCHES="gcc-4.8.3_buildfixes_for_x86_64.patchset"
fi
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"
SECONDARY_ARCHITECTURES="x86"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.19"
libgccSoVersion="1"
libgccLibVersion="1"
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.4$secondaryArchSuffix = $portVersion compat >= 4
cmd:gcov$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
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
echo "### libsupc++"
# Build a shared libsupc++ from libsupc++.a (hacking the gcc build system
# to build a shared libsupc++ yields pretty much the same result, so we
# use this simpler approach).
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
gcc -nodefaultlibs -shared -o .libs/libsupc++.so -Xlinker --whole-archive \
.libs/libsupc++.a
# build kernel version of libsupc++.a (without threads or TLS)
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
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
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$libstdcxxDir/libsupc++/.libs/libsupc++.so \
$gccLibDir/
strip --strip-debug $gccLibDir/libsupc++.so
cp $gccLibDir/libsupc++.so $libDir/
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug lib/*.a \
$gccLibDir/*.a \
$developLibDir/*.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 \
$gccLibDir/$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
### Sub Packages ##########################################
packageEntries "syslibs" \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The c/c++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc_syslibs$secondaryArchSuffix = $portVersion compat >= 4
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 4
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and c++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc_syslibs_devel$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs_devel=""

View File

@@ -1,321 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
srcGitRev="3801b878c2c2bfea5a115bcbd75b56d3da05bc3d"
SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="f2c5f2a71018b1669b7b88004fd21e0077bc7dffa2b21554d138b9848f2a17d9"
REVISION="2"
LICENSE="
GNU GPL v3
GNU LGPL v3
"
COPYRIGHT="1988-2015 Free Software Foundation, Inc."
if [ $effectiveTargetArchitecture = x86_64 ]; then
PATCHES="gcc-4.8.3_buildfixes_for_x86_64.patchset"
else
PATCHES="gcc-4.8.5_2015_07_11_for_x86.patchset"
fi
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"
SECONDARY_ARCHITECTURES="x86"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.19"
libgccSoVersion="1"
libgccLibVersion="1"
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.5$secondaryArchSuffix = $portVersion compat >= 4
cmd:gcov$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
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
echo "### libsupc++"
# Build a shared libsupc++ from libsupc++.a (hacking the gcc build system
# to build a shared libsupc++ yields pretty much the same result, so we
# use this simpler approach).
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
gcc -nodefaultlibs -shared -o .libs/libsupc++.so -Xlinker --whole-archive \
.libs/libsupc++.a
# build kernel version of libsupc++.a (without threads or TLS)
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
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
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$libstdcxxDir/libsupc++/.libs/libsupc++.so \
$gccLibDir/
strip --strip-debug $gccLibDir/libsupc++.so
cp $gccLibDir/libsupc++.so $libDir/
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug lib/*.a \
$gccLibDir/*.a \
$developLibDir/*.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 \
$gccLibDir/$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
### Sub Packages ##########################################
packageEntries "syslibs" \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc_syslibs$secondaryArchSuffix = $portVersion compat >= 4
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 4
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc_syslibs_devel$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs_devel=""

View File

@@ -1,325 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
srcGitRev="7b26e3896e268cd452d68ff8df04f4563d5db6ef"
SOURCE_URI="https://github.com/gcc-mirror/gcc/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="3770285b7de18274b4fa06e40b7dbc06c849c08650d03590365a49fa4de40142"
REVISION="2"
LICENSE="
GNU GPL v3
GNU LGPL v3
"
COPYRIGHT="1988-2015 Free Software Foundation, Inc."
PATCHES="gcc-5.2.0_2015_07_27.patchset"
ARCHITECTURES="!x86_gcc2 !x86 x86_64 arm"
SECONDARY_ARCHITECTURES="!x86"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.21"
libgccSoVersion="1"
libgccLibVersion="1"
PROVIDES="
gcc$secondaryArchSuffix = $portVersion compat >= 5
cmd:c++$secondaryArchSuffix = $portVersion compat >= 5
cmd:cc$secondaryArchSuffix = $portVersion compat >= 5
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 5
cmd:g++$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcc_5.2.0$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 5
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
devel:libgmp$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
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="gcc-$srcGitRev"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
echo "### libsupc++"
# Build a shared libsupc++ from libsupc++.a (hacking the gcc build system
# to build a shared libsupc++ yields pretty much the same result, so we
# use this simpler approach).
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
gcc -nodefaultlibs -shared -o .libs/libsupc++.so -Xlinker --whole-archive \
.libs/libsupc++.a
# build kernel version of libsupc++.a (without threads or TLS)
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$libstdcxxDir/libsupc++/.libs/libsupc++.so \
$gccLibDir/
strip --strip-debug $gccLibDir/libsupc++.so
cp $gccLibDir/libsupc++.so $libDir/
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 \
$gccLibDir/$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
### Sub Packages ##########################################
packageEntries "syslibs" \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc${secondaryArchSuffix}_syslibs = $portVersion compat >= 5
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 5
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 5
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 5
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 5
"
REQUIRES_syslibs_devel=""

View File

@@ -1,347 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
SOURCE_URI="https://ftp.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2"
CHECKSUM_SHA256="b84f5592e9218b73dbae612b5253035a7b34a9a1f7688d2e1bfaaf7267d5c4db"
REVISION="5"
LICENSE="
GNU GPL v3
GNU LGPL v3
"
COPYRIGHT="1988-2015 Free Software Foundation, Inc."
PATCHES="gcc-5.3.0_2016_02_29.patchset"
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"
SECONDARY_ARCHITECTURES="x86"
libatomicSoVersion="1"
libatomicLibVersion="1.1.0"
libgompSoVersion="1"
libgompLibVersion="1.0.0"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.21"
libgccSoVersion="1"
libgccLibVersion="1"
PROVIDES="
gcc$secondaryArchSuffix = $portVersion compat >= 5
cmd:c++$secondaryArchSuffix = $portVersion compat >= 5
cmd:cc$secondaryArchSuffix = $portVersion compat >= 5
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 5
cmd:g++$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcc_5.3.0$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 5
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
devel:libgmp$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
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="gcc-5.3.0"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib --enable-checking=release \
--with-bug-url=http://dev.haiku-os.org/ \
--with-default-libstdcxx-abi=gcc4-compatible \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
# build kernel version of libsupc++.a (without threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libatomic
strip --strip-debug $gccLibDir/libatomic.so.$libatomicLibVersion
cp -d $gccLibDir/libatomic.so \
$gccLibDir/libatomic.so.$libatomicSoVersion \
$gccLibDir/libatomic.so.$libatomicLibVersion \
$libDir/
cp $gccLibDir/libatomic*.a $developLibDir/
# libgomp
strip --strip-debug $gccLibDir/libgomp.so.$libgompLibVersion
cp -d $gccLibDir/libgomp.so \
$gccLibDir/libgomp.so.$libgompSoVersion \
$gccLibDir/libgomp.so.$libgompLibVersion \
$libDir/
cp $gccLibDir/libgomp*.a $developLibDir/
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$gccLibDir/
ln -s libstdc++.so $libDir/libsupc++.so
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 \
$gccLibDir/$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
### Sub Packages ##########################################
packageEntries "syslibs" \
$relativeLibDir/libatomic.so.$libatomicSoVersion \
$relativeLibDir/libatomic.so.$libatomicLibVersion \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libgomp.so.$libgompSoVersion \
$relativeLibDir/libgomp.so.$libgompLibVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libatomic.a \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libgomp.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc${secondaryArchSuffix}_syslibs = $portVersion compat >= 4
lib:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 4
lib:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 5
"
REQUIRES_syslibs_devel=""

View File

@@ -1,441 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
COPYRIGHT="1988-2015 Free Software Foundation, Inc."
LICENSE="
GNU GPL v3
GNU LGPL v3
"
REVISION="7"
SOURCE_URI="https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2"
CHECKSUM_SHA256="608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a"
SOURCE_DIR="gcc-5.4.0"
PATCHES="gcc-5.4.0_2016_06_04.patchset"
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"
SECONDARY_ARCHITECTURES="x86"
libatomicSoVersion="1"
libatomicLibVersion="1.1.0"
libgccSoVersion="1"
libgccLibVersion="1"
libgfortranSoVersion="3"
libgfortranLibVersion="3.0.0"
libgompSoVersion="1"
libgompLibVersion="1.0.0"
libquadmathSoVersion="0"
libquadmathLibVersion="0.0.0"
libsspSoVersion="0"
libsspLibVersion="0.0.0"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.21"
PROVIDES="
gcc$secondaryArchSuffix = $portVersion compat >= 5
cmd:c++$secondaryArchSuffix = $portVersion compat >= 5
cmd:cc$secondaryArchSuffix = $portVersion compat >= 5
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 5
cmd:g++$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcc_5.4.0$secondaryArchSuffix = $portVersion compat >= 5
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 5
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
devel:libgmp$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
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
"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++,fortran --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib --enable-checking=release \
--with-bug-url=http://dev.haiku-os.org/ \
--with-default-libstdcxx-abi=gcc4-compatible \
--enable-libssp \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
# build kernel version of libsupc++.a (without threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libatomic
strip --strip-debug $gccLibDir/libatomic.so.$libatomicLibVersion
cp -d $gccLibDir/libatomic.so \
$gccLibDir/libatomic.so.$libatomicSoVersion \
$gccLibDir/libatomic.so.$libatomicLibVersion \
$libDir/
cp $gccLibDir/libatomic*.a $developLibDir/
# libgfortran
strip --strip-debug $gccLibDir/libgfortran.so.$libgfortranLibVersion
cp -d $gccLibDir/libgfortran.so \
$gccLibDir/libgfortran.so.$libgfortranSoVersion \
$gccLibDir/libgfortran.so.$libgfortranLibVersion \
$libDir/
cp $gccLibDir/libgfortran*.a $developLibDir/
# libgomp
strip --strip-debug $gccLibDir/libgomp.so.$libgompLibVersion
cp -d $gccLibDir/libgomp.so \
$gccLibDir/libgomp.so.$libgompSoVersion \
$gccLibDir/libgomp.so.$libgompLibVersion \
$libDir/
cp $gccLibDir/libgomp*.a $developLibDir/
# libquadmath
strip --strip-debug $gccLibDir/libquadmath.so.$libquadmathLibVersion
cp -d $gccLibDir/libquadmath.so \
$gccLibDir/libquadmath.so.$libquadmathSoVersion \
$gccLibDir/libquadmath.so.$libquadmathLibVersion \
$libDir/
cp $gccLibDir/libquadmath*.a $developLibDir
# libssp
strip --strip-debug $gccLibDir/libssp.so.$libsspLibVersion
cp -d $gccLibDir/libssp.so \
$gccLibDir/libssp.so.$libsspSoVersion \
$gccLibDir/libssp.so.$libsspLibVersion \
$libDir/
cp $gccLibDir/libssp*.a $developLibDir
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$gccLibDir/
ln -s libstdc++.so $libDir/libsupc++.so
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 f951 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 f951 lto1; do
addattr SYS:ENV DISABLE_ASLR=1 \
$gccLibDir/$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 gfortran; do
symlinkRelative -sfn $installDir/bin/$f $binDir
done
### Cleanup ###############################################
echo "Cleanup"
rm -rf $installDir/info
rm -rf $installDir/share
### Sub Packages ##########################################
packageEntries "fortran" \
$relativeBinDir/gfortran \
$prefix/$relativeInstallDir/bin/*gfortran \
$installDir/$gccLibDir/f951 \
$installDir/$gccLibDir/finclude \
$installDir/$gccLibDir/libcaf_single.a \
$installDir/$gccLibDir/libgfortran.a \
$installDir/$gccLibDir/libgfortran.spec \
$installDir/$gccLibDir/libgfortranbegin.a
rm -rf $installDir/$gccLibDir/{f951, finclude, libcaf_single*, libgfortran*}
packageEntries "syslibs" \
$relativeLibDir/libatomic.so \
$relativeLibDir/libatomic.so.$libatomicSoVersion \
$relativeLibDir/libatomic.so.$libatomicLibVersion \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libgfortran.so \
$relativeLibDir/libgfortran.so.$libgfortranSoVersion \
$relativeLibDir/libgfortran.so.$libgfortranLibVersion \
$relativeLibDir/libgomp.so \
$relativeLibDir/libgomp.so.$libgompSoVersion \
$relativeLibDir/libgomp.so.$libgompLibVersion \
$relativeLibDir/libquadmath.so \
$relativeLibDir/libquadmath.so.$libquadmathSoVersion \
$relativeLibDir/libquadmath.so.$libquadmathLibVersion \
$relativeLibDir/libssp.so \
$relativeLibDir/libssp.so.$libsspSoVersion \
$relativeLibDir/libssp.so.$libsspLibVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libatomic.a \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libgomp.a \
$relativeDevelopLibDir/libquadmath.a \
$relativeDevelopLibDir/libssp.a \
$relativeDevelopLibDir/libssp_nonshared.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- fortran package -----------------------------------------------
SUMMARY_fortran="C/C++-runtime static libraries and C++ headers, needed for gfortran"
DESCRIPTION_fortran="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by gfortran to build fortran source code."
PROVIDES_fortran="
gcc${secondaryArchSuffix}_fortran = $portVersion compat >= 5
cmd:gfortran$secondaryArchSuffix = $portVersion compat >= 5
cmd:f951$secondaryArchSuffix = $portVersion compat >= 5
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libcaf_single$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libgfortranbegin$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
"
REQUIRES_fortran="
haiku$secondaryArchSuffix
gcc${secondaryArchSuffix}_syslibs == $portVersion base
"
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc${secondaryArchSuffix}_syslibs = $portVersion compat >= 4
lib:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 4
lib:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
lib:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
lib:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
lib:libssp$secondaryArchSuffix = $libsspLibVersion compat >= $libsspSoVersion
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 5
devel:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
devel:libgcc_kernel$secondaryArchSuffix = $portVersion compat >= 4
devel:libgcc$secondaryArchSuffix = $portVersion compat >= 4
devel:libgcc_eh$secondaryArchSuffix = $portVersion compat >= 4
devel:libgcc_eh_kernel$secondaryArchSuffix = $portVersion compat >= 4
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
devel:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
devel:libssp$secondaryArchSuffix = $libsspLibVersion compat >= $libsspSoVersion
devel:libssp_nonshared$secondaryArchSuffix = $libsspLibVersion
devel:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
devel:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
devel:libsupc++_kernel$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs_devel=""

View File

@@ -1,325 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
srcGitRev="876d41ed80ce13e060084ed5a552c37c301e5563"
SOURCE_URI="https://github.com/gcc-mirror/gcc/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="5c60d02b319be7529736ce1578d529de47bcafd116d78da2cbbcf87705825c70"
REVISION="1"
LICENSE="
GNU GPL v3
GNU LGPL v3
"
COPYRIGHT="1988-2015 Free Software Foundation, Inc."
PATCHES="gcc49-4.9.3_2015_07_31.patchset"
ARCHITECTURES="!x86_gcc2 !x86 ?x86_64 ?arm"
SECONDARY_ARCHITECTURES="!x86"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.20"
libgccSoVersion="1"
libgccLibVersion="1"
PROVIDES="
gcc49$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.9.3$secondaryArchSuffix = $portVersion compat >= 4
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
devel:libgmp$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
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="gcc-$srcGitRev"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
echo "### libsupc++"
# Build a shared libsupc++ from libsupc++.a (hacking the gcc build system
# to build a shared libsupc++ yields pretty much the same result, so we
# use this simpler approach).
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
gcc -nodefaultlibs -shared -o .libs/libsupc++.so -Xlinker --whole-archive \
.libs/libsupc++.a
# build kernel version of libsupc++.a (without threads or TLS)
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$libstdcxxDir/libsupc++/.libs/libsupc++.so \
$gccLibDir/
strip --strip-debug $gccLibDir/libsupc++.so
cp $gccLibDir/libsupc++.so $libDir/
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 \
$gccLibDir/$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
### Sub Packages ##########################################
packageEntries "syslibs" \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}
# ----- syslibs package -----------------------------------------------------
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc49_syslibs$secondaryArchSuffix = $portVersion compat >= 4
lib:libgcc_s$secondaryArchSuffix = $portVersion compat >= 4
lib:libstdc++$secondaryArchSuffix = $portVersion compat >= 4
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
# ----- syslibs_devel package -----------------------------------------------
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc49_syslibs_devel$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES_syslibs_devel=""

View File

@@ -1,411 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
COPYRIGHT="1988-2016 Free Software Foundation, Inc."
LICENSE="GNU GPL v3
GNU LGPL v3
"
REVISION="1"
gccVersion="6.3.0"
SOURCE_URI="https://ftp.gnu.org/gnu/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.bz2"
CHECKSUM_SHA256="f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f"
SOURCE_DIR="gcc-$gccVersion"
PATCHES="gcc-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64 ?arm"
SECONDARY_ARCHITECTURES="?x86"
libatomicSoVersion="1"
libatomicLibVersion="1.2.0"
libgccSoVersion="1"
libgccLibVersion="1"
libgfortranSoVersion="3"
libgfortranLibVersion="3.0.0"
libgompSoVersion="1"
libgompLibVersion="1.0.0"
libquadmathSoVersion="0"
libquadmathLibVersion="0.0.0"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.22"
PROVIDES="
gcc6$secondaryArchSuffix = $portVersion compat >= 6
cmd:c++$secondaryArchSuffix = $portVersion compat >= 6
cmd:cc$secondaryArchSuffix = $portVersion compat >= 6
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 6
cmd:g++$secondaryArchSuffix = $portVersion compat >= 6
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 6
cmd:gcc_$portVersion$secondaryArchSuffix = $portVersion compat >= 6
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 6
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
SUMMARY_fortran="C/C++-runtime static libraries and C++ headers, needed for gfortran"
DESCRIPTION_fortran="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by gfortran to build fortran source code."
PROVIDES_fortran="
gcc6${secondaryArchSuffix}_fortran = $portVersion compat >= 6
cmd:gfortran$secondaryArchSuffix = $portVersion compat >= 6
cmd:f951$secondaryArchSuffix = $portVersion compat >= 6
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libcaf_single$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
"
REQUIRES_fortran="
haiku$secondaryArchSuffix
gcc6${secondaryArchSuffix}_syslibs == $portVersion base
"
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc6${secondaryArchSuffix}_syslibs = $portVersion compat >= 6
lib:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
lib:libgcc_s$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
lib:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
lib:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
lib:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
lib:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 6
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc6${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 6
devel:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
devel:libgcc_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc_eh_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc_eh$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
devel:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
devel:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
devel:libsupc++$secondaryArchSuffix = $portVersion compat >= 6
devel:libsupc++_kernel$secondaryArchSuffix = $portVersion compat >= 6
"
REQUIRES_syslibs_devel=""
BUILD_REQUIRES="
devel:libgmp$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
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
"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++,fortran --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib --enable-checking=release \
--with-bug-url=http://dev.haiku-os.org/ \
--with-default-libstdcxx-abi=gcc4-compatible \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
# build kernel version of libsupc++.a (without threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libatomic
strip --strip-debug $gccLibDir/libatomic.so.$libatomicLibVersion
cp -d $gccLibDir/libatomic.so \
$gccLibDir/libatomic.so.$libatomicSoVersion \
$gccLibDir/libatomic.so.$libatomicLibVersion \
$libDir/
cp $gccLibDir/libatomic*.a $developLibDir/
# libgfortran
strip --strip-debug $gccLibDir/libgfortran.so.$libgfortranLibVersion
cp -d $gccLibDir/libgfortran.so \
$gccLibDir/libgfortran.so.$libgfortranSoVersion \
$gccLibDir/libgfortran.so.$libgfortranLibVersion \
$libDir/
cp $gccLibDir/libgfortran*.a $developLibDir/
# libgomp
strip --strip-debug $gccLibDir/libgomp.so.$libgompLibVersion
cp -d $gccLibDir/libgomp.so \
$gccLibDir/libgomp.so.$libgompSoVersion \
$gccLibDir/libgomp.so.$libgompLibVersion \
$libDir/
cp $gccLibDir/libgomp*.a $developLibDir/
# libquadmath
strip --strip-debug $gccLibDir/libquadmath.so.$libquadmathLibVersion
cp -d $gccLibDir/libquadmath.so \
$gccLibDir/libquadmath.so.$libquadmathSoVersion \
$gccLibDir/libquadmath.so.$libquadmathLibVersion \
$libDir/
cp $gccLibDir/libquadmath*.a $developLibDir
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$gccLibDir/
ln -s libstdc++.so $libDir/libsupc++.so
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 f951 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 f951 lto1; do
addattr SYS:ENV DISABLE_ASLR=1 \
$gccLibDir/$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 gfortran; do
symlinkRelative -sfn $installDir/bin/$f $binDir
done
### Cleanup ###############################################
echo "Cleanup"
rm -rf $installDir/info
rm -rf $installDir/share
### Sub Packages ##########################################
packageEntries "fortran" \
$relativeBinDir/gfortran \
$developDir/tools/bin/*gfortran \
$installDir/$gccLibDir/f951 \
$installDir/$gccLibDir/finclude \
$installDir/$gccLibDir/libcaf_single.a \
$installDir/$gccLibDir/libgfortran.a \
$installDir/$gccLibDir/libgfortran.spec
rm -rf $installDir/$gccLibDir/{f951, finclude, libcaf_single*, libgfortran*}
packageEntries "syslibs" \
$relativeLibDir/libatomic.so \
$relativeLibDir/libatomic.so.$libatomicSoVersion \
$relativeLibDir/libatomic.so.$libatomicLibVersion \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libgfortran.so \
$relativeLibDir/libgfortran.so.$libgfortranSoVersion \
$relativeLibDir/libgfortran.so.$libgfortranLibVersion \
$relativeLibDir/libgomp.so \
$relativeLibDir/libgomp.so.$libgompSoVersion \
$relativeLibDir/libgomp.so.$libgompLibVersion \
$relativeLibDir/libquadmath.so \
$relativeLibDir/libquadmath.so.$libquadmathSoVersion \
$relativeLibDir/libquadmath.so.$libquadmathLibVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libatomic.a \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libgomp.a \
$relativeDevelopLibDir/libquadmath.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}

View File

@@ -1,411 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
COPYRIGHT="1988-2017 Free Software Foundation, Inc."
LICENSE="GNU GPL v3
GNU LGPL v3
"
REVISION="1"
gccVersion="6.4.0"
SOURCE_URI="https://ftp.gnu.org/gnu/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.xz"
CHECKSUM_SHA256="850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4"
SOURCE_DIR="gcc-$gccVersion"
PATCHES="gcc-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64 ?arm"
SECONDARY_ARCHITECTURES="?x86"
libatomicSoVersion="1"
libatomicLibVersion="1.2.0"
libgccSoVersion="1"
libgccLibVersion="1"
libgfortranSoVersion="3"
libgfortranLibVersion="3.0.0"
libgompSoVersion="1"
libgompLibVersion="1.0.0"
libquadmathSoVersion="0"
libquadmathLibVersion="0.0.0"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.22"
PROVIDES="
gcc6$secondaryArchSuffix = $portVersion compat >= 6
cmd:c++$secondaryArchSuffix = $portVersion compat >= 6
cmd:cc$secondaryArchSuffix = $portVersion compat >= 6
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 6
cmd:g++$secondaryArchSuffix = $portVersion compat >= 6
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 6
cmd:gcc_$portVersion$secondaryArchSuffix = $portVersion compat >= 6
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 6
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
SUMMARY_fortran="C/C++-runtime static libraries and C++ headers, needed for gfortran"
DESCRIPTION_fortran="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by gfortran to build fortran source code."
PROVIDES_fortran="
gcc6${secondaryArchSuffix}_fortran = $portVersion compat >= 6
cmd:gfortran$secondaryArchSuffix = $portVersion compat >= 6
cmd:f951$secondaryArchSuffix = $portVersion compat >= 6
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libcaf_single$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
"
REQUIRES_fortran="
haiku$secondaryArchSuffix
gcc6${secondaryArchSuffix}_syslibs == $portVersion base
"
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc6${secondaryArchSuffix}_syslibs = $portVersion compat >= 6
lib:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
lib:libgcc_s$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
lib:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
lib:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
lib:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
lib:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 6
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc6${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 6
devel:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
devel:libgcc_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc_eh_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc_eh$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
devel:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
devel:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
devel:libsupc++$secondaryArchSuffix = $portVersion compat >= 6
devel:libsupc++_kernel$secondaryArchSuffix = $portVersion compat >= 6
"
REQUIRES_syslibs_devel=""
BUILD_REQUIRES="
devel:libgmp$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
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
"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++,fortran --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib --enable-checking=release \
--with-bug-url=http://dev.haiku-os.org/ \
--with-default-libstdcxx-abi=gcc4-compatible \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
# build kernel version of libsupc++.a (without threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libatomic
strip --strip-debug $gccLibDir/libatomic.so.$libatomicLibVersion
cp -d $gccLibDir/libatomic.so \
$gccLibDir/libatomic.so.$libatomicSoVersion \
$gccLibDir/libatomic.so.$libatomicLibVersion \
$libDir/
cp $gccLibDir/libatomic*.a $developLibDir/
# libgfortran
strip --strip-debug $gccLibDir/libgfortran.so.$libgfortranLibVersion
cp -d $gccLibDir/libgfortran.so \
$gccLibDir/libgfortran.so.$libgfortranSoVersion \
$gccLibDir/libgfortran.so.$libgfortranLibVersion \
$libDir/
cp $gccLibDir/libgfortran*.a $developLibDir/
# libgomp
strip --strip-debug $gccLibDir/libgomp.so.$libgompLibVersion
cp -d $gccLibDir/libgomp.so \
$gccLibDir/libgomp.so.$libgompSoVersion \
$gccLibDir/libgomp.so.$libgompLibVersion \
$libDir/
cp $gccLibDir/libgomp*.a $developLibDir/
# libquadmath
strip --strip-debug $gccLibDir/libquadmath.so.$libquadmathLibVersion
cp -d $gccLibDir/libquadmath.so \
$gccLibDir/libquadmath.so.$libquadmathSoVersion \
$gccLibDir/libquadmath.so.$libquadmathLibVersion \
$libDir/
cp $gccLibDir/libquadmath*.a $developLibDir
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$gccLibDir/
ln -s libstdc++.so $libDir/libsupc++.so
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 f951 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 f951 lto1; do
addattr SYS:ENV DISABLE_ASLR=1 \
$gccLibDir/$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 gfortran; do
symlinkRelative -sfn $installDir/bin/$f $binDir
done
### Cleanup ###############################################
echo "Cleanup"
rm -rf $installDir/info
rm -rf $installDir/share
### Sub Packages ##########################################
packageEntries "fortran" \
$relativeBinDir/gfortran \
$developDir/tools/bin/*gfortran \
$installDir/$gccLibDir/f951 \
$installDir/$gccLibDir/finclude \
$installDir/$gccLibDir/libcaf_single.a \
$installDir/$gccLibDir/libgfortran.a \
$installDir/$gccLibDir/libgfortran.spec
rm -rf $installDir/$gccLibDir/{f951, finclude, libcaf_single*, libgfortran*}
packageEntries "syslibs" \
$relativeLibDir/libatomic.so \
$relativeLibDir/libatomic.so.$libatomicSoVersion \
$relativeLibDir/libatomic.so.$libatomicLibVersion \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libgfortran.so \
$relativeLibDir/libgfortran.so.$libgfortranSoVersion \
$relativeLibDir/libgfortran.so.$libgfortranLibVersion \
$relativeLibDir/libgomp.so \
$relativeLibDir/libgomp.so.$libgompSoVersion \
$relativeLibDir/libgomp.so.$libgompLibVersion \
$relativeLibDir/libquadmath.so \
$relativeLibDir/libquadmath.so.$libquadmathSoVersion \
$relativeLibDir/libquadmath.so.$libquadmathLibVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libatomic.a \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libgomp.a \
$relativeDevelopLibDir/libquadmath.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}

View File

@@ -1,410 +0,0 @@
SUMMARY="C/C++ compiler for target ${effectiveTargetMachineTriple}"
DESCRIPTION="The standard compiler for non-legacy Haiku (i.e. for all \
architectures other than x86_gcc2)."
HOMEPAGE="http://gcc.gnu.org"
COPYRIGHT="1988-2017 Free Software Foundation, Inc."
LICENSE="GNU GPL v3
GNU LGPL v3
"
REVISION="1"
gccVersion="7.1.0"
SOURCE_URI="https://ftp.gnu.org/gnu/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.bz2"
CHECKSUM_SHA256="8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17"
SOURCE_DIR="gcc-$gccVersion"
PATCHES="gcc-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64 ?arm"
SECONDARY_ARCHITECTURES="?x86"
libatomicSoVersion="1"
libatomicLibVersion="1.2.0"
libgccSoVersion="1"
libgccLibVersion="1"
libgfortranSoVersion="4"
libgfortranLibVersion="4.0.0"
libgompSoVersion="1"
libgompLibVersion="1.0.0"
libquadmathSoVersion="0"
libquadmathLibVersion="0.0.0"
libstdcxxSoVersion="6"
libstdcxxLibVersion="6.0.23"
PROVIDES="
gcc7$secondaryArchSuffix = $portVersion compat >= 7
cmd:c++$secondaryArchSuffix = $portVersion compat >= 7
cmd:cc$secondaryArchSuffix = $portVersion compat >= 7
cmd:cpp$secondaryArchSuffix = $portVersion compat >= 7
cmd:g++$secondaryArchSuffix = $portVersion compat >= 7
cmd:gcc$secondaryArchSuffix = $portVersion compat >= 7
cmd:gcc_$portVersion$secondaryArchSuffix = $portVersion compat >= 7
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 7
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:as$secondaryArchSuffix
lib:libgmp$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
SUMMARY_fortran="C/C++-runtime static libraries and C++ headers, needed for gfortran"
DESCRIPTION_fortran="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by gfortran to build fortran source code."
PROVIDES_fortran="
gcc7${secondaryArchSuffix}_fortran = $portVersion compat >= 7
cmd:gfortran$secondaryArchSuffix = $portVersion compat >= 7
cmd:f951$secondaryArchSuffix = $portVersion compat >= 7
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libcaf_single$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
"
REQUIRES_fortran="
haiku$secondaryArchSuffix
gcc7${secondaryArchSuffix}_syslibs == $portVersion base
"
SUMMARY_syslibs="C/C++-runtime shared libraries, needed to execute C/C++ programs"
DESCRIPTION_syslibs="The C/C++-runtime libraries that are part of the gcc \
distribution. This package contains the shared libraries for the runtime \
loader, so it is required for executing most c/c++ programs."
PROVIDES_syslibs="
gcc7${secondaryArchSuffix}_syslibs = $portVersion compat >= 7
lib:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
lib:libgcc_s$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
lib:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
lib:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
lib:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
lib:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 7
"
REQUIRES_syslibs="
haiku$secondaryArchSuffix
"
SUMMARY_syslibs_devel="C/C++-runtime static libraries and C++ headers, needed to build Haiku"
DESCRIPTION_syslibs_devel="This package is not of general interest - it \
contains the set of gcc's C/C++-runtime libraries and headers that is \
required by Haiku's build system when building Haiku."
PROVIDES_syslibs_devel="
gcc7${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 7
devel:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
devel:libgcc_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc_eh_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgcc_eh$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
devel:libgfortran$secondaryArchSuffix = $libgfortranLibVersion compat >= $libgfortranSoVersion
devel:libgomp$secondaryArchSuffix = $libgompLibVersion compat >= $libgompSoVersion
devel:libquadmath$secondaryArchSuffix = $libquadmathLibVersion compat >= $libquadmathSoVersion
devel:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
devel:libsupc++$secondaryArchSuffix = $portVersion compat >= 7
devel:libsupc++_kernel$secondaryArchSuffix = $portVersion compat >= 7
"
REQUIRES_syslibs_devel=""
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libgmp$secondaryArchSuffix >= 10.3.0
devel:libmpc$secondaryArchSuffix >= 3.0.0
devel:libmpfr$secondaryArchSuffix >= 4.1.4
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
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
"
sourceDir=$(pwd)
relativeInstallDir="develop/tools$secondaryArchSubDir"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
gccVersion=$(echo $portVersion | cut -d_ -f1)
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
local kernelCcFlags="-D_KERNEL_MODE"
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"
# deactivate red zone for x86_64
kernelCcFlags="$kernelCcFlags -mno-red-zone"
fi
"$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --enable-threads=posix \
--disable-nls --enable-shared --with-gnu-ld --with-gnu-as \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++,fortran --enable-lto --enable-frame-pointer \
--with-pkgversion=$(echo $portVersion | cut -d_ -f2-) \
--enable-__cxa-atexit --with-system-zlib --enable-checking=release \
--with-bug-url=http://dev.haiku-os.org/ \
--with-default-libstdcxx-abi=gcc4-compatible \
$additionalConfigureFlags
make $jobArgs
echo "######################## building special libraries ################"
echo "### libgcc"
# build kernel versions of libgcc.a and libgcc_eh.a (no threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
mkdir -p saved
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* saved/
make clean
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv libgcc.a libgcc-kernel.a
mv libgcc_eh.a libgcc_eh-kernel.a
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
mv saved/* .
rmdir saved
# build kernel version of libsupc++.a (without threads or TLS)
cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++
mkdir -p saved
mv .libs/libsupc++* saved/
cp "../include/$effectiveTargetMachineTriple/bits/gthr-default.h" \
"../config.h" \
"../include/$effectiveTargetMachineTriple/bits/c++config.h" \
saved/
make clean
cp "../include/$effectiveTargetMachineTriple/bits/gthr-single.h" \
"../include/$effectiveTargetMachineTriple/bits/gthr-default.h"
sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \
"../config.h"
sed -i -e 's,#define _GLIBCXX_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \
"../include/$effectiveTargetMachineTriple/bits/c++config.h"
make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags"
mv .libs/libsupc++.a .libs/libsupc++-kernel.a
mv saved/libsupc++* .libs/
mv saved/gthr-default.h "../include/$effectiveTargetMachineTriple/bits/"
mv saved/config.h ..
mv saved/c++config.h "../include/$effectiveTargetMachineTriple/bits/"
rmdir saved
}
INSTALL()
{
cd $objectsDir
make install
make install-html
### HTML documentation ####################################
echo "Organizing HTML documentation..."
cd $docDir
for dir in libquadmath; do
mv ${dir}.html $dir
ln -s $dir/index.html ${dir}.html
done
### Libraries #############################################
echo "Moving libraries around"
# Move/copy libraries such that copies of the runtime (shared) libs exist
# in $libDir and copies of static libraries exist in $developLibDir. These
# are put into separate packages gcc_syslibs and gcc_syslibs_devel, which
# are both used by Haiku's build system.
mkdir -p $libDir
mkdir -p $developLibDir
cd $installDir
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
# libatomic
strip --strip-debug $gccLibDir/libatomic.so.$libatomicLibVersion
cp -d $gccLibDir/libatomic.so \
$gccLibDir/libatomic.so.$libatomicSoVersion \
$gccLibDir/libatomic.so.$libatomicLibVersion \
$libDir/
cp $gccLibDir/libatomic*.a $developLibDir/
# libgfortran
strip --strip-debug $gccLibDir/libgfortran.so.$libgfortranLibVersion
cp -d $gccLibDir/libgfortran.so \
$gccLibDir/libgfortran.so.$libgfortranSoVersion \
$gccLibDir/libgfortran.so.$libgfortranLibVersion \
$libDir/
cp $gccLibDir/libgfortran*.a $developLibDir/
# libgomp
strip --strip-debug $gccLibDir/libgomp.so.$libgompLibVersion
cp -d $gccLibDir/libgomp.so \
$gccLibDir/libgomp.so.$libgompSoVersion \
$gccLibDir/libgomp.so.$libgompLibVersion \
$libDir/
cp $gccLibDir/libgomp*.a $developLibDir/
# libquadmath
strip --strip-debug $gccLibDir/libquadmath.so.$libquadmathLibVersion
cp -d $gccLibDir/libquadmath.so \
$gccLibDir/libquadmath.so.$libquadmathSoVersion \
$gccLibDir/libquadmath.so.$libquadmathLibVersion \
$libDir/
cp $gccLibDir/libquadmath*.a $developLibDir
# libstdc++
strip --strip-debug $gccLibDir/libstdc++.so.$libstdcxxLibVersion
cp -d $gccLibDir/libstdc++.so \
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
$libDir/
cp $gccLibDir/libstdc++*.a $developLibDir/
# libsupc++
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
$gccLibDir/
ln -s libstdc++.so $libDir/libsupc++.so
cp $gccLibDir/libsupc++*.a $developLibDir/
# libgcc
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \
$gccLibDir/
strip --strip-debug $gccLibDir/libgcc_s.so.$libgccSoVersion
cp -d $gccLibDir/libgcc_s.so \
$gccLibDir/libgcc_s.so.$libgccSoVersion \
$libDir/
cp $gccLibDir/libgcc*.a $developLibDir/
# gcc and c++ headers
mkdir -p $includeDir/gcc
cp -r $gccLibDir/include $includeDir/gcc/
cp -r $gccLibDir/include-fixed $includeDir/gcc/
mv $includeDir/gcc/include/c++ $includeDir/
### Strip #################################################
echo "Strip"
cd $installDir
strip bin/*
for f in cc1 cc1plus collect2 f951 lto1 lto-wrapper; do
strip $gccLibDir/$f
done
strip --strip-debug \
$gccLibDir/*.a \
$developLibDir/*.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 f951 lto1; do
addattr SYS:ENV DISABLE_ASLR=1 \
$gccLibDir/$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 gfortran; do
symlinkRelative -sfn $installDir/bin/$f $binDir
done
### Cleanup ###############################################
echo "Cleanup"
rm -rf $installDir/info
rm -rf $installDir/share
### Sub Packages ##########################################
packageEntries "fortran" \
$relativeBinDir/gfortran \
$developDir/tools/bin/*gfortran \
$installDir/$gccLibDir/f951 \
$installDir/$gccLibDir/finclude \
$installDir/$gccLibDir/libcaf_single.a \
$installDir/$gccLibDir/libgfortran.a \
$installDir/$gccLibDir/libgfortran.spec
rm -rf $installDir/$gccLibDir/{f951, finclude, libcaf_single*, libgfortran*}
packageEntries "syslibs" \
$relativeLibDir/libatomic.so \
$relativeLibDir/libatomic.so.$libatomicSoVersion \
$relativeLibDir/libatomic.so.$libatomicLibVersion \
$relativeLibDir/libgcc_s.so \
$relativeLibDir/libgcc_s.so.$libgccSoVersion \
$relativeLibDir/libgfortran.so \
$relativeLibDir/libgfortran.so.$libgfortranSoVersion \
$relativeLibDir/libgfortran.so.$libgfortranLibVersion \
$relativeLibDir/libgomp.so \
$relativeLibDir/libgomp.so.$libgompSoVersion \
$relativeLibDir/libgomp.so.$libgompLibVersion \
$relativeLibDir/libquadmath.so \
$relativeLibDir/libquadmath.so.$libquadmathSoVersion \
$relativeLibDir/libquadmath.so.$libquadmathLibVersion \
$relativeLibDir/libstdc++.so \
$relativeLibDir/libstdc++.so.$libstdcxxSoVersion \
$relativeLibDir/libstdc++.so.$libstdcxxLibVersion \
$relativeLibDir/libsupc++.so
packageEntries "syslibs_devel" \
$relativeDevelopLibDir/libatomic.a \
$relativeDevelopLibDir/libgcc.a \
$relativeDevelopLibDir/libgcc-kernel.a \
$relativeDevelopLibDir/libgcc_eh.a \
$relativeDevelopLibDir/libgcc_eh-kernel.a \
$relativeDevelopLibDir/libgomp.a \
$relativeDevelopLibDir/libquadmath.a \
$relativeDevelopLibDir/libstdc++.a \
$relativeDevelopLibDir/libsupc++.a \
$relativeDevelopLibDir/libsupc++-kernel.a \
$relativeIncludeDir
rm -rf $includeDir
rm -rf $developLibDir
}

View File

@@ -1,24 +0,0 @@
From e9e78f55996c23624ebd792eed57dd60a571daaa Mon Sep 17 00:00:00 2001
From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Date: Tue, 22 Jul 2014 01:32:29 +0000
Subject: Specify -save-temps for libgcc during dependency phase
This works around an internal compiler error when building
gcc for x86_64 with thread local storage enabled.
diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
index 2353c9c..93eada2 100644
--- a/libcpp/Makefile.in
+++ b/libcpp/Makefile.in
@@ -207,7 +207,7 @@ ifeq ($(DEPMODE),depmode=gcc3)
# Note that we put the dependencies into a .Tpo file, then move them
# into place if the compile succeeds. We need this because gcc does
# not atomically write the dependency output file.
-COMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Tpo
+COMPILE = $(COMPILE.base) -o $@ -save-temps -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Tpo
POSTCOMPILE = @mv $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
else
COMPILE = source='$<' object='$@' libtool=no DEPDIR=$(DEPDIR) $(DEPMODE) \
--
1.8.3.4

View File

@@ -1,95 +0,0 @@
From e9e78f55996c23624ebd792eed57dd60a571daaa Mon Sep 17 00:00:00 2001
From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Date: Tue, 22 Jul 2014 01:32:29 +0000
Subject: Specify -save-temps for libgcc during dependency phase
This works around an internal compiler error when building
gcc for x86_64 with thread local storage enabled.
diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
index 2353c9c..93eada2 100644
--- a/libcpp/Makefile.in
+++ b/libcpp/Makefile.in
@@ -207,7 +207,7 @@ ifeq ($(DEPMODE),depmode=gcc3)
# Note that we put the dependencies into a .Tpo file, then move them
# into place if the compile succeeds. We need this because gcc does
# not atomically write the dependency output file.
-COMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Tpo
+COMPILE = $(COMPILE.base) -o $@ -save-temps -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Tpo
POSTCOMPILE = @mv $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
else
COMPILE = source='$<' object='$@' libtool=no DEPDIR=$(DEPDIR) $(DEPMODE) \
--
1.8.3.4
From fc3eb46b47136ae82418e2a6f63f3e3d8e918c1f Mon Sep 17 00:00:00 2001
From: Oliver Tappe <zooey@hirschkaefer.de>
Date: Sat, 26 Jul 2014 13:19:29 +0200
Subject: Circumvent build problems on x86_64.
* Due to some yet unknown cause, --as-needed does not seem to work as
expected on x86_64, which causes the gcc build to fail when it checks
if it can execute built programs (as libgcc_s.so is needed by those
programs and can't be found). Circumvent the problem for now by creating
appropriate 'lib' symlinks such that libgcc_s.so will be found by
runtime_loader.
diff --git a/gmp/configure b/gmp/configure
index e8378cc..68c8d69 100755
--- a/gmp/configure
+++ b/gmp/configure
@@ -9378,7 +9378,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
-
+# create lib symlink such that the runtime loader will find libgcc_s.so
+ln -sfn ../prev-gcc lib
# The C compiler on the build system, and associated tests.
diff --git a/libquadmath/configure b/libquadmath/configure
index 76dfbdf..e58cf46 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -3381,6 +3381,9 @@ See \`config.log' for more details." "$LINENO" 5; }; }
fi
ac_exeext=$ac_cv_exeext
+# create lib symlink such that the runtime loader will find libgcc_s.so
+ln -sfn ../../gcc/ lib
+
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
diff --git a/libssp/configure b/libssp/configure
index c42affe..20e2b87 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -3361,6 +3361,9 @@ See \`config.log' for more details." "$LINENO" 5; }; }
fi
ac_exeext=$ac_cv_exeext
+# create lib symlink such that the runtime loader will find libgcc_s.so
+ln -sfn ../../gcc/ lib
+
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 6479114..72e04bd 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -3997,6 +3997,9 @@ See \`config.log' for more details." "$LINENO" 5; }; }
fi
ac_exeext=$ac_cv_exeext
+# create lib symlink such that the runtime loader will find libgcc_s.so
+ln -sfn ../../gcc/ lib
+
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
--
1.8.3.4

View File

@@ -1,127 +0,0 @@
From a5258ce3a2b1e87a6c56f2a41c3574fbd1dd9250 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 14 Jul 2015 16:01:28 +0000
Subject: Revert 4.8.5 import of gcc/var-tracking.c
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index f228464..0db1562 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -592,39 +592,6 @@ static void vt_add_function_parameters (void);
static bool vt_initialize (void);
static void vt_finalize (void);
-/* Callback for stack_adjust_offset_pre_post, called via for_each_inc_dec. */
-
-static int
-stack_adjust_offset_pre_post_cb (rtx, rtx op, rtx dest, rtx src, rtx srcoff,
- void *arg)
-{
- if (dest != stack_pointer_rtx)
- return 0;
-
- switch (GET_CODE (op))
- {
- case PRE_INC:
- case PRE_DEC:
- ((HOST_WIDE_INT *)arg)[0] -= INTVAL (srcoff);
- return 0;
- case POST_INC:
- case POST_DEC:
- ((HOST_WIDE_INT *)arg)[1] -= INTVAL (srcoff);
- return 0;
- case PRE_MODIFY:
- case POST_MODIFY:
- /* We handle only adjustments by constant amount. */
- gcc_assert (GET_CODE (src) == PLUS
- && CONST_INT_P (XEXP (src, 1))
- && XEXP (src, 0) == stack_pointer_rtx);
- ((HOST_WIDE_INT *)arg)[GET_CODE (op) == POST_MODIFY]
- -= INTVAL (XEXP (src, 1));
- return 0;
- default:
- gcc_unreachable ();
- }
-}
-
/* Given a SET, calculate the amount of stack adjustment it contains
PRE- and POST-modifying stack pointer.
This function is similar to stack_adjust_offset. */
@@ -650,12 +617,68 @@ stack_adjust_offset_pre_post (rtx pattern, HOST_WIDE_INT *pre,
*post += INTVAL (XEXP (src, 1));
else
*post -= INTVAL (XEXP (src, 1));
- return;
}
- HOST_WIDE_INT res[2] = { 0, 0 };
- for_each_inc_dec (&pattern, stack_adjust_offset_pre_post_cb, res);
- *pre += res[0];
- *post += res[1];
+ else if (MEM_P (dest))
+ {
+ /* (set (mem (pre_dec (reg sp))) (foo)) */
+ src = XEXP (dest, 0);
+ code = GET_CODE (src);
+
+ switch (code)
+ {
+ case PRE_MODIFY:
+ case POST_MODIFY:
+ if (XEXP (src, 0) == stack_pointer_rtx)
+ {
+ rtx val = XEXP (XEXP (src, 1), 1);
+ /* We handle only adjustments by constant amount. */
+ gcc_assert (GET_CODE (XEXP (src, 1)) == PLUS &&
+ CONST_INT_P (val));
+
+ if (code == PRE_MODIFY)
+ *pre -= INTVAL (val);
+ else
+ *post -= INTVAL (val);
+ break;
+ }
+ return;
+
+ case PRE_DEC:
+ if (XEXP (src, 0) == stack_pointer_rtx)
+ {
+ *pre += GET_MODE_SIZE (GET_MODE (dest));
+ break;
+ }
+ return;
+
+ case POST_DEC:
+ if (XEXP (src, 0) == stack_pointer_rtx)
+ {
+ *post += GET_MODE_SIZE (GET_MODE (dest));
+ break;
+ }
+ return;
+
+ case PRE_INC:
+ if (XEXP (src, 0) == stack_pointer_rtx)
+ {
+ *pre -= GET_MODE_SIZE (GET_MODE (dest));
+ break;
+ }
+ return;
+
+ case POST_INC:
+ if (XEXP (src, 0) == stack_pointer_rtx)
+ {
+ *post -= GET_MODE_SIZE (GET_MODE (dest));
+ break;
+ }
+ return;
+
+ default:
+ return;
+ }
+ }
}
/* Given an INSN, calculate the amount of stack adjustment it contains
--
1.8.3.4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,35 +0,0 @@
From 0f079ce672177b678b40d19c28e12f18f9bbbcda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Mon, 27 Jul 2015 16:32:32 +0200
Subject: Haiku: disable -fno-PIE as this fails on x86_64.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6bac55d..51cb015 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -264,7 +264,7 @@ NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
NO_PIE_FLAG = @NO_PIE_FLAG@
# We don't want to compile the compilers with -fPIE, it make PCH fail.
-COMPILER += $(NO_PIE_CFLAGS)
+#COMPILER += $(NO_PIE_CFLAGS)
# Link with -no-pie since we compile the compiler with -fno-PIE.
LINKER += $(NO_PIE_FLAG)
@@ -764,9 +764,9 @@ NO_PIE_CFLAGS_FOR_BUILD = @NO_PIE_CFLAGS_FOR_BUILD@
NO_PIE_FLAG_FOR_BUILD = @NO_PIE_FLAG_FOR_BUILD@
BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE
BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ -DGENERATOR_FILE
-BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@
-BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS)
-BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS)
+#BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@
+#BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS)
+#BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS)
# Native compiler that we use. This may be C++ some day.
COMPILER_FOR_BUILD = $(CXX_FOR_BUILD)
--
2.2.2