Unified
Split
Showing
with
315 additions
and 0 deletions.
- +315 −0 sys-devel/gcc_bootstrap/gcc_bootstrap-7.3.0_2019_04_04.recipe
| @@ -0,0 +1,315 @@ | ||
| SUMMARY="C/C++ cross-compiler for target ${effectiveTargetMachineTriple}" | ||
| DESCRIPTION="Standard compiler for x86 platform." | ||
| HOMEPAGE="https://gcc.gnu.org" | ||
| LICENSE=" | ||
| GNU GPL v3 | ||
| GNU LGPL v3 | ||
| " | ||
| COPYRIGHT="1988-2018 Free Software Foundation, Inc." | ||
| srcGitRev="931a9c38d588f1d05410c371bbec61cc26d8f520" | ||
| SOURCE_URI="https://github.com/haiku/buildtools/archive/$srcGitRev.tar.gz" | ||
| CHECKSUM_SHA256="e44b26716f49e842fd0ec4c456085a36d2c2ab2a1eb3646c20266d3c72d1157b" | ||
| REVISION="1" | ||
|
|
||
| ARCHITECTURES="!x86_gcc2 sparc riscv64" | ||
| SECONDARY_ARCHITECTURES="?x86" | ||
|
|
||
| libstdcxxSoVersion="6" | ||
| libstdcxxLibVersion="6.0.24" | ||
|
|
||
| libgccSoVersion="1" | ||
| libgccLibVersion="1" | ||
|
|
||
| PROVIDES=" | ||
| gcc_bootstrap$secondaryArchSuffix = $portVersion compat >= 5 | ||
| 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_7.3.0$secondaryArchSuffix = $portVersion compat >= 5 | ||
| cmd:gcov$secondaryArchSuffix = $portVersion compat >= 5 | ||
| " | ||
|
|
||
| REQUIRES=" | ||
| haiku$secondaryArchSuffix | ||
| " | ||
| BUILD_REQUIRES=" | ||
| " | ||
| BUILD_PREREQUIRES=" | ||
| haiku${secondaryArchSuffix}_devel | ||
| binutils_cross_${effectiveTargetArchitecture} | ||
| gcc_cross_${effectiveTargetArchitecture} | ||
| cmd:autoconf | ||
| cmd:awk | ||
| cmd:flex | ||
| cmd:gcc | ||
| cmd:make | ||
| cmd:makeinfo | ||
| cmd:sed | ||
| cmd:tar | ||
| cmd:xargs | ||
| " | ||
|
|
||
| SOURCE_DIR="buildtools-$srcGitRev/gcc" | ||
|
|
||
| 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 | ||
| 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 | ||
| if [ $effectiveTargetArchitecture == arm ]; then | ||
| # disable multilib support, as x86_64 by default tries to build the | ||
| # soft-float libraries, too, which fails as no soft float libroot is | ||
| # available | ||
| additionalConfigureFlags+=" --disable-multilib --with-float=hard" | ||
|
|
||
| # TODO: Disable building wtih TLS support for ARM until implemented | ||
| additionalConfigureFlags+=" --disable-tls" | ||
| fi | ||
| if [ $effectiveTargetArchitecture == riscv64 ]; then | ||
| additionalConfigureFlags+=" --disable-multilib" | ||
| fi | ||
| if [ $effectiveTargetArchitecture == powerpc ]; then | ||
| # TODO: Disable building wtih TLS support for ARM until implemented | ||
| additionalConfigureFlags+=" --disable-tls" | ||
| fi | ||
|
|
||
| export ac_cv_c_bigendian=no | ||
| CFLAGS="-O2 -U_FORTIFY_SOURCE" CXXFLAGS="-O2" "$sourceDir/configure" \ | ||
| --build=$buildMachineTriple --host=$effectiveTargetMachineTriple \ | ||
| --target=$effectiveTargetMachineTriple --prefix=$installDir \ | ||
| --libexecdir=$installDir/lib --mandir=$manDir --docdir=$docDir \ | ||
| --disable-nls --enable-shared --disable-plugin \ | ||
| --enable-version-specific-runtime-libs \ | ||
| --enable-languages=c,c++ --enable-lto --enable-frame-pointer \ | ||
| --enable-threads=posix --enable-tls \ | ||
| --with-pkgversion=$(echo $portVersion | cut -c 7-) \ | ||
| --with-sysroot=/ \ | ||
| --with-build-sysroot=$installDestDir/ \ | ||
| --with-threads=posix \ | ||
| --with-default-libstdcxx-abi=gcc4-compatible \ | ||
| --disable-libstdcxx-pch \ | ||
| $additionalConfigureFlags | ||
| # Note: The --with-sysroot=/ is rather silly, but --with-build-sysroot | ||
| # only works when --with-sysroot has been given as well. | ||
| # Note: '--disable-plugin' circumvents what seems to be a gcc bug: | ||
| # when building with plugin support, the build fails for gengtype.c, | ||
| # where build machine configuration (bconfig.h) and Haiku headers | ||
| # (stdio.h) are getting mixed up. | ||
|
|
||
| make $jobArgs | ||
|
|
||
| # 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 | ||
| mv saved/* . | ||
| rmdir saved | ||
| cd $objectsDir/$effectiveTargetMachineTriple/libstdc++-v3/libsupc++ | ||
| # build kernel version of libsupc++.a (without threads or TLS) | ||
| mkdir -p saved | ||
| mv .libs/libsupc++* 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_HAVE_TLS 1,/* #undef _GLIBCXX_HAVE_TLS */,' \ | ||
| "../include/$effectiveTargetMachineTriple/bits/c++config.h" | ||
| sed -i -e 's,#define _GLIBCXX_HAS_GTHREADS 1,/* #undef _GLIBCXX_HAS_GTHREADS */,' \ | ||
| "../config.h" | ||
| make CFLAGS="-O2 $kernelCcFlags" CXXFLAGS="-O2 $kernelCcFlags" | ||
| mv .libs/libsupc++.a .libs/libsupc++-kernel.a | ||
| mv saved/* .libs/ | ||
| rmdir saved | ||
| } | ||
|
|
||
| INSTALL() | ||
| { | ||
| cd $objectsDir | ||
|
|
||
| make DESTDIR=$installDestDir install | ||
|
|
||
| ### 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 $installDestDir$libDir | ||
| mkdir -p $installDestDir$developLibDir | ||
| cd $installDestDir$installDir | ||
| gccLibDir=lib/gcc/$effectiveTargetMachineTriple/$gccVersion | ||
|
|
||
| # libstdc++ | ||
| $effectiveTargetMachineTriple-strip --strip-debug \ | ||
| $gccLibDir/libstdc++.so.$libstdcxxLibVersion | ||
| cp -d $gccLibDir/libstdc++.so \ | ||
| $gccLibDir/libstdc++.so.$libstdcxxSoVersion \ | ||
| $gccLibDir/libstdc++.so.$libstdcxxLibVersion \ | ||
| $installDestDir$libDir/ | ||
| cp $gccLibDir/libstdc++*.a $installDestDir$developLibDir/ | ||
|
|
||
| # libsupc++ | ||
| libstdcxxDir=$objectsDir/$effectiveTargetMachineTriple/libstdc++-v3 | ||
| cp $libstdcxxDir/libsupc++/.libs/libsupc++-kernel.a \ | ||
| $gccLibDir/ | ||
| ln -s libstdc++.so $installDestDir$libDir/libsupc++.so | ||
| cp $gccLibDir/libsupc++*.a $installDestDir$developLibDir/ | ||
|
|
||
| # libgcc | ||
| cp $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc-kernel.a \ | ||
| $objectsDir/$effectiveTargetMachineTriple/libgcc/libgcc_eh-kernel.a \ | ||
| $gccLibDir/ | ||
| $effectiveTargetMachineTriple-strip --strip-debug \ | ||
| $gccLibDir/libgcc_s.so.$libgccSoVersion | ||
| cp -d $gccLibDir/libgcc_s.so \ | ||
| $gccLibDir/libgcc_s.so.$libgccSoVersion \ | ||
| $installDestDir$libDir/ | ||
| cp $gccLibDir/libgcc*.a $installDestDir$developLibDir/ | ||
|
|
||
| # gcc and c++ headers | ||
| mkdir -p $installDestDir$includeDir/gcc | ||
| cp -r $gccLibDir/include $installDestDir$includeDir/gcc/ | ||
| cp -r $gccLibDir/include-fixed $installDestDir$includeDir/gcc/ | ||
| mv $installDestDir$includeDir/gcc/include/c++ $installDestDir$includeDir/ | ||
|
|
||
| ### Strip ################################################# | ||
|
|
||
| echo "Strip debug info" | ||
|
|
||
| cd $installDestDir$installDir | ||
| $effectiveTargetMachineTriple-strip --strip-debug bin/* | ||
| for f in cc1 cc1plus collect2 lto1 lto-wrapper; do | ||
| $effectiveTargetMachineTriple-strip --strip-debug \ | ||
| lib/gcc/$effectiveTargetMachineTriple/*/$f | ||
| done | ||
|
|
||
| ### Symlinks ############################################## | ||
|
|
||
| echo "Creating required symlinks" | ||
|
|
||
| # create missing cc symlink | ||
| ln -sf gcc $installDestDir$installDir/bin/cc | ||
|
|
||
| # make all tools available via default paths | ||
| mkdir -p $installDestDir$binDir | ||
| for f in c++ cc cpp g++ gcc gcov; do | ||
| symlinkRelative -sfn $installDestDir$installDir/bin/$f \ | ||
| $installDestDir$binDir | ||
| done | ||
|
|
||
| # replace a few copies with symlinks | ||
| for f in gcc-ar gcc-ranlib gcc gcc-nm g++ c++; do | ||
| ln -sf $f \ | ||
| $installDestDir$installDir/bin/${effectiveTargetMachineTriple}-$f | ||
| done | ||
|
|
||
| local mainVersion=$(echo $portVersion | sed 's,_.*,,') | ||
| ln -sfn gcc \ | ||
| $installDestDir$installDir/bin/${effectiveTargetMachineTriple}-gcc-$mainVersion | ||
| ln -sfn g++ $installDestDir$installDir/bin/c++ | ||
|
|
||
| ### Cleanup ############################################### | ||
|
|
||
| echo "Cleanup" | ||
| rm -rf $installDestDir$installDir/info | ||
| rm -rf $installDestDir$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 $installDestDir$includeDir | ||
| rm -rf $installDestDir$developLibDir | ||
| } | ||
|
|
||
| # ----- syslibs package ----------------------------------------------------- | ||
|
|
||
| SUMMARY_syslibs="\ | ||
| GCC 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_bootstrap${secondaryArchSuffix}_syslibs = $portVersion compat >= 5 | ||
| 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="\ | ||
| GCC 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_bootstrap${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 5 | ||
| gcc${secondaryArchSuffix}_syslibs_devel = $portVersion compat >= 5 | ||
| devel:libgcc_kernel$secondaryArchSuffix | ||
| devel:libgcc$secondaryArchSuffix | ||
| devel:libgcc_eh_kernel$secondaryArchSuffix | ||
| devel:libgcc_eh$secondaryArchSuffix | ||
| devel:libstdc++$secondaryArchSuffix | ||
| devel:libsupc++_kernel$secondaryArchSuffix | ||
| devel:libsupc++$secondaryArchSuffix | ||
| " | ||
|
|
||
| REQUIRES_syslibs_devel="" |