commit:     04a3486edf82062ddc9dacd30c0bc45101022a72
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 02:14:51 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Fri May 20 20:01:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04a3486e

app-emulation/wine-vanilla: 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-vanilla/metadata.xml            |  4 ++
 .../wine-vanilla/wine-vanilla-6.0.2.ebuild         | 46 +++++++++-------------
 .../wine-vanilla/wine-vanilla-7.0-r2.ebuild        | 46 +++++++++-------------
 app-emulation/wine-vanilla/wine-vanilla-7.0.ebuild | 46 +++++++++-------------
 .../wine-vanilla/wine-vanilla-7.5-r1.ebuild        | 46 +++++++++-------------
 .../wine-vanilla/wine-vanilla-7.6-r1.ebuild        | 46 +++++++++-------------
 app-emulation/wine-vanilla/wine-vanilla-7.7.ebuild | 46 +++++++++-------------
 app-emulation/wine-vanilla/wine-vanilla-7.8.ebuild | 46 +++++++++-------------
 .../wine-vanilla/wine-vanilla-9999.ebuild          | 46 +++++++++-------------
 9 files changed, 148 insertions(+), 224 deletions(-)

diff --git a/app-emulation/wine-vanilla/metadata.xml 
b/app-emulation/wine-vanilla/metadata.xml
index 8972283b6d89..dcf09b834f72 100644
--- a/app-emulation/wine-vanilla/metadata.xml
+++ b/app-emulation/wine-vanilla/metadata.xml
@@ -18,6 +18,10 @@ This variant of the Wine packaging does not include external 
patchsets
        </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="faudio">Pull in <pkg>app-emulation/faudio</pkg> to 
provide XAudio2 functionality</flag>

diff --git a/app-emulation/wine-vanilla/wine-vanilla-6.0.2.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-6.0.2.ebuild
index 1a3c42a09643..9810db168765 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-6.0.2.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-6.0.2.ebuild
@@ -34,9 +34,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${PV}"
-IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos +faudio 
+fontconfig +gecko gphoto2 gsm gssapi gstreamer +jpeg kerberos +lcms ldap mingw 
+mono mp3 netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png 
pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl test +threads 
+truetype udev +udisks +unwind usb v4l vkd3d vulkan +X +xcomposite xinerama 
+xml"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi crossdev-mingw cups custom-cflags dos 
+faudio +fontconfig +gecko gphoto2 gsm gssapi gstreamer +jpeg kerberos +lcms 
ldap mingw +mono mp3 netapi nls odbc openal opencl +opengl osmesa oss +perl 
pcap +png pulseaudio +realtime +run-exes samba scanner sdl selinux +ssl test 
+threads +truetype udev +udisks +unwind usb v4l vkd3d vulkan +X +xcomposite 
xinerama +xml"
 REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
        X? ( truetype )
+       crossdev-mingw? ( mingw )
        elibc_glibc? ( threads )
        osmesa? ( opengl )
        test? ( abi_x86_32 )
@@ -128,7 +129,8 @@ DEPEND="${COMMON_DEPEND}
        virtual/pkgconfig
        virtual/yacc
        X? ( x11-base/xorg-proto )
-       xinerama? ( x11-base/xorg-proto )"
+       xinerama? ( x11-base/xorg-proto )
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 # These use a non-standard "Wine" category, which is provided by
 # /etc/xdg/applications-merged/wine.menu
@@ -194,32 +196,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 $(usex abi_x86_64 x86_64${mingw} '') $(usex 
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
 }
 
@@ -315,6 +303,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${EPREFIX}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

diff --git a/app-emulation/wine-vanilla/wine-vanilla-7.0-r2.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-7.0-r2.ebuild
index 352885e11423..1992efdf9908 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-7.0-r2.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-7.0-r2.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )
@@ -49,7 +50,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -185,32 +187,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
 }
 
@@ -306,6 +294,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-vanilla/wine-vanilla-7.0.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-7.0.ebuild
index 90894fbc6aef..74051ef469f0 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-7.0.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-7.0.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )
@@ -121,7 +122,8 @@ DEPEND="${COMMON_DEPEND}
        virtual/pkgconfig
        virtual/yacc
        X? ( x11-base/xorg-proto )
-       xinerama? ( x11-base/xorg-proto )"
+       xinerama? ( x11-base/xorg-proto )
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 # These use a non-standard "Wine" category, which is provided by
 # /etc/xdg/applications-merged/wine.menu
@@ -184,32 +186,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 $(usex abi_x86_64 x86_64${mingw} '') $(usex 
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
 }
 
@@ -305,6 +293,8 @@ src_configure() {
        export LDCONFIG=/bin/true
        use custom-cflags || strip-flags
        if use mingw; then
+               use crossdev-mingw || 
PATH=${EPREFIX}/usr/lib/mingw64-toolchain/bin:${PATH}
+
                export CROSSCFLAGS="${CFLAGS}"
        fi
 

diff --git a/app-emulation/wine-vanilla/wine-vanilla-7.5-r1.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-7.5-r1.ebuild
index 11829957a62f..e6242d06fb43 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-7.5-r1.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-7.5-r1.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )
@@ -49,7 +50,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -186,32 +188,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
 }
 
@@ -307,6 +295,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-vanilla/wine-vanilla-7.6-r1.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-7.6-r1.ebuild
index 7e5368175d7d..b0609a8bff36 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-7.6-r1.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-7.6-r1.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )
@@ -49,7 +50,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -185,32 +187,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
 }
 
@@ -306,6 +294,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-vanilla/wine-vanilla-7.7.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-7.7.ebuild
index 7e5368175d7d..b0609a8bff36 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-7.7.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-7.7.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )
@@ -49,7 +50,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -185,32 +187,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
 }
 
@@ -306,6 +294,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-vanilla/wine-vanilla-7.8.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-7.8.ebuild
index 0ff4ad29a37e..25c7af87ecba 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-7.8.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-7.8.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
@@ -48,7 +49,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -183,32 +185,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
 }
 
@@ -304,6 +292,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-vanilla/wine-vanilla-9999.ebuild 
b/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
index 0ff4ad29a37e..25c7af87ecba 100644
--- a/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
+++ b/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
@@ -35,9 +35,10 @@ SRC_URI="${SRC_URI}
 
 LICENSE="LGPL-2.1"
 SLOT="${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 pulseaudio +realtime +run-exes 
samba scanner sdl selinux +ssl 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 pulseaudio 
+realtime +run-exes samba scanner sdl selinux +ssl 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 )
        test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
@@ -48,7 +49,8 @@ RESTRICT="test"
 
 BDEPEND="sys-devel/flex
        virtual/yacc
-       virtual/pkgconfig"
+       virtual/pkgconfig
+       !crossdev-mingw? ( dev-util/mingw64-toolchain[${MULTILIB_USEDEP}] )"
 
 COMMON_DEPEND="
        X? (
@@ -183,32 +185,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
 }
 
@@ -304,6 +292,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