# Maintainer (Arch): Anatol Pomozov _target=@CHOST@ pkgname=$_target-gcc pkgver=7.3.1+20180312 _islver=0.18 pkgrel=1 pkgdesc='The GNU Compiler Collection - cross compiler for @CARCH@ target' arch=(x86_64) url='http://gcc.gnu.org/' license=(GPL LGPL FDL) depends=($_target-binutils $_target-glibc libmpc zlib) makedepends=(gmp mpfr) options=(!emptydirs !strip staticlibs) conflicts=($pkgname-bootstrap) replaces=($pkgname-bootstrap) source=(https://sources.archlinux.org/other/gcc/gcc-${pkgver/+/-}.tar.xz{,.sig} http://isl.gforge.inria.fr/isl-$_islver.tar.bz2 gcc-pure64.patch::https://gist.githubusercontent.com/alexforsale/a1339a64882ac7df065404f0af9bb639/raw/9586520039c5b83b96aadfff9aa206bd1bb6972d/gcc-pure64.patch 0001-pthread-reentrant.patch) validpgpkeys=(F3691687D867B81B51CE07D9BBE43771487328A9 # bpiotrowski@archlinux.org 13975A70E63C361C73AE69EF6EEB81F8981C74C7 # richard.guenther@gmail.com 33C235A34C46AA3FFB293709A328C3A2C3C45C06) # Jakub Jelinek sha256sums=('c52618f656f2102b3544419e7d0a8a4f4e6ff052783865202be73edf1a40e28b' 'SKIP' '6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b' 'c7545a5faca9fc1aee47bd1a4e407e7a64ef1d4c4fb018ede0a5f5ffa16c33be' 'fc9c6f0edd615f2b39deff28b9626a08fd98ef8ce19f7e34281c0a5bd653ac3b') prepare() { [[ ! -d gcc ]] && ln -s gcc-${pkgver/+/-} gcc cd gcc # link isl for in-tree builds ln -sf ../isl-$_islver isl # Do not run fixincludes sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in # Arch Linux installs 64bit libraries in /lib patch -Np1 -i "$srcdir"/gcc-pure64.patch # hack! - some configure tests for header files using "$CPP $CPPFLAGS" sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" "$srcdir"/gcc/{libiberty,gcc}/configure # fix -pthreads behavior on risc-v patch -Np1 -i "$srcdir/0001-pthread-reentrant.patch" mkdir -p "$srcdir/gcc-build" } build() { 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 \ --target=$_target \ --prefix=/usr \ --libdir=/usr/lib \ --libexecdir=/usr/lib \ --program-prefix=$_target- \ --with-local-prefix=/usr/$_target \ --with-build-sysroot=/usr/$_target \ --with-sysroot=/usr/$_target \ --enable-shared \ --with-system-zlib \ --enable-tls \ --enable-languages=c,c++,fortran \ --disable-libmudflap \ --disable-libssp \ --disable-libquadmath \ --disable-nls \ --@MULTILIB@-multilib \ --disable-bootstrap \ --enable-checking=release \ @GCC_CONFIG_FLAGS@ make } package() { cd gcc-build make DESTDIR="$pkgdir" install # strip target binaries find "$pkgdir"/usr/lib/gcc/$_target/ "$pkgdir"/usr/$_target/lib -type f -and \( -name \*.a -or -name \*.o \) -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc '{}' \; # strip host binaries find "$pkgdir"/usr/bin/ "$pkgdir"/usr/lib/gcc/$_target/ -type f -and \( -executable \) -exec strip '{}' \; # Remove files that conflict with host gcc package rm -r "$pkgdir"/usr/lib/libcc1.so{,.0,.0.0.0} rm -r "$pkgdir"/usr/share/man/man7 rm -r "$pkgdir"/usr/share/info rm -r "$pkgdir"/usr/share/gcc-* }