git: 3bde6b5aeee5 - main - emulators/wine: Unbreak WoW64 again

From: Gerald Pfeifer <gerald_at_FreeBSD.org>
Date: Fri, 10 May 2024 07:55:58 UTC
The branch main has been updated by gerald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3bde6b5aeee56da01d237854c5be9854c7a27995

commit 3bde6b5aeee56da01d237854c5be9854c7a27995
Author:     Gerald Pfeifer <gerald@FreeBSD.org>
AuthorDate: 2024-05-10 07:54:52 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2024-05-10 07:55:45 +0000

    emulators/wine: Unbreak WoW64 again
    
    Restore files/patch-dlls_ntdll_unix_loader.c which we "lost" with the
    update to Wine 9.0 by means of an updated version based on a version
    for emulators/wine-devel by Alex S <iwtcex@gmail.com> in PR 278525.
    
    PR:             278427
---
 emulators/wine/Makefile                            |  2 +-
 .../wine/files/patch-dlls_ntdll_unix_loader.c      | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/emulators/wine/Makefile b/emulators/wine/Makefile
index f4e6d8dd9ecf..df8365ba92ac 100644
--- a/emulators/wine/Makefile
+++ b/emulators/wine/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	wine
 DISTVERSION=	9.0
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	emulators
 MASTER_SITES=	https://dl.winehq.org/wine/source/9.0/
diff --git a/emulators/wine/files/patch-dlls_ntdll_unix_loader.c b/emulators/wine/files/patch-dlls_ntdll_unix_loader.c
new file mode 100644
index 000000000000..599c4ee0d53a
--- /dev/null
+++ b/emulators/wine/files/patch-dlls_ntdll_unix_loader.c
@@ -0,0 +1,25 @@
+--- UTC
+--- dlls/ntdll/unix/loader.c.orig	2024-01-16 20:55:47
++++ dlls/ntdll/unix/loader.c	2024-05-10 07:03:04
+@@ -480,6 +480,21 @@
+ 
+     if (machine == current_machine) return NULL;
+ 
++    char* wineserver_path = getenv("WINESERVER");
++    if (wineserver_path != NULL && wineserver_path[0] == '/') {
++        char* s = remove_tail(wineserver_path, "server");
++        if (s != NULL) {
++            if (machine == IMAGE_FILE_MACHINE_AMD64) {
++                ret = malloc(strlen(s) + 3);
++                strcpy(ret, s);
++                strcat(ret, "64");
++            } else {
++                ret = s;
++            }
++            return ret;
++        }
++    }
++
+     if (machine == IMAGE_FILE_MACHINE_AMD64)  /* try the 64-bit loader */
+     {
+         size_t len = strlen(wineloader);