commit: 86a2e7a119a9dd7fa4ceb50ca9a4e10ca0724632 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org> AuthorDate: Thu Aug 10 08:40:43 2023 +0000 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org> CommitDate: Thu Aug 10 10:14:30 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86a2e7a1
app-emulation/wine-staging: tentative support for 32bit w/o multilib This been possible to "build" since early wine-8 but was too incomplete to be really useful and became more usable since roughly 8.10. Scarecely tested, but was still able to get hardware accelerated 32bit wglgears.exe (like glxgears) on a no-multilib prefix install. Not tested on musl yet, but alpine uses it and should work in theory. Only going enable in current latest 8.13 and 9999 so don't expect this on wine-proton/vanilla-8.0.x where it'd be near useless (for wine-proton it likely will not be until wine-proton-9). Does not feel at a stage where it should be default except on no-multilib profiles (abi_x86_32 is still recommended and wine itself outputs a warning about being experimental when using it), but in the event primarily use 64bit while still needing some 32bit support for e.g. bad installers, then this should be good enough. Still requires USE=abi_x86_32 on mingw64-toolchain and wine-gecko (also dxvk/vkd3d-proton if used), but these have no requirements on multilib libraries of their own. In the future may potentially use a different USE on these to avoid confusion and integrate better with no-multilib profiles. For convenience moved the CROSS{CC,*FLAGS} out of the loop -- meaning this no longer tests flags separately for 64+32 but should not be an issue. Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org> app-emulation/wine-staging/metadata.xml | 5 ++ .../wine-staging/wine-staging-8.13.ebuild | 96 ++++++++++++++-------- .../wine-staging/wine-staging-9999.ebuild | 96 ++++++++++++++-------- 3 files changed, 125 insertions(+), 72 deletions(-) diff --git a/app-emulation/wine-staging/metadata.xml b/app-emulation/wine-staging/metadata.xml index 3ef81511155b..455c48fd0a96 100644 --- a/app-emulation/wine-staging/metadata.xml +++ b/app-emulation/wine-staging/metadata.xml @@ -29,6 +29,11 @@ This variant of the Wine packaging includes the Wine-Staging patchset. <flag name="perl">Install helpers that require perl (winedump/winemaker)</flag> <flag name="samba">Pull in <pkg>net-fs/samba</pkg> with winbind for NTLM auth support</flag> <flag name="sdl">Enable gamepad support using <pkg>media-libs/libsdl2</pkg></flag> + <flag name="wow64"> + Enable running 32bit applications without 32bit ELF + multilib by mapping to 64bit calls (experimental, + USE=abi_x86_32 is recommended for complete support) + </flag> </use> <upstream> <bugs-to>https://bugs.winehq.org/describecomponents.cgi?product=Wine-staging</bugs-to> diff --git a/app-emulation/wine-staging/wine-staging-8.13.ebuild b/app-emulation/wine-staging/wine-staging-8.13.ebuild index 940bb93e3836..2032ebd58ea6 100644 --- a/app-emulation/wine-staging/wine-staging-8.13.ebuild +++ b/app-emulation/wine-staging/wine-staging-8.13.ebuild @@ -37,11 +37,13 @@ IUSE=" llvm-libunwind custom-cflags +fontconfig +gecko gphoto2 +gstreamer kerberos +mingw +mono netapi nls opencl +opengl osmesa pcap perl pulseaudio samba scanner +sdl selinux smartcard +ssl +strip - +truetype udev udisks +unwind usb v4l +vulkan wayland +xcomposite - xinerama" + +truetype udev udisks +unwind usb v4l +vulkan wayland wow64 + +xcomposite xinerama" +# bug #551124 for truetype REQUIRED_USE=" X? ( truetype ) - crossdev-mingw? ( mingw )" # bug #551124 for truetype + crossdev-mingw? ( mingw ) + wow64? ( abi_x86_64 !abi_x86_32 mingw )" # tests are non-trivial to run, can hang easily, don't play well with # sandbox, and several need real opengl/vulkan or network access @@ -108,7 +110,10 @@ RDEPEND=" games-emulation/dosbox-staging ) ) - gecko? ( app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] ) + gecko? ( + app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] + wow64? ( app-emulation/wine-gecko[abi_x86_32] ) + ) gstreamer? ( media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}] ) mono? ( app-emulation/wine-mono:${WINE_MONO} ) perl? ( @@ -139,6 +144,7 @@ BDEPEND=" virtual/pkgconfig mingw? ( !crossdev-mingw? ( >=dev-util/mingw64-toolchain-10.0.0_p1-r2[${MULTILIB_USEDEP}] + wow64? ( dev-util/mingw64-toolchain[abi_x86_32] ) ) ) nls? ( sys-devel/gettext ) wayland? ( dev-util/wayland-scanner )" @@ -161,7 +167,8 @@ pkg_pretend() { 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 + for mingw in $(usev abi_x86_64 x86_64${mingw}) \ + $(use abi_x86_32 || use wow64 && echo i686${mingw}); do if ! type -P ${mingw}-gcc >/dev/null; then eerror "With USE=crossdev-mingw, you must prepare the MinGW toolchain" eerror "yourself by installing sys-devel/crossdev then running:" @@ -232,9 +239,13 @@ src_configure() { --includedir="${EPREFIX}"/usr/include/${P} --libdir="${EPREFIX}"${WINE_PREFIX} --mandir="${EPREFIX}"${WINE_DATADIR}/man + + $(usev wow64 --enable-archs=x86_64,i386) + $(use_enable gecko mshtml) $(use_enable mono mscoree) --disable-tests + $(use_with X x) $(use_with alsa) $(use_with capi) @@ -271,17 +282,50 @@ src_configure() { tc-ld-force-bfd # builds with non-bfd but broken at runtime (bug #867097) filter-lto # build failure - use mingw || filter-flags -fno-plt # build failure use custom-cflags || strip-flags # can break in obscure ways at runtime - use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH} # temporary workaround for tc-ld-force-bfd not yet enforcing with mold # https://github.com/gentoo/gentoo/pull/28355 [[ $($(tc-getCC) ${LDFLAGS} -Wl,--version 2>/dev/null) == mold* ]] && append-ldflags -fuse-ld=bfd - # build using upstream's way (--with-wine64) - # order matters: configure+compile 64->32, install 32->64 + if use mingw; then + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH} + + filter-flags -fno-plt # build failure + + # CROSSCC was formerly recognized by wine, thus been using similar + # variables (subject to change, esp. if ever make a mingw.eclass). + local mingwcc_amd64=${CROSSCC:-${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}} + local mingwcc_x86=${CROSSCC:-${CROSSCC_x86:-i686-w64-mingw32-gcc}} + local -n mingwcc=mingwcc_$(usex abi_x86_64 amd64 x86) + + conf+=( + ac_cv_prog_x86_64_CC="${mingwcc_amd64}" + ac_cv_prog_i386_CC="${mingwcc_x86}" + + CROSSCFLAGS="$( + filter-flags '-fstack-protector*' #870136 + filter-flags '-mfunction-return=thunk*' #878849 + + # -mavx with mingw-gcc has a history of obscure issues and + # disabling is seen as safer, e.g. `WINEARCH=win32 winecfg` + # crashes with -march=skylake >=wine-8.10, similar issues with + # znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273 + append-cflags -mno-avx + + CC=${mingwcc} test-flags-CC ${CFLAGS:--O2} + )" + + CROSSLDFLAGS="$( + filter-flags '-fuse-ld=*' + + CC=${mingwcc} test-flags-CCLD ${LDFLAGS} + )" + ) + fi + + # order matters with multilib: configure+compile 64->32, install 32->64 local -i bits for bits in $(usev abi_x86_64 64) $(usev abi_x86_32 32); do ( @@ -290,10 +334,7 @@ src_configure() { mkdir ../build${bits} || die cd ../build${bits} || die - pe_arch=i386 if (( bits == 64 )); then - pe_arch=x86_64 - : "${CROSSCC:=${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}}" conf+=( --enable-win64 ) elif use amd64; then conf+=( @@ -303,28 +344,6 @@ src_configure() { # _setup is optional, but use over Wine's auto-detect (+#472038) multilib_toolchain_setup x86 fi - : "${CROSSCC:=${CROSSCC_x86:-i686-w64-mingw32-gcc}}" - - if use mingw; then - # CROSSCC is no longer recognized by Wine, but still use for now - # (future handling for CROSS* variables is subject to changes) - conf+=( ac_cv_prog_${pe_arch}_CC="${CROSSCC}" ) - - # use *FLAGS for mingw, but strip unsupported - : "${CROSSCFLAGS:=$( - filter-flags '-fstack-protector*' #870136 - filter-flags '-mfunction-return=thunk*' #878849 - # -mavx with mingw-gcc has a history of obscure issues and - # disabling is seen as safer, e.g. `WINEARCH=win32 winecfg` - # crashes with -march=skylake >=wine-8.10, similar issues with - # znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273 - append-cflags -mno-avx - CC=${CROSSCC} test-flags-CC ${CFLAGS:--O2})}" - : "${CROSSLDFLAGS:=$( - filter-flags '-fuse-ld=*' - CC=${CROSSCC} test-flags-CCLD ${LDFLAGS})}" - export CROSS{C,LD}FLAGS - fi ECONF_SOURCE=${S} econf "${conf[@]}" ) @@ -340,8 +359,13 @@ src_install() { use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last - # symlink for plain 'wine' and install its man pages if 64bit-only #404331 - if use abi_x86_64 && use !abi_x86_32; then + if use wow64; then + # compat symlinks, albeit ideally no one should call "wine64" + dosym wine ${WINE_PREFIX}/bin/wine64 + dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader + elif use abi_x86_64 && use !abi_x86_32; then + # if no 32bit support it instead only installs "wine64" which may + # come as unexpected, so provide "wine" alongside its man page dosym wine64 ${WINE_PREFIX}/bin/wine dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader local man diff --git a/app-emulation/wine-staging/wine-staging-9999.ebuild b/app-emulation/wine-staging/wine-staging-9999.ebuild index 940bb93e3836..2032ebd58ea6 100644 --- a/app-emulation/wine-staging/wine-staging-9999.ebuild +++ b/app-emulation/wine-staging/wine-staging-9999.ebuild @@ -37,11 +37,13 @@ IUSE=" llvm-libunwind custom-cflags +fontconfig +gecko gphoto2 +gstreamer kerberos +mingw +mono netapi nls opencl +opengl osmesa pcap perl pulseaudio samba scanner +sdl selinux smartcard +ssl +strip - +truetype udev udisks +unwind usb v4l +vulkan wayland +xcomposite - xinerama" + +truetype udev udisks +unwind usb v4l +vulkan wayland wow64 + +xcomposite xinerama" +# bug #551124 for truetype REQUIRED_USE=" X? ( truetype ) - crossdev-mingw? ( mingw )" # bug #551124 for truetype + crossdev-mingw? ( mingw ) + wow64? ( abi_x86_64 !abi_x86_32 mingw )" # tests are non-trivial to run, can hang easily, don't play well with # sandbox, and several need real opengl/vulkan or network access @@ -108,7 +110,10 @@ RDEPEND=" games-emulation/dosbox-staging ) ) - gecko? ( app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] ) + gecko? ( + app-emulation/wine-gecko:${WINE_GECKO}[${MULTILIB_USEDEP}] + wow64? ( app-emulation/wine-gecko[abi_x86_32] ) + ) gstreamer? ( media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}] ) mono? ( app-emulation/wine-mono:${WINE_MONO} ) perl? ( @@ -139,6 +144,7 @@ BDEPEND=" virtual/pkgconfig mingw? ( !crossdev-mingw? ( >=dev-util/mingw64-toolchain-10.0.0_p1-r2[${MULTILIB_USEDEP}] + wow64? ( dev-util/mingw64-toolchain[abi_x86_32] ) ) ) nls? ( sys-devel/gettext ) wayland? ( dev-util/wayland-scanner )" @@ -161,7 +167,8 @@ pkg_pretend() { 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 + for mingw in $(usev abi_x86_64 x86_64${mingw}) \ + $(use abi_x86_32 || use wow64 && echo i686${mingw}); do if ! type -P ${mingw}-gcc >/dev/null; then eerror "With USE=crossdev-mingw, you must prepare the MinGW toolchain" eerror "yourself by installing sys-devel/crossdev then running:" @@ -232,9 +239,13 @@ src_configure() { --includedir="${EPREFIX}"/usr/include/${P} --libdir="${EPREFIX}"${WINE_PREFIX} --mandir="${EPREFIX}"${WINE_DATADIR}/man + + $(usev wow64 --enable-archs=x86_64,i386) + $(use_enable gecko mshtml) $(use_enable mono mscoree) --disable-tests + $(use_with X x) $(use_with alsa) $(use_with capi) @@ -271,17 +282,50 @@ src_configure() { tc-ld-force-bfd # builds with non-bfd but broken at runtime (bug #867097) filter-lto # build failure - use mingw || filter-flags -fno-plt # build failure use custom-cflags || strip-flags # can break in obscure ways at runtime - use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH} # temporary workaround for tc-ld-force-bfd not yet enforcing with mold # https://github.com/gentoo/gentoo/pull/28355 [[ $($(tc-getCC) ${LDFLAGS} -Wl,--version 2>/dev/null) == mold* ]] && append-ldflags -fuse-ld=bfd - # build using upstream's way (--with-wine64) - # order matters: configure+compile 64->32, install 32->64 + if use mingw; then + use crossdev-mingw || PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH} + + filter-flags -fno-plt # build failure + + # CROSSCC was formerly recognized by wine, thus been using similar + # variables (subject to change, esp. if ever make a mingw.eclass). + local mingwcc_amd64=${CROSSCC:-${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}} + local mingwcc_x86=${CROSSCC:-${CROSSCC_x86:-i686-w64-mingw32-gcc}} + local -n mingwcc=mingwcc_$(usex abi_x86_64 amd64 x86) + + conf+=( + ac_cv_prog_x86_64_CC="${mingwcc_amd64}" + ac_cv_prog_i386_CC="${mingwcc_x86}" + + CROSSCFLAGS="$( + filter-flags '-fstack-protector*' #870136 + filter-flags '-mfunction-return=thunk*' #878849 + + # -mavx with mingw-gcc has a history of obscure issues and + # disabling is seen as safer, e.g. `WINEARCH=win32 winecfg` + # crashes with -march=skylake >=wine-8.10, similar issues with + # znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273 + append-cflags -mno-avx + + CC=${mingwcc} test-flags-CC ${CFLAGS:--O2} + )" + + CROSSLDFLAGS="$( + filter-flags '-fuse-ld=*' + + CC=${mingwcc} test-flags-CCLD ${LDFLAGS} + )" + ) + fi + + # order matters with multilib: configure+compile 64->32, install 32->64 local -i bits for bits in $(usev abi_x86_64 64) $(usev abi_x86_32 32); do ( @@ -290,10 +334,7 @@ src_configure() { mkdir ../build${bits} || die cd ../build${bits} || die - pe_arch=i386 if (( bits == 64 )); then - pe_arch=x86_64 - : "${CROSSCC:=${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}}" conf+=( --enable-win64 ) elif use amd64; then conf+=( @@ -303,28 +344,6 @@ src_configure() { # _setup is optional, but use over Wine's auto-detect (+#472038) multilib_toolchain_setup x86 fi - : "${CROSSCC:=${CROSSCC_x86:-i686-w64-mingw32-gcc}}" - - if use mingw; then - # CROSSCC is no longer recognized by Wine, but still use for now - # (future handling for CROSS* variables is subject to changes) - conf+=( ac_cv_prog_${pe_arch}_CC="${CROSSCC}" ) - - # use *FLAGS for mingw, but strip unsupported - : "${CROSSCFLAGS:=$( - filter-flags '-fstack-protector*' #870136 - filter-flags '-mfunction-return=thunk*' #878849 - # -mavx with mingw-gcc has a history of obscure issues and - # disabling is seen as safer, e.g. `WINEARCH=win32 winecfg` - # crashes with -march=skylake >=wine-8.10, similar issues with - # znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273 - append-cflags -mno-avx - CC=${CROSSCC} test-flags-CC ${CFLAGS:--O2})}" - : "${CROSSLDFLAGS:=$( - filter-flags '-fuse-ld=*' - CC=${CROSSCC} test-flags-CCLD ${LDFLAGS})}" - export CROSS{C,LD}FLAGS - fi ECONF_SOURCE=${S} econf "${conf[@]}" ) @@ -340,8 +359,13 @@ src_install() { use abi_x86_32 && emake DESTDIR="${D}" -C ../build32 install use abi_x86_64 && emake DESTDIR="${D}" -C ../build64 install # do last - # symlink for plain 'wine' and install its man pages if 64bit-only #404331 - if use abi_x86_64 && use !abi_x86_32; then + if use wow64; then + # compat symlinks, albeit ideally no one should call "wine64" + dosym wine ${WINE_PREFIX}/bin/wine64 + dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader + elif use abi_x86_64 && use !abi_x86_32; then + # if no 32bit support it instead only installs "wine64" which may + # come as unexpected, so provide "wine" alongside its man page dosym wine64 ${WINE_PREFIX}/bin/wine dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader local man