From 00071916624e7b3234609c4cab4ce22934649eee Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Wed, 2 Mar 2022 14:09:05 +0000 Subject: [PATCH] core/gcc to 11.2.0-4 --- core/gcc/PKGBUILD | 102 +++++++++++++++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 28 deletions(-) diff --git a/core/gcc/PKGBUILD b/core/gcc/PKGBUILD index 74eb69512..c05424330 100644 --- a/core/gcc/PKGBUILD +++ b/core/gcc/PKGBUILD @@ -16,23 +16,39 @@ noautobuild=1 -pkgname=(gcc gcc-libs gcc-fortran gcc-objc gcc-go gcc-d) +pkgname=(gcc gcc-libs gcc-fortran gcc-objc gcc-go gcc-d libgccjit) pkgver=11.2.0 _majorver=${pkgver%%.*} _islver=0.24 -pkgrel=3 +pkgrel=4 pkgdesc='The GNU Compiler Collection' arch=(x86_64) license=(GPL LGPL FDL custom) url='https://gcc.gnu.org' makedepends=(binutils libmpc doxygen python git libxcrypt zstd) checkdepends=(dejagnu inetutils tcl expect python-pytest) +makedepends=( + binutils + doxygen + git + libisl + libmpc + libxcrypt + python + zstd +) +checkdepends=( + dejagnu + expect + inetutils + python-pytest + tcl +) options=(!emptydirs !lto debug !distcc) _libdir=usr/lib/gcc/$CHOST/${pkgver%%+*} # _commit=6beb39ee6c465c21d0cc547fd66b445100cdcc35 # source=(git://gcc.gnu.org/git/gcc.git#commit=$_commit source=(https://sourceware.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.xz{,.sig} - https://libisl.sourceforge.io/isl-${_islver}.tar.xz c89 c99 gdc_phobos_path.patch gcc-ada-repro.patch @@ -43,7 +59,6 @@ validpgpkeys=(F3691687D867B81B51CE07D9BBE43771487328A9 # bpiotrowski@archlinux. D3A93CAD751C2AF4F8C7AD516C35B99309B5FA62) # Jakub Jelinek sha256sums=('d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b' 'SKIP' - '043105cc544f416b48736fff8caf077fb0663a717d06b1113f16e391ac99ebad' 'de48736f6e4153f03d0a5d38ceb6c6fdb7f054e8f47ddd6af0a3dbf14f27b931' '2513c6d9984dd0a2058557bf00f06d8d5181734e41dcfe07be7ed86f2959622a' 'c86372c207d174c0918d4aedf1cb79f7fc093649eb1ad8d9450dccc46849d308' @@ -53,9 +68,6 @@ 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 @@ -65,9 +77,6 @@ prepare() { # Arch Linux ARM installs aarch64 libraries /lib [[ $CARCH == "aarch64" ]] && sed -i '/lp64=/s/lib64/lib/' gcc/config/aarch64/t-aarch64-linux - # hack! - some configure tests for header files using "$CPP $CPPFLAGS" - sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure - # D hacks patch -Np1 -i "$srcdir/gdc_phobos_path.patch" @@ -79,25 +88,16 @@ prepare() { [[ $CARCH == "aarch64" ]] && CONFIGFLAG="--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419" mkdir -p "$srcdir/gcc-build" + mkdir -p "$srcdir/libgccjit-build" } build() { - cd gcc-build - - # 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" --prefix=/usr \ + local _confflags="--prefix=/usr \ --libdir=/usr/lib \ --libexecdir=/usr/lib \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues \ - --enable-languages=c,c++,fortran,go,lto,objc,obj-c++,d \ - --with-isl \ --with-linker-hash-style=gnu \ --with-system-zlib \ --enable-__cxa_atexit \ @@ -117,16 +117,49 @@ build() { --disable-multilib \ --disable-werror \ $CONFIGFLAG \ - gdc_include_dir=/usr/include/dlang/gdc + gdc_include_dir=/usr/include/dlang/gdc" + + cd gcc-build + + # 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=c,c++,fortran,go,lto,objc,obj-c++,d \ + --enable-bootstrap \ + $_confflags # 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" + LDFLAGS_FOR_TARGET="$LDFLAGS" \ + profiledbootstrap # make documentation 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 + + # 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() { @@ -191,7 +224,7 @@ package_gcc-libs() { package_gcc() { pkgdesc="The GNU Compiler Collection - C and C++ frontends" - depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.28' libmpc zstd) + depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.28' libmpc zstd libisl.so) groups=('base-devel') options=(!emptydirs staticlibs debug) @@ -264,7 +297,7 @@ package_gcc() { package_gcc-fortran() { pkgdesc='Fortran front-end for GCC' - depends=("gcc=$pkgver-$pkgrel") + depends=("gcc=$pkgver-$pkgrel" libisl.so) cd gcc-build make -C $CHOST/libgfortran DESTDIR="$pkgdir" install-cafexeclibLTLIBRARIES \ @@ -283,7 +316,7 @@ package_gcc-fortran() { package_gcc-objc() { pkgdesc='Objective-C front-end for GCC' - depends=("gcc=$pkgver-$pkgrel") + depends=("gcc=$pkgver-$pkgrel" libisl.so) cd gcc-build make DESTDIR="$pkgdir" -C $CHOST/libobjc install-headers @@ -298,7 +331,7 @@ package_gcc-objc() { package_gcc-go() { pkgdesc='Go front-end for GCC' - depends=("gcc=$pkgver-$pkgrel") + depends=("gcc=$pkgver-$pkgrel" libisl.so) provides=("go=1.12.2") conflicts=(go) @@ -318,7 +351,7 @@ package_gcc-go() { package_gcc-d() { pkgdesc="D frontend for GCC" - depends=("gcc=$pkgver-$pkgrel") + depends=("gcc=$pkgver-$pkgrel" libisl.so) provides=(gdc) replaces=(gdc) options=(staticlibs debug) @@ -341,3 +374,16 @@ package_gcc-d() { ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ "$pkgdir/usr/share/licenses/$pkgname/" } + +package_libgccjit() { + pkgdesc="Just-In-Time Compilation with GCC backend" + depends=("gcc=$pkgver-$pkgrel" libisl.so) + + 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/" + ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ + "$pkgdir/usr/share/licenses/$pkgname/" +}