commit:     2779aaf2710bab9bedbd6d66501c04b1552b54ad
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 29 04:24:51 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sat Apr 29 09:42:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2779aaf2

dev-util/mingw64-runtime: add 11.0.0

Tentatively remove the ssp patch. Bootstrapping using USE=ssp seems
to work both with and without libssp. The libscrypt reproducer from
the patch's old link also builds fine with this version.

Also remove two obsolete flags filters:
* -fstack-clash-protection (bug #758914): ICE was fixed, if still
  run into this then updating gcc to a newer _p* snapshot should
  sort it (alternatively, use released >=gcc-13.1.0)
* -fstack-protector* (bug #870136): mingw64-runtime-11.0.0 adds
  its own (partial) ssp support, allowing -D_FORTIFY_SOURCE=3 and
  -fstack-protector-strong without libssp. Using these to build
  Wine currently still leads to failure, but we can allow it here.

Bug: https://bugs.gentoo.org/758914
Bug: https://bugs.gentoo.org/870136
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 dev-util/mingw64-runtime/Manifest                  |   1 +
 .../mingw64-runtime/mingw64-runtime-11.0.0.ebuild  | 141 +++++++++++++++++++++
 2 files changed, 142 insertions(+)

diff --git a/dev-util/mingw64-runtime/Manifest 
b/dev-util/mingw64-runtime/Manifest
index 30bd166abe51..1bc5f52fb0bc 100644
--- a/dev-util/mingw64-runtime/Manifest
+++ b/dev-util/mingw64-runtime/Manifest
@@ -1 +1,2 @@
 DIST mingw-w64-v10.0.0.tar.bz2 9620291 BLAKE2B 
451372403289c492ca939d65bb4d9f6e9fa6bdd6b32d79d6438d858e106e8cc291712ada1f3f7b951a4c6908e7d0385d485ca76920af39bcf86effa48408e330
 SHA512 
3c0827af7c40809a867758f6cd9ef3ff0c988b43082345bf725e03949af95968d634ace99a7ffae323189549221dcb5d861de9e801f1fbc7904e446641b60516
+DIST mingw-w64-v11.0.0.tar.bz2 10058657 BLAKE2B 
3f7637bcc7c3f25b2141d35105ea086eab74e228d7275725ffb4f07e283fd75169dbe0900a9c29494fba9ddb2ea03bdd6ae26f06048311e9c93ae3e317c4c060
 SHA512 
bc1c9fd9d8593ead9375fcbe40950f06cf7616b94dc676db2793ac9b496fe3a6cc94b5793effda3b752942be0d7d01a1c37a8f221aaf178df0d4eeb0aa6d1f8d

diff --git a/dev-util/mingw64-runtime/mingw64-runtime-11.0.0.ebuild 
b/dev-util/mingw64-runtime/mingw64-runtime-11.0.0.ebuild
new file mode 100644
index 000000000000..e9b21a93f78c
--- /dev/null
+++ b/dev-util/mingw64-runtime/mingw64-runtime-11.0.0.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Free Win64 runtime and import library definitions"
+HOMEPAGE="https://www.mingw-w64.org/";
+SRC_URI="mirror://sourceforge/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2"
+S="${WORKDIR}/mingw-w64-v${PV}"
+
+LICENSE="ZPL BSD BSD-2 ISC LGPL-2+ LGPL-2.1+ MIT public-domain tools? ( GPL-3+ 
)"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+# default-ucrt: enabling requires to be done during the bootstrap process
+# or else will cause e.g. undefined reference to __intrinsic_setjmpex
+# libraries: needs working stage2 compiler (bug #665512)
+IUSE="default-ucrt headers-only idl libraries tools"
+RESTRICT="strip" # portage would use the wrong strip executable
+
+pkg_setup() {
+       : "${CBUILD:=${CHOST}}"
+       : "${CTARGET:=${CHOST}}"
+       [[ ${CTARGET} == ${CHOST} && ${CATEGORY} == cross-* ]] &&
+               CTARGET=${CATEGORY#cross-}
+
+       [[ ${CHOST} != ${CTARGET} ]] && MW_CROSS=true || MW_CROSS=false
+
+       [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] &&
+               die "Invalid configuration, please see: 
https://wiki.gentoo.org/wiki/Mingw";
+}
+
+mingw-foreach_tool() {
+       use !tools || use headers-only && return
+
+       local tool=widl
+       if use !amd64 && use !x86 && use !arm64 && use !arm; then
+               einfo "Skipping widl due to unsupported platform" #853250
+               tool=
+       fi
+
+       for tool in gendef genidl ${tool}; do
+               # not using top-level --with-tools given it skips widl
+               pushd mingw-w64-tools/${tool} >/dev/null || die
+               "${@}"
+               popd >/dev/null || die
+       done
+}
+
+src_configure() {
+       # native tools, see #644556
+       local toolsconf=()
+       # normally only widl is prefixed, but avoids clash with other targets
+       ${MW_CROSS} && toolsconf+=( --program-prefix=${CTARGET}- )
+
+       mingw-foreach_tool econf "${toolsconf[@]}"
+
+       MW_LDFLAGS=${LDFLAGS} # keep non-stripped for gendef not respecting it
+
+       # likely cross-compiling from here, update toolchain variables
+       if ${MW_CROSS} && [[ ! -v MINGW_BYPASS ]]; then
+               unset AR AS CC CPP CXX LD NM OBJCOPY OBJDUMP RANLIB RC STRIP
+               filter-flags '-fuse-ld=*'
+               filter-flags '-mfunction-return=thunk*' #878849
+       fi
+       local CHOST=${CTARGET}
+       strip-unsupported-flags
+
+       # Normally mingw64 does not use dynamic linker, but at configure time it
+       # uses LDFLAGS. When -Wl,--hash-style=gnu is passed __CTORS_LIST__ /
+       # __DTORS_LIST__ is misdetected for target and binaries crash at 
shutdown.
+       # Note: typically also stripped by strip-unsupported-flags, but not 
during
+       # USE=headers-only and potentially other configurations (kept as 
safety).
+       filter-ldflags '-Wl,--hash-style=*'
+
+       local prefix=${EPREFIX}/usr
+       ${MW_CROSS} && prefix+=/${CTARGET}/usr
+
+       local conf=(
+               --prefix="${prefix}"
+               --libdir="${prefix}"/lib
+               $(use_with !headers-only crt)
+               $(usev default-ucrt --with-default-msvcrt=ucrt)
+
+               # By default configure tries to set --sysroot=${prefix}. We 
disable
+               # this behaviour with --with-sysroot=no to use gcc's sysroot 
default.
+               # That way we can cross-build mingw64-runtime with cross-emerge.
+               --with-sysroot=no
+       )
+
+       if use !headers-only; then
+               conf+=(
+                       $(use_enable idl)
+                       $(use_with libraries)
+               )
+
+               # prefer tuple to determine if should do 32 or 64bits, but fall
+               # back to cpp test if missing (bug #584858, see also #840662)
+               local b32=true
+               case ${CHOST} in
+                       x86_64-*) b32=false;;
+                       i*86-*) ;;
+                       *) [[ $($(tc-getCPP) -dM - <<<'') =~ __MINGW64__ ]] && 
b32=false;;
+               esac
+               ${b32} &&
+                       conf+=( --enable-lib32 --disable-lib64 ) ||
+                       conf+=( --disable-lib32 --enable-lib64 )
+
+               # prepare temporary headers install to build against 
same-version
+               mkdir ../headers || die
+               pushd ../headers >/dev/null || die
+               ECONF_SOURCE=${S} econf --prefix="${T}"/root --without-crt
+               popd >/dev/null || die
+
+               append-cppflags "-I${T}/root/include"
+       fi
+
+       econf "${conf[@]}"
+}
+
+src_compile() {
+       use headers-only || emake -C ../headers install
+       emake
+       mingw-foreach_tool emake LDFLAGS="${MW_LDFLAGS}"
+}
+
+src_install() {
+       default
+
+       mingw-foreach_tool emake DESTDIR="${D}" install
+
+       if ${MW_CROSS}; then
+               # gcc is configured to look at specific hard-coded paths for 
mingw #419601
+               dosym usr /usr/${CTARGET}/mingw
+               dosym usr /usr/${CTARGET}/${CTARGET}
+               dosym usr/include /usr/${CTARGET}/sys-include
+       fi
+
+       rm -r "${ED}"/usr/share || die
+}

Reply via email to