529 lines
18 KiB
Bash
529 lines
18 KiB
Bash
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="https://gcc.gnu.org/"
|
|
COPYRIGHT="1988-2019 Free Software Foundation, Inc."
|
|
LICENSE="GNU GPL v3
|
|
GNU LGPL v3"
|
|
REVISION="14"
|
|
gccVersion="${portVersion%%_*}"
|
|
SOURCE_URI="https://ftpmirror.gnu.org/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.xz
|
|
https://ftp.gnu.org/gnu/gcc/gcc-$gccVersion/gcc-$gccVersion.tar.xz"
|
|
CHECKSUM_SHA256="64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c"
|
|
SOURCE_DIR="gcc-$gccVersion"
|
|
PATCHES="gcc-$portVersion.patchset"
|
|
|
|
ARCHITECTURES="all !x86_gcc2 ?x86 ?ppc"
|
|
SECONDARY_ARCHITECTURES="x86"
|
|
|
|
libatomicSoVersion="1"
|
|
libatomicLibVersion="1.2.0"
|
|
|
|
libgccSoVersion="1"
|
|
libgccLibVersion="1"
|
|
|
|
libgfortranSoVersion="5"
|
|
libgfortranLibVersion="5.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.25"
|
|
|
|
PROVIDES="
|
|
gcc$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_ar$secondaryArchSuffix = $portVersion compat >= 7
|
|
cmd:gcc_nm$secondaryArchSuffix = $portVersion compat >= 7
|
|
cmd:gcc_ranlib$secondaryArchSuffix = $portVersion compat >= 7
|
|
cmd:gcov$secondaryArchSuffix = $portVersion compat >= 7
|
|
cmd:gcov_dump$secondaryArchSuffix = $portVersion compat >= 7
|
|
cmd:gcov_tool$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="
|
|
gcc${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
|
|
gcc${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="
|
|
gcc${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:libssp$secondaryArchSuffix = $libsspLibVersion compat >= $libsspSoVersion
|
|
lib:libstdc++$secondaryArchSuffix = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
|
|
lib:libsupc++$secondaryArchSuffix = $portVersion compat >= 7
|
|
"
|
|
REQUIRES_syslibs="
|
|
haiku$secondaryArchSuffix
|
|
lib:libz$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="
|
|
gcc${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 7
|
|
devel:libatomic$secondaryArchSuffix = $libatomicLibVersion compat >= $libatomicSoVersion
|
|
devel:libgcc$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
devel:libgcc_boot$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
devel:libgcc_eh$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
devel:libgcc_eh_boot$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
devel:libgcc_eh_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
devel:libgcc_kernel$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
devel:libgcc_s$secondaryArchSuffix = $libgccLibVersion compat >= $libgccSoVersion
|
|
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 = $libstdcxxLibVersion compat >= $libstdcxxSoVersion
|
|
devel:libstdc++fs$secondaryArchSuffix = $portVersion compat >= 7
|
|
devel:libsupc++$secondaryArchSuffix = $portVersion compat >= 7
|
|
devel:libsupc++_boot$secondaryArchSuffix = $portVersion compat >= 7
|
|
devel:libsupc++_kernel$secondaryArchSuffix = $portVersion compat >= 7
|
|
"
|
|
REQUIRES_syslibs_devel=""
|
|
|
|
BUILD_REQUIRES="
|
|
haiku${secondaryArchSuffix}_devel
|
|
devel:libgmp$secondaryArchSuffix >= 10.4.0
|
|
devel:libmpc$secondaryArchSuffix >= 3.2
|
|
devel:libmpfr$secondaryArchSuffix >= 6.1
|
|
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
|
|
"
|
|
|
|
relativeInstallDir="develop/tools$secondaryArchSubDir"
|
|
installDir="$prefix/$relativeInstallDir"
|
|
objectsDir=$sourceDir/../${portVersionedName}-obj
|
|
gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion
|
|
|
|
defineDebugInfoPackage gcc$secondaryArchSuffix \
|
|
"$gccLibDir"/cc1 \
|
|
"$gccLibDir"/cc1obj \
|
|
"$gccLibDir"/cc1plus \
|
|
"$gccLibDir"/collect2 \
|
|
"$gccLibDir"/lto1 \
|
|
"$gccLibDir"/lto-wrapper \
|
|
"$installDir/bin"/cpp \
|
|
"$installDir/bin"/g++ \
|
|
"$installDir/bin"/gcc \
|
|
"$installDir/bin"/gcc-ar \
|
|
"$installDir/bin"/gcc-nm \
|
|
"$installDir/bin"/gcc-ranlib \
|
|
"$installDir/bin"/gcov \
|
|
"$installDir/bin"/gcov-dump \
|
|
"$installDir/bin"/gcov-tool \
|
|
"$(getPackagePrefix fortran)/$relativeInstallDir"/bin/gfortran \
|
|
"$(getPackagePrefix fortran)/$relativeInstallDir/$gccLibDir"/f951 \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libatomic.so.$libatomicLibVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libgcc_s.so.$libgccSoVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libgfortran.so.$libgfortranLibVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libgomp.so.$libgompLibVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libquadmath.so.$libquadmathLibVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libssp.so.$libsspLibVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libstdc++.so.$libstdcxxLibVersion \
|
|
"$(getPackagePrefix syslibs)/$relativeLibDir"/libsupc++.so
|
|
|
|
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,objc --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-kernel ###"
|
|
|
|
# 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 $jobArgs 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++-kernel ###"
|
|
|
|
# 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 $jobArgs 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
|
|
|
|
local bootCcFlags
|
|
if [ $effectiveTargetArchitecture == arm ]; then
|
|
# EFI arm (32-bit) requires software fp
|
|
bootCcFlags+="-mfloat-abi=soft -nostartfiles -fshort-wchar";
|
|
fi
|
|
|
|
echo "### libgcc-boot ###"
|
|
|
|
# build bootloader version of libgcc and libgcc_eh.a (no threads, TLS)
|
|
cd $objectsDir/$effectiveTargetMachineTriple/libgcc
|
|
mkdir -p saved
|
|
mv libgcc.a libgcc_eh.a libgcc_s* libgcov* libgcc-kernel.a libgcc_eh-kernel.a saved/
|
|
make clean
|
|
ln -sfn "$sourceDir/libgcc/gthr-single.h" gthr-default.h
|
|
make $jobArgs CFLAGS="-O2 $bootCcFlags" CXXFLAGS="-O2 $bootCcFlags"
|
|
mv libgcc.a libgcc-boot.a
|
|
mv libgcc_eh.a libgcc_eh-boot.a
|
|
ln -sfn "$sourceDir/libgcc/gthr-posix.h" gthr-default.h
|
|
mv saved/* .
|
|
rmdir saved
|
|
|
|
echo "### libsupc++-boot ###"
|
|
|
|
# build bootloader 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
|
|
# deactivate threads and tls support
|
|
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 $jobArgs CFLAGS="-O2 $bootCcFlags" CXXFLAGS="-O2 $bootCcFlags"
|
|
mv .libs/libsupc++.a .libs/libsupc++-boot.a
|
|
mv saved/* .libs/
|
|
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
|
|
|
|
# libatomic
|
|
cp -d $gccLibDir/libatomic.so \
|
|
$gccLibDir/libatomic.so.$libatomicSoVersion \
|
|
$gccLibDir/libatomic.so.$libatomicLibVersion \
|
|
$libDir/
|
|
rm $gccLibDir/libatomic*.a
|
|
|
|
# libgfortran
|
|
cp -d $gccLibDir/libgfortran.so \
|
|
$gccLibDir/libgfortran.so.$libgfortranSoVersion \
|
|
$gccLibDir/libgfortran.so.$libgfortranLibVersion \
|
|
$libDir/
|
|
cp $gccLibDir/libgfortran*.a $developLibDir/
|
|
|
|
# libgomp
|
|
cp -d $gccLibDir/libgomp.so \
|
|
$gccLibDir/libgomp.so.$libgompSoVersion \
|
|
$gccLibDir/libgomp.so.$libgompLibVersion \
|
|
$libDir/
|
|
rm $gccLibDir/libgomp*.a
|
|
|
|
# libquadmath
|
|
cp -d $gccLibDir/libquadmath.so \
|
|
$gccLibDir/libquadmath.so.$libquadmathSoVersion \
|
|
$gccLibDir/libquadmath.so.$libquadmathLibVersion \
|
|
$libDir/
|
|
rm $gccLibDir/libquadmath*.a
|
|
|
|
# libssp
|
|
cp -d $gccLibDir/libssp.so \
|
|
$gccLibDir/libssp.so.$libsspSoVersion \
|
|
$gccLibDir/libssp.so.$libsspLibVersion \
|
|
$libDir/
|
|
rm $gccLibDir/libssp.a
|
|
cp $gccLibDir/libssp_nonshared.a $developLibDir
|
|
|
|
# libstdc++
|
|
cp -d $gccLibDir/libstdc++.so \
|
|
$gccLibDir/libstdc++.so.$libstdcxxSoVersion \
|
|
$gccLibDir/libstdc++.so.$libstdcxxLibVersion \
|
|
$libDir/
|
|
rm $gccLibDir/libstdc++.a
|
|
cp $gccLibDir/libstdc++fs.a $developLibDir
|
|
|
|
# libsupc++
|
|
libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3
|
|
cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \
|
|
$gccLibDir/
|
|
cp $libstdcxxDir/libsupc++/.libs/libsupc++-boot.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/
|
|
cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-boot.a \
|
|
$objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-boot.a \
|
|
$gccLibDir/
|
|
cp -d $gccLibDir/libgcc_s.so \
|
|
$gccLibDir/libgcc_s.so.$libgccSoVersion \
|
|
$libDir/
|
|
cp $gccLibDir/libgcc*.a $developLibDir/
|
|
|
|
# merge libssp_nonshared.a in libgcc.a on x86
|
|
if [ "$targetArchitecture" = "x86_gcc2" ]; then
|
|
(mkdir temp_libgcc; cd temp_libgcc; ar x ../$gccLibDir/libssp_nonshared.a;
|
|
ar x ../$gccLibDir/libgcc.a; cd ..)
|
|
ar -qc $developLibDir/libgcc.a temp_libgcc/*.o
|
|
cp $developLibDir/libgcc.a $gccLibDir/libgcc.a
|
|
rm -rf temp_libgcc
|
|
fi
|
|
|
|
# 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"
|
|
|
|
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 gcc-ar gcc-nm gcc-ranlib; do
|
|
symlinkRelative -sfn $installDir/bin/$f $binDir
|
|
done
|
|
|
|
# symlink all libraries from libDir -> developLibDir
|
|
mkdir -p $developLibDir
|
|
for l in libatomic libgomp libquadmath libssp libgcc_s libstdc++ \
|
|
libsupc++; do
|
|
for f in $libDir/$l*; do
|
|
symlinkRelative -sfn $f $developLibDir/
|
|
done
|
|
done
|
|
|
|
### Cleanup ###############################################
|
|
|
|
echo "Cleanup"
|
|
rm -rf $installDir/info
|
|
rm -rf $installDir/share
|
|
rm -rf $installDir/$gccLibDir/*.la
|
|
rm -rf $installDir/$gccLibdir/libobjc.*
|
|
rm -rf $installDir/$gccLibdir/include/objc
|
|
rm -rf $includeDir/gcc/include/objc
|
|
|
|
### Sub Packages ##########################################
|
|
|
|
packageEntries "fortran" \
|
|
$relativeBinDir/gfortran \
|
|
$developDir/tools$secondaryArchSubDir/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/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" \
|
|
$developLibDir/*.so* \
|
|
$developLibDir/libgcc.a \
|
|
$developLibDir/libgcc-boot.a \
|
|
$developLibDir/libgcc_eh.a \
|
|
$developLibDir/libgcc_eh-kernel.a \
|
|
$developLibDir/libgcc_eh-boot.a \
|
|
$developLibDir/libgcc-kernel.a \
|
|
$developLibDir/libssp_nonshared.a \
|
|
$developLibDir/libstdc++fs.a \
|
|
$developLibDir/libsupc++.a \
|
|
$developLibDir/libsupc++-boot.a \
|
|
$developLibDir/libsupc++-kernel.a \
|
|
$relativeIncludeDir
|
|
|
|
rm -rf $includeDir
|
|
rm -rf $developLibDir
|
|
}
|