commit:     22d035036df4ab21d5f724877c3709f4eff59b5b
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 02:41:50 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Fri May 20 20:01:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22d03503

app-emulation/wine-staging: support building with mingw64-toolchain

This allows USE=mingw to be usable without manually using crossdev
first to ease usage for users and automated testing.

Old behavior using crossdev still available with USE=crossdev-mingw,
albeit new one should offer better stability given mingw64-toolchain
is intended/tested especially to build wine+dxvk+vkd3d-proton.

Given wine is pushing PE conversions and some things work better with
PE files (e.g. Blizzard games, Proton also uses --with-mingw), it may
be useful for the prospect of making this a default at some point.

Note that mingw64-toolchain's ${MULTILIB_USEDEP} does belong in BDEPEND
(unless <EAPI-7), as it'll use cross libraries located in BROOT.

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 app-emulation/wine-staging/metadata.xml            |  4 ++
 .../wine-staging/wine-staging-7.5-r1.ebuild        | 46 +++++++++-------------
 .../wine-staging/wine-staging-7.6-r1.ebuild        | 46 +++++++++-------------
 app-emulation/wine-staging/wine-staging-7.7.ebuild | 46 +++++++++-------------
 app-emulation/wine-staging/wine-staging-7.8.ebuild | 46 +++++++++-------------
 .../wine-staging/wine-staging-9999.ebuild          | 46 +++++++++-------------
 6 files changed, 94 insertions(+), 140 deletions(-)

diff --git a/app-emulation/wine-staging/metadata.xml 
b/app-emulation/wine-staging/metadata.xml
index ee411faa12da..8811667ddc0b 100644
--- a/app-emulation/wine-staging/metadata.xml
+++ b/app-emulation/wine-staging/metadata.xml
@@ -18,6 +18,10 @@ This variant of the Wine packaging includes the Wine-Staging 
patchset.
        </longdescription>
        <use>
                <flag name="capi">Enable ISDN support via CAPI</flag>
+               <flag name="crossdev-mingw">
+                       Use <pkg>sys-devel/crossdev</pkg> for the toolchain 
rather than
+                       <pkg>dev-util/mingw64-toolchain</pkg> (requires manual 
setting up)
+               </flag>
                <flag name="custom-cflags">Bypass strip-flags; use at your own 
peril</flag>
                <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to 
run DOS applications</flag>
                <flag name="gecko">Add support for the Gecko engine when using 
iexplore</flag>

diff --git a/app-emulation/wine-staging/wine-staging-7.5-r1.ebuild 
b/app-emulation/wine-staging/wine-staging-7.5-r1.ebuild
index 178ae2fa6afe..5a8aa3f539f4 100644
--- a/app-emulation/wine-staging/wine-staging-7.5-r1.ebuild
+++ b/app-emulation/wine-staging/wine-staging-7.5-r1.ebuild
@@ -48,9 +48,10 @@ fi
 
 LICENSE="LGPL-2.1"
 SLOT="${MY_PV}"
-IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos +fontconfig 
+gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 netapi nls odbc 
openal opencl +opengl osmesa oss +perl pcap pipelight pulseaudio +realtime 
+run-exes samba scanner sdl selinux +ssl staging test +threads +truetype udev 
+udisks +unwind usb v4l vkd3d vulkan +X +xcomposite xinerama"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups custom-cflags dos 
+fontconfig +gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 
netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight 
pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl staging test 
+threads +truetype udev +udisks +unwind usb v4l vkd3d vulkan +X +xcomposite 
xinerama"
 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
        X? ( truetype )
+       crossdev-mingw? ( mingw )
        elibc_glibc? ( threads )
        osmesa? ( opengl )
        pipelight? ( staging )
@@ -63,7 +64,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -217,32 +219,18 @@ pkg_pretend() {
                        fi
                fi
 
-               if use mingw && use abi_x86_32 && ! has_version 
"cross-i686-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-i686-w64-mingw32' compiler and its 
runtime for 32-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target i686-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
-               fi
-
-               if use mingw && use abi_x86_64 && ! has_version 
"cross-x86_64-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-x86_64-w64-mingw32' compiler and its 
runtime for 64-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target x86_64-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
+               if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
+                       local mingw=-w64-mingw32
+                       for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev 
abi_x86_32 i686${mingw}); do
+                               type -P ${mingw}-gcc && continue
+                               eerror "With USE=crossdev-mingw, you must 
prepare the MinGW toolchain"
+                               eerror "yourself by installing 
sys-devel/crossdev then running:"
+                               eerror
+                               eerror "    crossdev --target ${mingw}"
+                               eerror
+                               eerror "For more information, please see: 
https://wiki.gentoo.org/wiki/Mingw";
+                               die "USE=crossdev-mingw is enabled, but 
${mingw}-gcc was not found"
+                       done
                fi
        fi
 }
@@ -369,6 +357,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

diff --git a/app-emulation/wine-staging/wine-staging-7.6-r1.ebuild 
b/app-emulation/wine-staging/wine-staging-7.6-r1.ebuild
index 2985fe9ef68e..c814bc62907c 100644
--- a/app-emulation/wine-staging/wine-staging-7.6-r1.ebuild
+++ b/app-emulation/wine-staging/wine-staging-7.6-r1.ebuild
@@ -48,9 +48,10 @@ fi
 
 LICENSE="LGPL-2.1"
 SLOT="${MY_PV}"
-IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos +fontconfig 
+gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 netapi nls odbc 
openal opencl +opengl osmesa oss +perl pcap pipelight pulseaudio +realtime 
+run-exes samba scanner sdl selinux +ssl staging test +threads +truetype udev 
+udisks +unwind usb v4l vkd3d vulkan +X +xcomposite xinerama"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups custom-cflags dos 
+fontconfig +gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 
netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight 
pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl staging test 
+threads +truetype udev +udisks +unwind usb v4l vkd3d vulkan +X +xcomposite 
xinerama"
 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
        X? ( truetype )
+       crossdev-mingw? ( mingw )
        elibc_glibc? ( threads )
        osmesa? ( opengl )
        pipelight? ( staging )
@@ -63,7 +64,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -217,32 +219,18 @@ pkg_pretend() {
                        fi
                fi
 
-               if use mingw && use abi_x86_32 && ! has_version 
"cross-i686-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-i686-w64-mingw32' compiler and its 
runtime for 32-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target i686-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
-               fi
-
-               if use mingw && use abi_x86_64 && ! has_version 
"cross-x86_64-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-x86_64-w64-mingw32' compiler and its 
runtime for 64-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target x86_64-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
+               if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
+                       local mingw=-w64-mingw32
+                       for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev 
abi_x86_32 i686${mingw}); do
+                               type -P ${mingw}-gcc && continue
+                               eerror "With USE=crossdev-mingw, you must 
prepare the MinGW toolchain"
+                               eerror "yourself by installing 
sys-devel/crossdev then running:"
+                               eerror
+                               eerror "    crossdev --target ${mingw}"
+                               eerror
+                               eerror "For more information, please see: 
https://wiki.gentoo.org/wiki/Mingw";
+                               die "USE=crossdev-mingw is enabled, but 
${mingw}-gcc was not found"
+                       done
                fi
        fi
 }
@@ -369,6 +357,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

diff --git a/app-emulation/wine-staging/wine-staging-7.7.ebuild 
b/app-emulation/wine-staging/wine-staging-7.7.ebuild
index 2985fe9ef68e..c814bc62907c 100644
--- a/app-emulation/wine-staging/wine-staging-7.7.ebuild
+++ b/app-emulation/wine-staging/wine-staging-7.7.ebuild
@@ -48,9 +48,10 @@ fi
 
 LICENSE="LGPL-2.1"
 SLOT="${MY_PV}"
-IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos +fontconfig 
+gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 netapi nls odbc 
openal opencl +opengl osmesa oss +perl pcap pipelight pulseaudio +realtime 
+run-exes samba scanner sdl selinux +ssl staging test +threads +truetype udev 
+udisks +unwind usb v4l vkd3d vulkan +X +xcomposite xinerama"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups custom-cflags dos 
+fontconfig +gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 
netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight 
pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl staging test 
+threads +truetype udev +udisks +unwind usb v4l vkd3d vulkan +X +xcomposite 
xinerama"
 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
        X? ( truetype )
+       crossdev-mingw? ( mingw )
        elibc_glibc? ( threads )
        osmesa? ( opengl )
        pipelight? ( staging )
@@ -63,7 +64,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -217,32 +219,18 @@ pkg_pretend() {
                        fi
                fi
 
-               if use mingw && use abi_x86_32 && ! has_version 
"cross-i686-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-i686-w64-mingw32' compiler and its 
runtime for 32-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target i686-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
-               fi
-
-               if use mingw && use abi_x86_64 && ! has_version 
"cross-x86_64-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-x86_64-w64-mingw32' compiler and its 
runtime for 64-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target x86_64-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
+               if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
+                       local mingw=-w64-mingw32
+                       for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev 
abi_x86_32 i686${mingw}); do
+                               type -P ${mingw}-gcc && continue
+                               eerror "With USE=crossdev-mingw, you must 
prepare the MinGW toolchain"
+                               eerror "yourself by installing 
sys-devel/crossdev then running:"
+                               eerror
+                               eerror "    crossdev --target ${mingw}"
+                               eerror
+                               eerror "For more information, please see: 
https://wiki.gentoo.org/wiki/Mingw";
+                               die "USE=crossdev-mingw is enabled, but 
${mingw}-gcc was not found"
+                       done
                fi
        fi
 }
@@ -369,6 +357,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

diff --git a/app-emulation/wine-staging/wine-staging-7.8.ebuild 
b/app-emulation/wine-staging/wine-staging-7.8.ebuild
index c612384db05e..a8f7b0e6ad1c 100644
--- a/app-emulation/wine-staging/wine-staging-7.8.ebuild
+++ b/app-emulation/wine-staging/wine-staging-7.8.ebuild
@@ -48,9 +48,10 @@ fi
 
 LICENSE="LGPL-2.1"
 SLOT="${MY_PV}"
-IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos +fontconfig 
+gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 netapi nls odbc 
openal opencl +opengl osmesa oss +perl pcap pipelight pulseaudio +realtime 
+run-exes samba scanner sdl selinux +ssl staging test +threads +truetype udev 
+udisks +unwind usb v4l vulkan +X +xcomposite xinerama"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups custom-cflags dos 
+fontconfig +gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 
netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight 
pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl staging test 
+threads +truetype udev +udisks +unwind usb v4l vulkan +X +xcomposite xinerama"
 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
        X? ( truetype )
+       crossdev-mingw? ( mingw )
        elibc_glibc? ( threads )
        osmesa? ( opengl )
        pipelight? ( staging )
@@ -62,7 +63,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -215,32 +217,18 @@ pkg_pretend() {
                        fi
                fi
 
-               if use mingw && use abi_x86_32 && ! has_version 
"cross-i686-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-i686-w64-mingw32' compiler and its 
runtime for 32-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target i686-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
-               fi
-
-               if use mingw && use abi_x86_64 && ! has_version 
"cross-x86_64-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-x86_64-w64-mingw32' compiler and its 
runtime for 64-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target x86_64-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
+               if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
+                       local mingw=-w64-mingw32
+                       for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev 
abi_x86_32 i686${mingw}); do
+                               type -P ${mingw}-gcc && continue
+                               eerror "With USE=crossdev-mingw, you must 
prepare the MinGW toolchain"
+                               eerror "yourself by installing 
sys-devel/crossdev then running:"
+                               eerror
+                               eerror "    crossdev --target ${mingw}"
+                               eerror
+                               eerror "For more information, please see: 
https://wiki.gentoo.org/wiki/Mingw";
+                               die "USE=crossdev-mingw is enabled, but 
${mingw}-gcc was not found"
+                       done
                fi
        fi
 }
@@ -367,6 +355,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

diff --git a/app-emulation/wine-staging/wine-staging-9999.ebuild 
b/app-emulation/wine-staging/wine-staging-9999.ebuild
index c612384db05e..a8f7b0e6ad1c 100644
--- a/app-emulation/wine-staging/wine-staging-9999.ebuild
+++ b/app-emulation/wine-staging/wine-staging-9999.ebuild
@@ -48,9 +48,10 @@ fi
 
 LICENSE="LGPL-2.1"
 SLOT="${MY_PV}"
-IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos +fontconfig 
+gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 netapi nls odbc 
openal opencl +opengl osmesa oss +perl pcap pipelight pulseaudio +realtime 
+run-exes samba scanner sdl selinux +ssl staging test +threads +truetype udev 
+udisks +unwind usb v4l vulkan +X +xcomposite xinerama"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups custom-cflags dos 
+fontconfig +gecko gphoto2 gssapi gstreamer kerberos ldap mingw +mono mp3 
netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight 
pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl staging test 
+threads +truetype udev +udisks +unwind usb v4l vulkan +X +xcomposite xinerama"
 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
        X? ( truetype )
+       crossdev-mingw? ( mingw )
        elibc_glibc? ( threads )
        osmesa? ( opengl )
        pipelight? ( staging )
@@ -62,7 +63,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -215,32 +217,18 @@ pkg_pretend() {
                        fi
                fi
 
-               if use mingw && use abi_x86_32 && ! has_version 
"cross-i686-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-i686-w64-mingw32' compiler and its 
runtime for 32-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target i686-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
-               fi
-
-               if use mingw && use abi_x86_64 && ! has_version 
"cross-x86_64-w64-mingw32/gcc"; then
-                       eerror
-                       eerror "USE=\"mingw\" is currently experimental, and 
requires the"
-                       eerror "'cross-x86_64-w64-mingw32' compiler and its 
runtime for 64-bit builds."
-                       eerror
-                       eerror "These can be installed by using 
'sys-devel/crossdev':"
-                       eerror
-                       eerror "crossdev --target x86_64-w64-mingw32"
-                       eerror
-                       eerror "For more information on setting up MinGW, see: 
https://wiki.gentoo.org/wiki/Mingw";
-                       eerror
-                       die "MinGW build was enabled, but no compiler to 
support it was found."
+               if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then
+                       local mingw=-w64-mingw32
+                       for mingw in $(usev abi_x86_64 x86_64${mingw}) $(usev 
abi_x86_32 i686${mingw}); do
+                               type -P ${mingw}-gcc && continue
+                               eerror "With USE=crossdev-mingw, you must 
prepare the MinGW toolchain"
+                               eerror "yourself by installing 
sys-devel/crossdev then running:"
+                               eerror
+                               eerror "    crossdev --target ${mingw}"
+                               eerror
+                               eerror "For more information, please see: 
https://wiki.gentoo.org/wiki/Mingw";
+                               die "USE=crossdev-mingw is enabled, but 
${mingw}-gcc was not found"
+                       done
                fi
        fi
 }
@@ -367,6 +355,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

Reply via email to