summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emulators/wine/Makefile1
-rw-r--r--emulators/wine/files/patch-dlls_ntdll_unix_loader.c24
-rw-r--r--emulators/wine/files/wine.sh11
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