git: 8ad1a9300a3f - main - emulators/wine: Add Wayland support

From: Gerald Pfeifer <gerald_at_FreeBSD.org>
Date: Fri, 11 Apr 2025 15:36:52 UTC
The branch main has been updated by gerald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8ad1a9300a3f2d42a7c8a13e54ec4a11b9592d7d

commit 8ad1a9300a3f2d42a7c8a13e54ec4a11b9592d7d
Author:     Gerald Pfeifer <gerald@FreeBSD.org>
AuthorDate: 2025-04-11 12:50:57 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2025-04-11 15:36:28 +0000

    emulators/wine: Add Wayland support
    
    This backports commits cb6e55988b6fc6 and 29221231247728 from
    emulators/wine-devel, just sorts in additions a bit more logically.
    
    Wayland support is not on by default (yet).
    
    PR:             282825
---
 emulators/wine/Makefile             | 11 ++++++++---
 emulators/wine/files/pkg-message.in |  8 ++++++++
 emulators/wine/pkg-plist            |  2 ++
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/emulators/wine/Makefile b/emulators/wine/Makefile
index 57d01c5c7851..8f32e166e982 100644
--- a/emulators/wine/Makefile
+++ b/emulators/wine/Makefile
@@ -52,8 +52,7 @@ CONFIGURE_ARGS+=--verbose \
 		--with-sdl \
 		--without-udev \
 		--without-unwind \
-		--without-usb \
-		--without-wayland
+		--without-usb
 CONFIGURE_ENV=	CPPBIN="${CPP}" FLEX="${LOCALBASE}/bin/flex"
 WINELIBDIR=	${PREFIX}/lib
 .if !defined(USE_LDCONFIG32)
@@ -71,7 +70,7 @@ PIE_UNSAFE=	yes
 
 PORTDATA=	wine.inf
 
-OPTIONS_DEFINE=	CUPS DOCS DOSBOX GNUTLS V4L WINEMAKER X11 GECKO MONO
+OPTIONS_DEFINE=	CUPS DOCS DOSBOX GNUTLS V4L WAYLAND WINEMAKER X11 GECKO MONO
 OPTIONS_DEFAULT=ALSA GNUTLS X11
 OPTIONS_RADIO=	AUDIO
 OPTIONS_RADIO_AUDIO=	ALSA OSS
@@ -81,6 +80,7 @@ DOSBOX_DESC=	Use DOSBox to run MS-DOS programs
 WINEMAKER_DESC=	Fully support winemaker (requires Perl)
 GECKO_DESC=	Bundle Gecko MSI package for Wine
 MONO_DESC=	Bundle Mono MSI package for Wine
+WAYLAND_DESC=	Wayland Support
 
 PORTSCOUT=	limit:^9\.0
 
@@ -110,6 +110,11 @@ V4L_CONFIGURE_WITH=	v4l2
 V4L_BUILD_DEPENDS=	${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat
 V4L_LIB_DEPENDS=	libv4l2.so:multimedia/libv4l
 
+WAYLAND_CONFIGURE_WITH=	wayland
+WAYLAND_BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+WAYLAND_LIB_DEPENDS=	libwayland-client.so:graphics/wayland \
+			libxkbcommon.so:x11/libxkbcommon
+
 WINEMAKER_RUN_DEPENDS=	p5-XML-LibXML>0:textproc/p5-XML-LibXML
 
 X11_CONFIGURE_WITH=	x fontconfig freetype opengl xinerama xinput2 xrandr xrender
diff --git a/emulators/wine/files/pkg-message.in b/emulators/wine/files/pkg-message.in
index bb865c0c874c..a9dc35157bec 100644
--- a/emulators/wine/files/pkg-message.in
+++ b/emulators/wine/files/pkg-message.in
@@ -11,6 +11,14 @@ is KVA_PAGES=500, which should still be enough for ZFS.
 The port also installs some of Wine's documentation which describes
 additional programs that are not in the manual pages under
   %%PREFIX%%/share/doc/wine
+
+To enable Wayland run the following two commands:
+$ cat > wayland.reg  <<EOF
+Windows Registry Editor Version 5.00
+[HKEY_CURRENT_USER\Software\Wine\Drivers]
+"Graphics"="x11,wayland"
+EOF
+$ wine64 regedit wayland.reg
 EOM
 }
 ]
diff --git a/emulators/wine/pkg-plist b/emulators/wine/pkg-plist
index 16179ca8d9a6..0bfd77c65e01 100644
--- a/emulators/wine/pkg-plist
+++ b/emulators/wine/pkg-plist
@@ -1637,6 +1637,7 @@ lib/wine/%%WINEARCH%%-unix/winedmo.so
 %%OSS%%lib/wine/%%WINEARCH%%-unix/wineoss.so
 lib/wine/%%WINEARCH%%-unix/wineps.so
 lib/wine/%%WINEARCH%%-unix/winevulkan.so
+%%WAYLAND%%lib/wine/%%WINEARCH%%-unix/winewayland.so
 %%X11%%lib/wine/%%WINEARCH%%-unix/winex11.so
 lib/wine/%%WINEARCH%%-unix/winspool.so
 lib/wine/%%WINEARCH%%-unix/ws2_32.so
@@ -2584,6 +2585,7 @@ lib/wine/%%WINEARCH%%-windows/wineps.drv
 %%WINE32%%lib/wine/%%WINEARCH%%-windows/wineps16.drv16
 %%WINE32%%lib/wine/%%WINEARCH%%-windows/winevdm.exe
 lib/wine/%%WINEARCH%%-windows/winevulkan.dll
+%%WAYLAND%%lib/wine/%%WINEARCH%%-windows/winewayland.drv
 %%X11%%lib/wine/%%WINEARCH%%-windows/winex11.drv
 %%X11%%lib/wine/%%WINEARCH%%-windows/winexinput.sys
 %%WINE32%%lib/wine/%%WINEARCH%%-windows/wing.dll16