Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2023 23:00:03 GMT
From:      Gerald Pfeifer <gerald@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 0f2052c3784e - main - emulators/wine: Unbreak WoW64
Message-ID:  <202312172300.3BHN03l9049275@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by gerald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0f2052c3784e3b8d5aed85aab22b8a49613ee85c

commit 0f2052c3784e3b8d5aed85aab22b8a49613ee85c
Author:     Alexander Vereeken <Alexander88207@protonmail.com>
AuthorDate: 2023-12-17 22:58:41 +0000
Commit:     Gerald Pfeifer <gerald@FreeBSD.org>
CommitDate: 2023-12-17 22:59:27 +0000

    emulators/wine: Unbreak WoW64
    
    This is an excerpt of 1f07ec6014 by Alex S <iwtcex@gmail.com> for
    emulators/wine-proton.
    
    PR:             275677
---
 emulators/wine/Makefile                            |  1 +
 .../wine/files/patch-dlls_ntdll_unix_loader.c      | 24 ++++++++++++++++++++++
 emulators/wine/files/wine.sh                       | 11 ++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/emulators/wine/Makefile b/emulators/wine/Makefile
index e5ac5f97ad35..7851e78ca478 100644
--- a/emulators/wine/Makefile
+++ b/emulators/wine/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wine
 DISTVERSION=	8.0.2
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	emulators
 MASTER_SITES=	https://dl.winehq.org/wine/source/8.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..c290524821a4
--- /dev/null
+++ b/emulators/wine/files/patch-dlls_ntdll_unix_loader.c
@@ -0,0 +1,24 @@
+--- dlls/ntdll/unix/loader.c.orig	2023-07-19 15:29:22 UTC
++++ dlls/ntdll/unix/loader.c
+@@ -694,6 +694,21 @@ static NTSTATUS loader_exec( char **argv, WORD machine
+ {
+     if (machine != current_machine)
+     {
++        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) {
++                    argv[1] = malloc(strlen(s) + 3);
++                    strcpy(argv[1], s);
++                    strcat(argv[1], "64");
++                } else {
++                    argv[1] = s;
++                }
++                preloader_exec(argv);
++            }
++        }
++
+         if (machine == IMAGE_FILE_MACHINE_AMD64)  /* try the 64-bit loader */
+         {
+             size_t len = strlen(wineloader);
diff --git a/emulators/wine/files/wine.sh b/emulators/wine/files/wine.sh
index 96a350fce615..057406196371 100644
--- a/emulators/wine/files/wine.sh
+++ b/emulators/wine/files/wine.sh
@@ -2,9 +2,16 @@
 
 TARGET="$(realpath "$0")"
 
-if [ -z "$WINESERVER" ] && [ -f "${TARGET}server32" ]
+if [ -z "$WINESERVER" ]
 then
-  export WINESERVER="${TARGET}server32"
+  if [ -f "${TARGET%/*}/wineserver" ]
+  then
+    export WINESERVER="${TARGET%/*}/wineserver"
+  fi
+  if [ -f "${TARGET%/*}/wineserver32" ]
+  then
+    export WINESERVER="${TARGET%/*}/wineserver32"
+  fi
 fi
 
 # Workaround for https://bugs.winehq.org/show_bug.cgi?id=50257



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202312172300.3BHN03l9049275>