commit:     c9f0ba01f6f91ac7edba26a101068cdee3ebba89
Author:     Sasha Finkelstein <fnkl.kernel <AT> gmail <DOT> com>
AuthorDate: Thu Aug 28 18:48:24 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 17 22:21:02 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9f0ba01

wine.eclass: Add arm64ec emulation support

Enable building arm64ec dlls and hook up fex-emu

Signed-off-by: Sasha Finkelstein <fnkl.kernel <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43593
Closes: https://github.com/gentoo/gentoo/pull/43593
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-emulation/wine-proton/metadata.xml  |  1 +
 app-emulation/wine-staging/metadata.xml |  1 +
 app-emulation/wine-vanilla/metadata.xml |  1 +
 eclass/wine.eclass                      | 27 +++++++++++++++++----------
 profiles/arch/arm64/package.use.mask    |  5 +++++
 profiles/arch/base/package.use.mask     |  6 ++++++
 6 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/app-emulation/wine-proton/metadata.xml 
b/app-emulation/wine-proton/metadata.xml
index 56b64ea52244..3a15fea2753e 100644
--- a/app-emulation/wine-proton/metadata.xml
+++ b/app-emulation/wine-proton/metadata.xml
@@ -10,6 +10,7 @@
                <name>Wine</name>
        </maintainer>
        <use>
+               <flag name="arm64ec">Enable support for running x86_64 
applications on arm64 via binary translation</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

diff --git a/app-emulation/wine-staging/metadata.xml 
b/app-emulation/wine-staging/metadata.xml
index 21f619f7e35c..0cd631d2605c 100644
--- a/app-emulation/wine-staging/metadata.xml
+++ b/app-emulation/wine-staging/metadata.xml
@@ -13,6 +13,7 @@ Think of Wine as a compatibility layer for running Windows 
programs. Wine does n
 This variant of the Wine packaging includes the Wine-Staging patchset.
        </longdescription>
        <use>
+               <flag name="arm64ec">Enable support for running x86_64 
applications on arm64 via binary translation</flag>
                <flag name="capi">Enable ISDN support using 
<pkg>net-libs/libcapi</pkg></flag>
                <flag name="crossdev-mingw">
                        Use <pkg>sys-devel/crossdev</pkg> for the toolchain 
rather than

diff --git a/app-emulation/wine-vanilla/metadata.xml 
b/app-emulation/wine-vanilla/metadata.xml
index dc031e4bc44d..e493f2f5381a 100644
--- a/app-emulation/wine-vanilla/metadata.xml
+++ b/app-emulation/wine-vanilla/metadata.xml
@@ -13,6 +13,7 @@ Think of Wine as a compatibility layer for running Windows 
programs. Wine does n
 This variant of the Wine packaging does not include external patchsets
        </longdescription>
        <use>
+               <flag name="arm64ec">Enable support for running x86_64 
applications on arm64 via binary translation</flag>
                <flag name="capi">Enable ISDN support using 
<pkg>net-libs/libcapi</pkg></flag>
                <flag name="crossdev-mingw">
                        Use <pkg>sys-devel/crossdev</pkg> for the toolchain 
rather than

diff --git a/eclass/wine.eclass b/eclass/wine.eclass
index 1336b8642f23..25e1ccfc42e0 100644
--- a/eclass/wine.eclass
+++ b/eclass/wine.eclass
@@ -41,7 +41,7 @@ inherit autotools flag-o-matic multilib prefix 
toolchain-funcs wrapper
 readonly WINE_USEDEP="abi_x86_32(-)?,abi_x86_64(-)?"
 
 IUSE="
-       +abi_x86_32 +abi_x86_64 crossdev-mingw custom-cflags
+       +abi_x86_32 +abi_x86_64 arm64ec crossdev-mingw custom-cflags
        +mingw +strip wow64
 "
 REQUIRED_USE="
@@ -50,7 +50,10 @@ REQUIRED_USE="
        wow64? ( !arm64? ( abi_x86_64 !abi_x86_32 ) )
 "
 
-RDEPEND="arm64? ( wow64? ( app-emulation/fex-xtajit ) )"
+RDEPEND="
+       arm64? ( wow64? ( app-emulation/fex-xtajit[wow64(+)] ) )
+       arm64ec? ( app-emulation/fex-xtajit[arm64ec(-)] )
+"
 BDEPEND="
        || (
                sys-devel/binutils:*
@@ -90,6 +93,7 @@ wine_pkg_pretend() {
                        $(usev abi_x86_32 i686)
                        $(usev wow64 i686)
                        $(usev arm64 aarch64)
+                       $(usev arm64ec arm64ec)
                )
 
                local mingw
@@ -217,6 +221,7 @@ wine_src_configure() {
                # no mingw64-toolchain ~arm64, but "may" be usable with crossdev
                # (aarch64- rather than arm64- given it is what Wine searches 
for)
                wcc_arm64=${CROSSCC:-${CROSSCC_arm64:-aarch64-w64-mingw32-gcc}}
+               
wcc_arm64ec=${CROSSCC:-${CROSSCC_arm64ec:-arm64ec-w64-mingw32-gcc}}
        else
                conf+=( --with-mingw=clang )
 
@@ -230,6 +235,8 @@ wine_src_configure() {
                wcc_x86_testflags="-target i386-windows"
                wcc_arm64=${CROSSCC:-${CROSSCC_arm64:-${clang}}}
                wcc_arm64_testflags="-target aarch64-windows"
+               wcc_arm64ec=${CROSSCC:-${CROSSCC_arm64ec:-${clang}}}
+               wcc_arm64ec_testflags="-target arm64ec-windows"
 
                # do not copy from regular LDFLAGS given odds are they all are
                # incompatible, and difficult to test linking without llvm-mingw
@@ -240,6 +247,7 @@ wine_src_configure() {
                ac_cv_prog_x86_64_CC="${wcc_amd64}"
                ac_cv_prog_i386_CC="${wcc_x86}"
                ac_cv_prog_aarch64_CC="${wcc_arm64}"
+               ac_cv_prog_arm64ec_CC="${wcc_arm64ec}"
        )
 
        if ver_test -ge 10; then
@@ -252,6 +260,8 @@ wine_src_configure() {
                        
i386_LDFLAGS="${CROSSLDFLAGS_x86:-${CROSSLDFLAGS:-$(_wine_flags ld x86)}}"
                        
aarch64_CFLAGS="${CROSSCFLAGS_arm64:-${CROSSCFLAGS:-$(_wine_flags c arm64)}}"
                        
aarch64_LDFLAGS="${CROSSLDFLAGS_arm64:-${CROSSLDFLAGS:-$(_wine_flags ld 
arm64)}}"
+                       
arm64ec_CFLAGS="${CROSSCFLAGS_arm64ec:-${CROSSCFLAGS:-$(_wine_flags c 
arm64ec)}}"
+                       
arm64ec_LDFLAGS="${CROSSLDFLAGS_arm64ec:-${CROSSLDFLAGS:-$(_wine_flags ld 
arm64ec)}}"
                )
        elif use abi_x86_64; then
                conf+=(
@@ -298,6 +308,7 @@ wine_src_configure() {
                        $(usev abi_x86_64 x86_64)
                        $(usev wow64 i386) # 32-on-64bit "new" wow64
                        $(usev arm64 aarch64)
+                       $(usev arm64ec arm64ec)
                )
                conf+=( ${archs:+--enable-archs="${archs[*]}"} )
 
@@ -359,6 +370,10 @@ wine_src_install() {
                dosym -r /usr/lib/fex-xtajit/libwow64fex.dll \
                        ${WINE_PREFIX}/wine/aarch64-windows/xtajit.dll
 
+       use arm64ec &&
+               dosym -r /usr/lib/fex-xtajit/libarm64ecfex.dll \
+                       ${WINE_PREFIX}/wine/aarch64-windows/xtajit64.dll
+
        # delete unwanted files if requested, not done directly in ebuilds
        # given must be done after install and before wrappers
        if (( ${#WINE_SKIP_INSTALL[@]} )); then
@@ -423,14 +438,6 @@ wine_pkg_postinst() {
                fi
        fi
 
-       if use arm64 && use wow64; then
-               ewarn
-               ewarn "You have enabled x86 emulation via FEX-Emu's xtajit 
implementation."
-               ewarn "This currently *does not* include amd64/x86_64/x64 
emulation. Only i386"
-               ewarn "and ARM64 Windows applications are supported at this 
time. Please do not"
-               ewarn "file bugs about amd64 applications."
-       fi
-
        eselect wine update --if-unset || die
 }
 

diff --git a/profiles/arch/arm64/package.use.mask 
b/profiles/arch/arm64/package.use.mask
index 280e5ca781b4..9ea638ed485b 100644
--- a/profiles/arch/arm64/package.use.mask
+++ b/profiles/arch/arm64/package.use.mask
@@ -1,6 +1,11 @@
 # Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Sasha Finkelstein <[email protected]> (2025-09-17)
+# Arm64-specific ABI
+app-emulation/wine-staging -arm64ec
+app-emulation/wine-vanilla -arm64ec
+
 # Michał Górny <[email protected]> (2025-09-12)
 # These BLAS/LAPACK providers are keyworded here.
 sci-libs/flexiblas -blis -openblas

diff --git a/profiles/arch/base/package.use.mask 
b/profiles/arch/base/package.use.mask
index 08da291ad545..acd27fc6d8f5 100644
--- a/profiles/arch/base/package.use.mask
+++ b/profiles/arch/base/package.use.mask
@@ -1,6 +1,12 @@
 # Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Sasha Finkelstein <[email protected]> (2025-09-17)
+# Arm64-specific ABI that does not make sense anywhere else
+app-emulation/wine-proton arm64ec
+app-emulation/wine-staging arm64ec
+app-emulation/wine-vanilla arm64ec
+
 # Michał Górny <[email protected]> (2025-09-12)
 # Other BLAS/LAPACK providers are not keyworded everywhere.
 sci-libs/flexiblas blis mkl openblas

Reply via email to