Christoph Reiter a2ee04bf00 More CPEs
2024-03-24 20:09:34 +01:00

201 lines
7.6 KiB
Bash

# Maintainer: Alexey Pavlov <alexpux@gmail.com>
_realname=gcc
_mingw_suff=mingw-w64-cross
pkgname=("${_mingw_suff}-${_realname}")
pkgver=13.2.0
pkgrel=4
pkgdesc="Cross GCC for the MinGW-w64"
arch=('i686' 'x86_64')
url="https://gcc.gnu.org"
license=('GPL' 'LGPL' 'FDL' 'custom')
msys2_references=(
'archlinux: gcc'
'cpe: cpe:/a:gnu:gcc'
)
groups=("${_mingw_suff}-toolchain" "${_mingw_suff}")
depends=("zlib" "mpc" "isl" "libzstd"
"${_mingw_suff}-binutils"
"${_mingw_suff}-crt"
"${_mingw_suff}-headers"
"${_mingw_suff}-winpthreads"
"${_mingw_suff}-windows-default-manifest")
makedepends=("gcc" 'lndir' "gmp-devel" "mpc-devel" "zlib-devel" "isl-devel" 'autotools' 'gperf' 'libzstd-devel')
#checkdepends=('dejagnu')
options=('!strip' 'staticlibs' '!emptydirs' '!buildflags')
source=(https://ftp.gnu.org/gnu/gcc/gcc-${pkgver}/gcc-${pkgver}.tar.gz
0001-Cygwin-use-SysV-ABI-on-x86_64.patch
0002-Cygwin-add-dummy-pthread-tsaware-and-large-address-a.patch
0003-Cygwin-handle-dllimport-properly-in-medium-model-V2.patch
0004-Cygwin-MinGW-skip-test.patch
0005-Cygwin-define-RTS_CONTROL_ENABLE-and-DTR_CONTROL_ENA.patch
0006-Cygwin-fix-some-implicit-declaration-warnings-and-re.patch
0007-Cygwin-__cxa-atexit.patch
0008-Cygwin-libgomp-soname.patch
0009-Cygwin-g-time.patch
0010-Cygwin-newlib-ftm.patch
0011-Cygwin-define-STD_UNIX.patch
0101-Cygwin-enable-libgccjit-not-just-for-MingW.patch
0102-Cygwin-testsuite-fixes-for-libgccjit.patch
0950-11.2.0-configure-msys2.patch
0951-11.2.0-msys2-spec.patch
0953-11.2.0-testsuite-msys2.patch
0006-Windows-New-feature-to-allow-overriding.patch
0012-Handle-spaces-in-path-for-default-manifest.patch
0014-gcc-9-branch-clone_function_name_1-Retain-any-stdcall-suffix.patch
0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch
0200-add-m-no-align-vector-insn-option-for-i386.patch
0300-override-builtin-printf-format.patch
777aa930b106fea2dd6ed9fe22b42a2717f1472d.patch)
sha256sums=('8cb4be3796651976f94b9356fa08d833524f62420d6292c5033a9a26af315078'
'bc788aa466a83184d285cc2f6c1ffc40c6ed416dd08c6999015262a53f1ab1b5'
'704acfaeb11d24d3fe5aab34bc883c184ca93aff03d752016c9a50fdd82c5655'
'c5676fd62d5f7f69be26062b95d42ef47f28151af83b83efa3998ecd8e939e19'
'03ecf29419119286ebcef35864f9bd26d3bf3eaa355945856953204ed727e173'
'06214859ae4030ce30bb68aa35aa4a9ac92d1e79e34133089dcbfeb7cc8066e8'
'a843c038042811265d6ce5917b0c76b709e2591822e5cab53a32b7e9c806da29'
'e27f82af1eb7a4aad955ec36d5fd7d9a4c24575845bcf718372df9bc2b099eb6'
'de5692673731f90b888bf301a547481ab8e3cc0029713b6fd5abaabd860250f0'
'a40e7025507130a2a5d2eb2eea8ba4b053398c307cd55b3c9421a8507bd315ed'
'2658eb376f7829179963978b69a048ed105a41508adc55d0fc0d607c14181926'
'83b6aea4a462ae80121fd68d42c6234d02e20865132197a10575bbf95fd33b7e'
'c5aeab9609f90a8430c43bb50172b63c3155eb10082369f81fac58a395d2e2ee'
'3707b0aab99b203cbd9e513be46c7d4600de06e6c8344160b7fb1779061d08da'
'8a29a40ee426ee786da97656c35d2e9c17838b12c1b750cecf857760da273381'
'959ef644853398fe6f2c291a43e5e5bfac4dc973ce6ae7ff23734135cb9a5b60'
'adb8baaa35dcfbea9ab60694262d0958e090495146d50df1a0844a977832aef9'
'a3637466910fae6145c947095051e3b91b16e4715d4abddc474eeb00539e9dc2'
'e98805ead7d78ee2a92f237894c4b2b7ddc1688e1b517d8c04f28d440202e40f'
'fd9bdecb2bbc4796bbc9f00b708dac42ef9e3464a06d6d27e5475cee117de5be'
'ad1f7b5e7afaaec008b7cbd14feea13a10989fa91bda7003af72d457619bb199'
'c34f9e71b5a092be1987ad4c65891742c74c9eb8ef6560100e751cd31375f579'
'f73c8d1701762fed7d8102d17d8e4416a4cc5e600e297a89c2e1fe09cd743a1c'
'b0a98a41fea4a68f15d35b44495a487183a4d85ea9cb70cd4a645b4ed6583122')
_threads="win32"
_targets="x86_64-w64-mingw32ucrt i686-w64-mingw32 x86_64-w64-mingw32"
apply_patch_with_msg() {
for _fname in "$@"
do
msg2 "Applying ${_fname}"
patch -Nbp1 -i "${srcdir}"/${_fname}
done
}
prepare() {
cd ${srcdir}/${_realname}-${pkgver}
# Cygwin patches
apply_patch_with_msg \
0001-Cygwin-use-SysV-ABI-on-x86_64.patch \
0002-Cygwin-add-dummy-pthread-tsaware-and-large-address-a.patch \
0003-Cygwin-handle-dllimport-properly-in-medium-model-V2.patch \
0004-Cygwin-MinGW-skip-test.patch \
0005-Cygwin-define-RTS_CONTROL_ENABLE-and-DTR_CONTROL_ENA.patch \
0006-Cygwin-fix-some-implicit-declaration-warnings-and-re.patch \
0007-Cygwin-__cxa-atexit.patch \
0008-Cygwin-libgomp-soname.patch \
0009-Cygwin-g-time.patch \
0010-Cygwin-newlib-ftm.patch \
0011-Cygwin-define-STD_UNIX.patch \
0101-Cygwin-enable-libgccjit-not-just-for-MingW.patch \
0102-Cygwin-testsuite-fixes-for-libgccjit.patch
# MSYS2 Patches
apply_patch_with_msg \
0950-11.2.0-configure-msys2.patch \
0951-11.2.0-msys2-spec.patch \
0953-11.2.0-testsuite-msys2.patch
# MinGW Patches
apply_patch_with_msg \
0006-Windows-New-feature-to-allow-overriding.patch \
0012-Handle-spaces-in-path-for-default-manifest.patch \
0014-gcc-9-branch-clone_function_name_1-Retain-any-stdcall-suffix.patch \
0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch \
0200-add-m-no-align-vector-insn-option-for-i386.patch \
0300-override-builtin-printf-format.patch \
777aa930b106fea2dd6ed9fe22b42a2717f1472d.patch
}
build() {
export lt_cv_deplibs_check_method='pass_all'
for _target in ${_targets}; do
mkdir -p ${srcdir}/gcc-build-${_target} && cd ${srcdir}/gcc-build-${_target}
local _langs="c,lto,c++"
case "${_target}" in
i686*)
local _conf="--disable-sjlj-exceptions --with-dwarf2"
local _arch=pentium4
_langs="${_langs} fortran"
;;
x86_64*)
local _arch=nocona
local _conf=""
_langs="${_langs} fortran"
;;
esac
../${_realname}-${pkgver}/configure \
--prefix=/opt \
--build=${CHOST} \
--host=${CHOST} \
--target=${_target} \
--libexecdir=/opt/lib \
--disable-bootstrap \
--with-arch=${_arch} \
--with-tune=generic \
--enable-languages=${_langs} \
--enable-shared \
--enable-static \
--enable-threads=${_threads} \
--enable-graphite \
--enable-fully-dynamic-string \
--enable-libstdcxx-filesystem-ts \
--enable-libstdcxx-time \
--disable-libstdcxx-pch \
--disable-libstdcxx-debug \
--enable-cloog-backend=isl \
--enable-version-specific-runtime-libs \
--disable-isl-version-check \
--enable-lto \
--enable-libgomp \
--disable-libssp \
--disable-multilib \
--enable-checking=release \
--disable-rpath \
--disable-win32-registry \
--disable-werror \
--disable-symvers \
--with-libiconv \
--with-system-zlib \
--with-{gmp,mpfr,mpc,isl}=/usr \
--with-gnu-as \
--with-gnu-ld \
${_conf} \
CFLAGS="-O2 -pipe" \
CXXFLAGS="-O2 -pipe"
make all
done
}
package() {
for _target in ${_targets}; do
cd ${srcdir}/gcc-build-${_target}
make -j1 DESTDIR=${pkgdir} install
mv ${pkgdir}/opt/lib/gcc/${_target}/lib/libgcc_s.a ${pkgdir}/opt/lib/gcc/${_target}/${pkgver}/
mv ${pkgdir}/opt/lib/gcc/${_target}/libgcc*.dll ${pkgdir}/opt/lib/gcc/${_target}/${pkgver}/
for _f in ${pkgdir}/opt/bin/*.exe; do
strip -s ${_f}
done
for _f in ${pkgdir}/opt/lib/gcc/${_target}/${pkgver}/*.exe; do
strip -s ${_f}
done
rm -rf ${pkgdir}/opt/share
done
}