Unified
Split
Showing
with
3,619 additions
and 0 deletions.
- +347 −0 sys-devel/gcc/gcc-5.4.0_2016_06_04.recipe
- +3,272 −0 sys-devel/gcc/patches/gcc-5.4.0_2016_06_04.patchset
| @@ -0,0 +1,347 @@ | ||
| 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.4.0/gcc-5.4.0.tar.bz2" | ||
| CHECKSUM_SHA256="608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a" | ||
| REVISION="1" | ||
| LICENSE=" | ||
| GNU GPL v3 | ||
| GNU LGPL v3 | ||
| " | ||
| COPYRIGHT="1988-2015 Free Software Foundation, Inc." | ||
|
|
||
| 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" | ||
|
|
||
| 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.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 | ||
| " | ||
|
|
||
| SOURCE_DIR="gcc-5.4.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="" |
Oops, something went wrong.