# Contributor: Wojtek Kosior <kwojtus@protonmail.com> pkgname=gcc-source pkgver=6.3.0 _debrel=18+deb9u1 _islver=0.16.1 pkgrel=1 pkgdesc="Source of the GNU Compiler Collection" arch=(any) license=('GPL-3' 'LGPL-3' 'custom:GCC-Exception-3.1' 'FDL-1.3') url="https://gcc.gnu.org" depends=('quilt') source=(https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.bz2{,.sig} https://deb.debian.org/debian/pool/main/g/gcc-6/gcc-6_$pkgver-$_debrel.diff.gz http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2) validpgpkeys=('33C235A34C46AA3FFB293709A328C3A2C3C45C06') # Jakub Jelinek <jakub@redhat.com> (Weak DSA) :/ sha512sums=('234dd9b1bdc9a9c6e352216a7ef4ccadc6c07f156006a59759c5e0e6a69f0abcdc14630eff11e3826dd6ba5933a8faa43043f3d1d62df6bd5ab1e82862f9bf78' 'SKIP' '171ad340013f87d671141f6f8e7e349a7858aaf34c15fd692c9412e012beeb5d29e966228cc24f10afcce2ca677c04449cad09e96f9d8bcb3bdbf320ea190c7d' 'c188667a84dc5bdddb4ab7c35f89c91bf15a8171f4fcaf41301cf285fb7328846d9a367c096012fec4cc69d244f0bc9e95d84c09ec097394cd4093076f2a041b') noextract=(gcc-$pkgver.tar.bz2 isl-${_islver}.tar.bz2) # Most patches from debian fail to apply. These are the ones that work. _desired_patches=(0001-i386-Move-struct-ix86_frame-to-machine_function.diff 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-copy.diff 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avoi.diff 0004-x86-Add-mindirect-branch.diff 0005-x86-Add-mfunction-return.diff 0006-x86-Add-mindirect-branch-register.diff 0007-x86-Add-V-register-operand-modifier.diff 0008-x86-Disallow-mindirect-branch-mfunction-return-with-m.diff 0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.diff ada-749574.diff ada-revert-pr63225.diff CVE-2016-9840.diff CVE-2016-9841.diff CVE-2016-9842.diff CVE-2016-9843.diff pr47818.diff pr60818.diff pr64735.diff pr64735-headers.diff pr65618.diff pr66368.diff pr67590.diff pr67899.diff pr72813.diff pr77267.diff pr77857.diff pr78774.diff pr80533.diff) prepare () { cd ${srcdir} # this command creates, among all, the directory debian/patches and fills it patch -p1 -i gcc-6_$pkgver-$_debrel.diff # quilt expects a properly formatted 'series' file with list of patches echo ${_desired_patches[@]} | sed 's/ /\n/g' | sed 's/$/ -p2/' > series # Patches and 'series' will go to /usr/src/gcc/debian_patches. # We're not interested in rest of the stuff in debian/. # here we create script to be used for unpacking gcc sources we'll install echo "\ #!/bin/sh mkdir -p \"\$1\" && cd \"\$1\" bsdtar -xf /usr/src/gcc/gcc-${pkgver}.tar.bz2 bsdtar -xf /usr/src/gcc/isl-${_islver}.tar.bz2 ln -s ../isl-${_islver} gcc-${pkgver}/isl export QUILT_PATCHES=/usr/src/gcc/debian_patches export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index' export QUILT_DIFF_ARGS='--no-timestamps' cd gcc-${pkgver} quilt push -av rm -r .pc/" > prepare-gcc-source } package () { install -m755 -d ${pkgdir}/usr/src/gcc/debian_patches # install patches cd ${srcdir}/debian/patches install -m644 ${_desired_patches[@]} ${srcdir}/series ${pkgdir}/usr/src/gcc/debian_patches # install tarballs install -m644 ${srcdir}/{gcc-$pkgver.tar.bz2,isl-${_islver}.tar.bz2} ${pkgdir}/usr/src/gcc # install our script install -m755 -d ${pkgdir}/usr/bin install -m755 ${srcdir}/prepare-gcc-source ${pkgdir}/usr/bin }