pkgname=(gcc # gcc-fortran # gcc-go # gcc-objc # gcc-m2 gcc-libs gcc-libs-32bit) pkgbase=gcc pkgver=14.2.0 pkgrel=1 pkgdesc="The GNU Compiler Collection" arch=('x86_64') url="https://gcc.gnu.org" license=('GPL-3.0-with-GCC-exception' 'GFDL-1.3-or-later') makedepends=('zstd' 'binutils' 'mpc' 'isl' 'glibc-32bit') options=('!emptydirs' '!lto' '!strip') source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgbase}-${pkgver}/${pkgbase}-${pkgver}.tar.xz c89 c99) sha256sums=(a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9 aa3327fd8626acf2a28fa75c0b3ed99fcffb1bbcbe6974505f050ee751ba4154 2861971c0ef2c011ce10c98e8cf7b5fd1d3d3c4eddcfe0a01ed9d76940f67638) prepare() { cd ${pkgbase}-${pkgver} sed -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ -i.orig gcc/config/i386/t-linux64 sed '/STACK_REALIGN_DEFAULT/s/0/(!TARGET_64BIT \&\& TARGET_SSE)/' \ -i gcc/config/i386/i386.h sed -i -e 's@/lib/ld-linux.so.2@/lib32/ld-linux.so.2@g' gcc/config/i386/linux64.h install -dm755 build } build() { cd ${pkgbase}-${pkgver}/build export CC="${CHOST}-gcc" export CXX="${CHOST}-g++" CFLAGS=${CFLAGS/-Werror=format-security/} CXXFLAGS=${CXXFLAGS/-Werror=format-security/} local configure_args=( --enable-default-pie --enable-default-ssp --enable-host-pie --enable-multilib --with-multilib-list="m64,m32" --disable-bootstrap --disable-fixincludes --with-system-zlib --enable-languages=c,c++ --target=${CHOST} ${configure_options} ) ../configure ${configure_args[@]} make } package_gcc() { pkgdesc="The GNU Compiler Collection - C and C++ frontends" groups=('base-devel') depends=("${pkgbase}-libs=${pkgver}-${pkgrel}" 'zstd' 'binutils' 'mpc' 'isl') cd ${pkgbase}-${pkgver}/build make DESTDIR=${pkgdir} install chown -v -R root:root ${pkgdir}/usr/lib64/gcc/$(gcc -dumpmachine)/${pkgver}/include{,-fixed} ln -s gcc ${pkgdir}/usr/bin/cc ln -svr cpp ${pkgdir}/usr/lib64 ln -sv gcc.1 ${pkgdir}/usr/share/man/man1/cc.1 install -dm755 ${pkgdir}/usr/lib64/bfd-plugins/ ln -sv /usr/libexec/gcc/$(gcc -dumpmachine)/${pkgver%%+*} ${pkgdir}/usr/lib64/bfd-plugins/ install -d ${pkgdir}/usr/share/gdb/auto-load/usr/lib{32,64} mv ${pkgdir}/usr/lib64/libstdc++.so.6.*-gdb.py ${pkgdir}/usr/share/gdb/auto-load/usr/lib64/ mv ${pkgdir}/usr/lib32/libstdc++.so.6.*-gdb.py ${pkgdir}/usr/share/gdb/auto-load/usr/lib32/ install -vm755 ${srcdir}/c89 ${pkgdir}/usr/bin/c89 install -vm755 ${srcdir}/c99 ${pkgdir}/usr/bin/c99 _pick libs ${pkgdir}/usr/lib64/libasan.so _pick libs ${pkgdir}/usr/lib64/libasan.so.8 _pick libs ${pkgdir}/usr/lib64/libasan.so.8.0.0 _pick libs ${pkgdir}/usr/lib64/libatomic.so _pick libs ${pkgdir}/usr/lib64/libatomic.so.1 _pick libs ${pkgdir}/usr/lib64/libatomic.so.1.2.0 _pick libs ${pkgdir}/usr/lib64/libgcc_s.so _pick libs ${pkgdir}/usr/lib64/libgcc_s.so.1 _pick libs ${pkgdir}/usr/lib64/libgomp.so _pick libs ${pkgdir}/usr/lib64/libgomp.so.1 _pick libs ${pkgdir}/usr/lib64/libgomp.so.1.0.0 _pick libs ${pkgdir}/usr/lib64/libitm.so _pick libs ${pkgdir}/usr/lib64/libitm.so.1 _pick libs ${pkgdir}/usr/lib64/libitm.so.1.0.0 _pick libs ${pkgdir}/usr/lib64/liblsan.so _pick libs ${pkgdir}/usr/lib64/liblsan.so.0 _pick libs ${pkgdir}/usr/lib64/liblsan.so.0.0.0 _pick libs ${pkgdir}/usr/lib64/libquadmath.so _pick libs ${pkgdir}/usr/lib64/libquadmath.so.0 _pick libs ${pkgdir}/usr/lib64/libquadmath.so.0.0.0 _pick libs ${pkgdir}/usr/lib64/libstdc++.so _pick libs ${pkgdir}/usr/lib64/libstdc++.so.6 _pick libs ${pkgdir}/usr/lib64/libstdc++.so.6.0.33 _pick libs ${pkgdir}/usr/lib64/libtsan.so _pick libs ${pkgdir}/usr/lib64/libtsan.so.2 _pick libs ${pkgdir}/usr/lib64/libtsan.so.2.0.0 _pick libs ${pkgdir}/usr/lib64/libubsan.so _pick libs ${pkgdir}/usr/lib64/libubsan.so.1 _pick libs ${pkgdir}/usr/lib64/libubsan.so.1.0.0 _pick libs ${pkgdir}/usr/share/info/libgomp.info _pick libs ${pkgdir}/usr/share/info/libitm.info _pick libs ${pkgdir}/usr/share/info/libquadmath.info _pick libs ${pkgdir}/usr/share/locale/de/LC_MESSAGES/libstdc++.mo _pick libs ${pkgdir}/usr/share/locale/fr/LC_MESSAGES/libstdc++.mo _pick libs32 ${pkgdir}/usr/lib32 _pick libs32 ${pkgdir}/usr/share/gdb/auto-load/usr/lib32/ } package_gcc-libs() { pkgdesc='Runtime libraries shipped by GCC' groups=('base') depends=('glibc') mv libs/* ${pkgdir} } package_gcc-libs-32bit() { pkgdesc="32-bit runtime libraries shipped by GCC" depends=('glibc-32bit') mv libs32/* ${pkgdir} } package_gcc-fortran() { pkgdesc="Fortran front-end for GCC" depends=("${pkgbase}-libs=${pkgver}-${pkgrel}" 'isl') mv gccfortran/* ${pkgdir} ln -s gfortran ${pkgdir}/usr/bin/f95 } package_gcc-fortran-32bit() { pkgdesc="Fortran front-end for GCC (32-bit)" depends=("${pkgbase}-libs-32bit=${pkgver}-${pkgrel}" 'gcc-fortran' 'isl') mv gccfortran32/* ${pkgdir} } package_gcc-go() { pkgdesc="Go front-end for GCC" depends=("${pkgbase}-libs=${pkgver}-${pkgrel}" 'isl') mv gccgo/* ${pkgdir} } package_gcc-go-32bit() { pkgdesc="Go front-end for GCC (32-bit)" depends=("${pkgbase}-libs-32bit=${pkgver}-${pkgrel}" 'gcc-go' 'isl') mv gccgo32/* ${pkgdir} } package_gcc-objc() { pkgdesc="Objective-C front-end for GCC" depends=("${pkgbase}-libs=${pkgver}-${pkgrel}" 'isl') mv gccobjc/* ${pkgdir} } package_gcc-objc-32bit() { pkgdesc="Objective-C front-end for GCC (32-bit)" depends=("${pkgbase}-libs-32bit=${pkgver}-${pkgrel}" 'gcc-objc' 'isl') mv gccobjc32/* ${pkgdir} } package_gcc-m2() { pkgdesc="Modula-2 frontend for GCC" depends=("${pkgbase}-libs=${pkgver}-${pkgrel}" 'isl') mv gccgm2/* ${pkgdir} } package_gcc-m2-32bit() { pkgdesc="Modula-2 frontend for GCC (32-bit)" depends=("${pkgbase}-libs-32bit=${pkgver}-${pkgrel}" 'gcc-m2' 'isl') mv gccgm232/* ${pkgdir} }