diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 348 |
1 files changed, 240 insertions, 108 deletions
@@ -1,111 +1,168 @@ -# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc +# Merged with official ABS gcc PKGBUILD by João, 2021/08/03 (all respective contributors apply herein) +# Co-Maintainer: Peter Jung & CachyOS <admin@ptr1337.dev> +# Maintainer: João Figueiredo & chaotic-aur <islandc0der@chaotic.cx> + +# toolchain build order: linux-api-headers->glibc->binutils->gcc->glibc->binutils->gcc # NOTE: libtool requires rebuilt with each new gcc version -pkgname=(gcc-git gcc-libs-git gcc-fortran-git gcc-objc-git gcc-ada-git gcc-go-git lib32-gcc-libs-gitb gcc-d-git) -pkgver=11.0.0.r182655.6d0b075d662 +# You probably don't need support for all the languages, feel free to remove the ones you don't; +# Just edit the --enable-languages option as well as the pkgname array, and comment out the pkg functions :) + +pkgbase=gcc-git +pkgname=({gcc,gcc-libs,lib32-gcc-libs,gcc-fortran,gcc-rust,gcc-objc,gcc-ada,gcc-d,lto-dump,gcc-go,libgccjit}-git) +pkgver=13.0.0_r197401.g33be3ee36a7 _majorver=${pkgver%%.*} -_islver=0.23 pkgrel=1 pkgdesc='The GNU Compiler Collection' arch=(x86_64) -license=(GPL LGPL FDL custom) +license=(GPL-3.0-with-GCC-exception GFDL-1.3-or-later) url='https://gcc.gnu.org' -makedepends=(binutils libmpc gcc-ada doxygen lib32-glibc lib32-gcc-libs python git) -checkdepends=(dejagnu inetutils) -options=(!emptydirs) -_libdir=usr/lib/gcc/$CHOST/11.0.0 -source=(git+https://gcc.gnu.org/git/gcc.git - http://isl.gforge.inria.fr/isl-${_islver}.tar.xz - c89 c99 +makedepends=( + binutils + doxygen + gcc-ada + gcc-d + git + lib32-glibc + lib32-gcc-libs + libisl + libmpc + python + zstd +) +checkdepends=( + dejagnu + expect + inetutils + python-pytest + tcl +) +options=(!emptydirs !lto) +_libdir=usr/lib/gcc/$CHOST/${pkgver%_*} +source=(git://gcc.gnu.org/git/gcc.git + c89 c99 + gcc-ada-repro.patch ) -b2sums=('SKIP' - 'ce026eaa1d6c814f4067c555d97a453bdf01d5fa240aa9b6ccd22c9a0e7f19b0c30cd834f976a29b10a5d57eaa747a3f45cf55717f05d98ae405ec93dd42f27b' - '2c64090b879d6faea7f20095eff1b9bd6a09fe3b15b3890783d3715171678ab62d32c91af683b878746fb14441dbe09768474417840f96a561443415f76afb63' - '3cf318835b9833ac7c5d3a6026fff8b4f18b098e18c9649d00e32273688ff06ec3af41f0d0aee9d2261725e0ff08f47a224ccfe5ebb06646aaf318ff8ac9a0d1') +sha256sums=('SKIP' + 'de48736f6e4153f03d0a5d38ceb6c6fdb7f054e8f47ddd6af0a3dbf14f27b931' + '2513c6d9984dd0a2058557bf00f06d8d5181734e41dcfe07be7ed86f2959622a' + '1773f5137f08ac1f48f0f7297e324d5d868d55201c03068670ee4602babdef2f') pkgver() { - cd gcc - echo $(cat gcc/BASE-VER).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD) + cd ${pkgbase%-git} + echo "$(cat gcc/BASE-VER)_r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)" } prepare() { + [[ ! -d gcc ]] && ln -s gcc-${pkgver/+/-} gcc cd gcc - # link isl for in-tree build - ln -s ../isl-${_islver} isl - # Do not run fixincludes sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in # Arch Linux installs x86_64 libraries /lib sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 - # hack! - some configure tests for header files using "$CPP $CPPFLAGS" - sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure + # Reproducible gcc-ada + patch -Np0 < "$srcdir/gcc-ada-repro.patch" mkdir -p "$srcdir/gcc-build" + mkdir -p "$srcdir/libgccjit-build" } build() { + local _confflags=( + --prefix=/usr + --libdir=/usr/lib + --libexecdir=/usr/lib + --mandir=/usr/share/man + --infodir=/usr/share/info + --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues \ + --with-build-config=bootstrap-lto + --with-linker-hash-style=gnu + --with-system-zlib + --enable-__cxa_atexit + --enable-cet=auto + --enable-checking=release + --enable-clocale=gnu + --enable-default-pie + --enable-default-ssp + --enable-gnu-indirect-function + --enable-gnu-unique-object + --enable-libstdcxx-backtrace + --enable-link-serialization=1 + --enable-linker-build-id + --enable-lto + --enable-multilib + --enable-plugin + --enable-shared + --enable-threads=posix + --disable-libssp + --disable-libstdcxx-pch + --disable-werror + ) + cd gcc-build - # using -pipe causes spurious test-suite failures - # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565 - CFLAGS=${CFLAGS/-pipe/} - CXXFLAGS=${CXXFLAGS/-pipe/} - - "$srcdir/gcc/configure" --prefix=/usr \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib \ - --mandir=/usr/share/man \ - --infodir=/usr/share/info \ - --with-bugurl=https://bugs.archlinux.org/ \ - --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d \ - --with-isl \ - --with-linker-hash-style=gnu \ - --with-system-zlib \ - --enable-__cxa_atexit \ - --enable-cet=auto \ - --enable-checking=release \ - --enable-clocale=gnu \ - --enable-default-pie \ - --enable-default-ssp \ - --enable-gnu-indirect-function \ - --enable-gnu-unique-object \ - --enable-install-libiberty \ - --enable-linker-build-id \ - --enable-lto \ - --enable-multilib \ - --enable-plugin \ - --enable-shared \ - --enable-threads=posix \ - --disable-libssp \ - --disable-libstdcxx-pch \ - --disable-libunwind-exceptions \ - --disable-werror \ - gdc_include_dir=/usr/include/dlang/gdc - - make + # Credits @allanmcrae + # https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/gcc/PKGBUILD + # TODO: properly deal with the build issues resulting from this + CFLAGS=${CFLAGS/-Werror=format-security/} + CXXFLAGS=${CXXFLAGS/-Werror=format-security/} + + "$srcdir/gcc/configure" \ + --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust \ + --enable-bootstrap \ + "${_confflags[@]:?_confflags unset}" + + # see https://bugs.archlinux.org/task/71777 for rationale re *FLAGS handling + make -O STAGE1_CFLAGS="-O2" \ + BOOT_CFLAGS="$CFLAGS" \ + BOOT_LDFLAGS="$LDFLAGS" \ + LDFLAGS_FOR_TARGET="$LDFLAGS" \ + bootstrap # make documentation - make -C $CHOST/libstdc++-v3/doc doc-man-doxygen + make -O -C $CHOST/libstdc++-v3/doc doc-man-doxygen + + # Build libgccjit separately, to avoid building all compilers with --enable-host-shared + # which brings a performance penalty + cd "${srcdir}"/libgccjit-build + + "$srcdir/gcc/configure" \ + --enable-languages=jit \ + --disable-bootstrap \ + --enable-host-shared \ + "${_confflags[@]:?_confflags unset}" + + # see https://bugs.archlinux.org/task/71777 for rationale re *FLAGS handling + make -O STAGE1_CFLAGS="-O2" \ + BOOT_CFLAGS="$CFLAGS" \ + BOOT_LDFLAGS="$LDFLAGS" \ + LDFLAGS_FOR_TARGET="$LDFLAGS" \ + all-gcc + + cp -a gcc/libgccjit.so* ../gcc-build/gcc/ } check() { cd gcc-build + # disable libphobos test to avoid segfaults + sed -i '/maybe-check-target-libphobos \\/d' Makefile + # do not abort on error as some are "expected" - make -k check || true + make -O -k check || true "$srcdir/gcc/contrib/test_summary" } - package_gcc-libs-git() { - pkgdesc='Runtime libraries shipped by GCC' + pkgdesc='Runtime libraries shipped by GCC (git version)' depends=('glibc>=2.27') - options+=(!strip) - provides=(gcc-libs-multilib=${pkgver}-${pkgrel} libgo.so=${pkgver}-${pkgrel} libgfortran.so=${pkgver}-${pkgrel} libgphobos.so=${pkgver}-${pkgrel} - libubsan.so=${pkgver}-${pkgrel} libasan.so=${pkgver}-${pkgrel} libtsan.so=${pkgver}-${pkgrel} liblsan.so=${pkgver}-${pkgrel} gcc-libs=${pkgver}-${pkgrel}) + options=(!emptydirs !strip) + provides=("gcc-libs-git=$pkgver-$pkgrel" gcc-libs gcc-multilib{,-git} libgo.so libgfortran.so + libubsan.so libasan.so libtsan.so liblsan.so libgphobos.so) conflicts=(gcc-libs) + replaces=(gcc-multilib-git libgphobos-git) cd gcc-build make -C $CHOST/libgcc DESTDIR="$pkgdir" install-shared @@ -136,7 +193,7 @@ package_gcc-libs-git() { make -C $CHOST/$lib DESTDIR="$pkgdir" install-info done - # remove files provided by lib32-gcc-libs-gitb + # remove files provided by lib32-gcc-libs rm -rf "$pkgdir"/usr/lib32/ # Install Runtime Library Exception @@ -145,13 +202,14 @@ package_gcc-libs-git() { } package_gcc-git() { - pkgdesc="The GNU Compiler Collection - C and C++ frontends" - depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.28' libmpc) - groups=('base-devel') - optdepends=('lib32-gcc-libs: for generating code for 32-bit ABI') - provides=(gcc-multilib=${pkgver}-${pkgrel} gcc=${pkgver}-${pkgrel}) + pkgdesc="The GNU Compiler Collection - C and C++ frontends (git version)" + depends=("gcc-libs-git=$pkgver-$pkgrel" "binutils>=2.28" libmpc zstd libisl.so) + groups=(base-devel-git) + optdepends=('lib32-gcc-libs-git: for generating code for 32-bit ABI') + provides=(gcc{,-multilib{,-git}}) conflicts=(gcc) - options+=(staticlibs) + replaces=(gcc-multilib-git) + options=(!emptydirs staticlibs) cd gcc-build @@ -199,11 +257,8 @@ package_gcc-git() { make -C $CHOST/32/libsanitizer DESTDIR="$pkgdir" install-nodist_{saninclude,toolexeclib}HEADERS make -C $CHOST/32/libsanitizer/asan DESTDIR="$pkgdir" install-nodist_toolexeclibHEADERS - make -C libiberty DESTDIR="$pkgdir" install - install -m644 libiberty/pic/libiberty.a "$pkgdir/usr/lib" - make -C gcc DESTDIR="$pkgdir" install-man install-info - rm "$pkgdir"/usr/share/man/man1/{gccgo,gfortran,gdc}.1 + rm "$pkgdir"/usr/share/man/man1/{gccgo,gfortran,lto-dump,gdc,gm2}.1 rm "$pkgdir"/usr/share/info/{gccgo,gfortran,gnat-style,gnat_rm,gnat_ugn,gdc}.info make -C libcpp DESTDIR="$pkgdir" install @@ -212,6 +267,12 @@ package_gcc-git() { # many packages expect this symlink ln -s gcc "$pkgdir"/usr/bin/cc + # create cc-rs compatible symlinks + # https://github.com/rust-lang/cc-rs/blob/1.0.73/src/lib.rs#L2578-L2581 + for binary in {c++,g++,gcc,gcc-ar,gcc-nm,gcc-ranlib}; do + ln -s /usr/bin/${binary} "${pkgdir}"/usr/bin/x86_64-linux-gnu-${binary} + done + # POSIX conformance launcher scripts for c89 and c99 install -Dm755 "$srcdir/c89" "$pkgdir/usr/bin/c89" install -Dm755 "$srcdir/c99" "$pkgdir/usr/bin/c99" @@ -219,12 +280,12 @@ package_gcc-git() { # install the libstdc++ man pages make -C $CHOST/libstdc++-v3/doc DESTDIR="$pkgdir" doc-install-man - # remove files provided by lib32-gcc-libs-gitb + # remove files provided by lib32-gcc-libs rm -f "$pkgdir"/usr/lib32/lib{stdc++,gcc_s}.so # byte-compile python libraries - python -m compileall "$pkgdir/usr/share/gcc-${pkgver%%+*}/" - python -O -m compileall "$pkgdir/usr/share/gcc-${pkgver%%+*}/" + python -m compileall "$pkgdir/usr/share/gcc-${pkgver%_*}/" + python -O -m compileall "$pkgdir/usr/share/gcc-${pkgver%_*}/" # Install Runtime Library Exception install -d "$pkgdir/usr/share/licenses/$pkgname/" @@ -233,15 +294,16 @@ package_gcc-git() { } package_gcc-fortran-git() { - pkgdesc='Fortran front-end for GCC' - depends=("gcc=$pkgver-$pkgrel") - provides=(gcc-fortran-multilib=${pkgver}-${pkgrel} gcc-fortran=${pkgver}-${pkgrel}) + pkgdesc='Fortran front-end for GCC (git version)' + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(gcc-fortran gcc-multilib{,-git}) conflicts=(gcc-fortran) + replaces=(gcc-multilib-git) cd gcc-build make -C $CHOST/libgfortran DESTDIR="$pkgdir" install-cafexeclibLTLIBRARIES \ install-{toolexeclibDATA,nodist_fincludeHEADERS,gfor_cHEADERS} - make -C $CHOST/32/libgfortran DESTDIR=$pkgdir install-cafexeclibLTLIBRARIES \ + make -C $CHOST/32/libgfortran DESTDIR="$pkgdir" install-cafexeclibLTLIBRARIES \ install-{toolexeclibDATA,nodist_fincludeHEADERS,gfor_cHEADERS} make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info} @@ -255,11 +317,31 @@ package_gcc-fortran-git() { "$pkgdir/usr/share/licenses/$pkgname/" } +package_gcc-rust-git() { + pkgdesc="Rust frontend for GCC (git version)" + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(gcc-rust{,-git}) + conflicts=(gcc-rust) + replaces=(gcc-multilib-git) + + cd gcc-build + make -C gcc DESTDIR="$pkgdir" rust.install-{common,man,info} + + install -Dm755 gcc/gccrs "$pkgdir"/usr/bin/gccrs + install -Dm755 gcc/rust1 "$pkgdir"/"$_libdir"/rust1 + + # Install Runtime Library Exception + install -d "$pkgdir/usr/share/licenses/$pkgname/" + ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ + "$pkgdir/usr/share/licenses/$pkgname/" +} + package_gcc-objc-git() { - pkgdesc='Objective-C front-end for GCC' - depends=("gcc=$pkgver-$pkgrel") - provides=(gcc-objc-multilib=${pkgver}-${pkgrel} gcc-objc=${pkgver}-${pkgrel}) + pkgdesc='Objective-C front-end for GCC (git version)' + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(gcc-multilib{,-git} gcc-objc) conflicts=(gcc-objc) + replaces=(gcc-multilib-git) cd gcc-build make DESTDIR="$pkgdir" -C $CHOST/libobjc install-headers @@ -273,22 +355,23 @@ package_gcc-objc-git() { } package_gcc-ada-git() { - pkgdesc='Ada front-end for GCC (GNAT)' - depends=("gcc=$pkgver-$pkgrel") - provides=(gcc-ada-multilib=${pkgver}-${pkgrel} gcc-ada=${pkgver}-${pkgrel}) + pkgdesc='Ada front-end for GCC (GNAT) (git version)' + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(gcc-ada gcc-multilib{,-git}) conflicts=(gcc-ada) - options+=(staticlibs) + replaces=(gcc-multilib-git) + options=(!emptydirs staticlibs) cd gcc-build/gcc make DESTDIR="$pkgdir" ada.install-{common,info} install -m755 gnat1 "$pkgdir/${_libdir}" cd "$srcdir"/gcc-build/$CHOST/libada - make DESTDIR=${pkgdir} INSTALL="install" \ + make DESTDIR="${pkgdir}" INSTALL="install" \ INSTALL_DATA="install -m644" install-libada cd "$srcdir"/gcc-build/$CHOST/32/libada - make DESTDIR=${pkgdir} INSTALL="install" \ + make DESTDIR="${pkgdir}" INSTALL="install" \ INSTALL_DATA="install -m644" install-libada ln -s gcc "$pkgdir/usr/bin/gnatgcc" @@ -312,10 +395,11 @@ package_gcc-ada-git() { } package_gcc-go-git() { - pkgdesc='Go front-end for GCC' - depends=("gcc=$pkgver-$pkgrel") - provides=("go=1.12.2" gcc-go-multilib=${pkgver}-${pkgrel} gcc-go=${pkgver}-${pkgrel}) - conflicts=(go gcc-go) + pkgdesc='Go front-end for GCC (git version)' + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=("go=1.18" gcc-multilib{,-git}) + conflicts=(gcc-go go{,-git}) + replaces=(gcc-multilib-git) cd gcc-build make -C $CHOST/libgo DESTDIR="$pkgdir" install-exec-am @@ -332,11 +416,12 @@ package_gcc-go-git() { "$pkgdir/usr/share/licenses/$pkgname/" } -package_lib32-gcc-libs-gitb() { - pkgdesc='32-bit runtime libraries shipped by GCC' +package_lib32-gcc-libs-git() { + pkgdesc='32-bit runtime libraries shipped by GCC (git version)' depends=('lib32-glibc>=2.27') - provides=(libgo.so=${pkgver}-${pkgrel} libgfortran.so=${pkgver}-${pkgrel} libubsan.so=${pkgver}-${pkgrel} libasan.so=${pkgver}-${pkgrel} lib32-gcc-libs=${pkgver}-${pkgrel}) + provides=(lib32-gcc-libs libgo.so libgfortran.so libubsan.so libasan.so) conflicts=(lib32-gcc-libs) + groups=(multilib-devel-git) options=(!emptydirs !strip) cd gcc-build @@ -361,7 +446,7 @@ package_lib32-gcc-libs-gitb() { make -C $CHOST/libphobos DESTDIR="$pkgdir" install rm -f "$pkgdir"/usr/lib32/libgphobos.spec - # remove files provided by gcc-libs-git + # remove files provided by gcc-libs rm -rf "$pkgdir"/usr/lib # Install Runtime Library Exception @@ -370,11 +455,12 @@ package_lib32-gcc-libs-gitb() { } package_gcc-d-git() { - pkgdesc="D frontend for GCC" - depends=("gcc=$pkgver-$pkgrel") - provides=(gdc=${pkgver}-${pkgrel} gcc-d=${pkgver}-${pkgrel}) + pkgdesc="D frontend for GCC (git version)" + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(gcc-d gdc{,-git}) conflicts=(gcc-d) - options=('staticlibs') + replaces=(gdc-git) + options=(staticlibs) cd gcc-build make -C gcc DESTDIR="$pkgdir" d.install-{common,man,info} @@ -386,8 +472,54 @@ package_gcc-d-git() { rm -f "$pkgdir/usr/lib/"lib{gphobos,gdruntime}.so* rm -f "$pkgdir/usr/lib32/"lib{gphobos,gdruntime}.so* - install -d "$pkgdir"/usr/include/dlang - ln -s /"${_libdir}"/include/d "$pkgdir"/usr/include/dlang/gdc + # Install Runtime Library Exception + install -d "$pkgdir/usr/share/licenses/$pkgname/" + ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ + "$pkgdir/usr/share/licenses/$pkgname/" +} + +package_gcc-m2-git() { + pkgdesc='Modula-2 frontend for GCC' + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(gcc-m2 ) + conflicts=(gcc-m2) + + cd gcc-build + make -C gcc DESTDIR="$pkgdir" m2.install-{common,man,info} + + install -Dm755 gcc/cc1gm2 "$pkgdir/$_libdir"/cc1gm2 + install -Dm755 gcc/gm2 "$pkgdir"/usr/bin/gm2 + + make -C $CHOST/libgm2 DESTDIR="$pkgdir" install + + # Install Runtime Library Exception + install -d "$pkgdir/usr/share/licenses/$pkgname/" + ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ + "$pkgdir/usr/share/licenses/$pkgname/" +} + +package_lto-dump-git() { + pkgdesc="Dump link time optimization object files (git version)" + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(lto-dump lto-dump-git) + conflicts=(lto-dump) + + cd gcc-build + make -C gcc DESTDIR="$pkgdir" lto.install-{common,man,info} + + # Install Runtime Library Exception + install -d "$pkgdir/usr/share/licenses/$pkgname/" + ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ + "$pkgdir/usr/share/licenses/$pkgname/" +} +package_libgccjit-git() { + pkgdesc="Just-In-Time Compilation with GCC backend (git version)" + depends=("gcc-git=$pkgver-$pkgrel" libisl.so) + provides=(libgccjit libgccjit-git) + conflicts=(libgccjit) + + cd gcc-build + make -C gcc DESTDIR="$pkgdir" jit.install-common jit.install-info # Install Runtime Library Exception install -d "$pkgdir/usr/share/licenses/$pkgname/" |