aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex S <shkhln@users.noreply.github.com>2021-04-24 18:22:58 +0000
committerLi-Wen Hsu <lwhsu@FreeBSD.org>2021-05-23 04:37:44 +0000
commitd8fafe84bd58baef7d4e2696cc16bcf67db4cf3d (patch)
tree27b6489fe77c2eaec6e2339d57161b72b6b75538
parent1c2c1dec445e2cdba59c41cd293cb2b5b50b7b91 (diff)
downloadports-d8fafe84bd58baef7d4e2696cc16bcf67db4cf3d.tar.gz
ports-d8fafe84bd58baef7d4e2696cc16bcf67db4cf3d.zip
emulators/wine-proton: add wow64 wrapper.
PR: 255381
-rw-r--r--emulators/wine-proton/Makefile7
-rw-r--r--emulators/wine-proton/files/pkg32.sh13
-rw-r--r--emulators/wine-proton/files/wine-wow64.sh34
-rw-r--r--emulators/wine-proton/files/wine.sh23
-rw-r--r--emulators/wine-proton/pkg-plist6
5 files changed, 77 insertions, 6 deletions
diff --git a/emulators/wine-proton/Makefile b/emulators/wine-proton/Makefile
index 28ebe7521c75..50497ccb5a97 100644
--- a/emulators/wine-proton/Makefile
+++ b/emulators/wine-proton/Makefile
@@ -106,8 +106,13 @@ pre-build:
post-install:
.if ${ARCH} == i386
${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wineserver ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wineserver32
- ${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine32
+ ${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine.bin
${INSTALL_SCRIPT} ${FILESDIR}/wine.sh ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine
+.else
+ ${INSTALL_SCRIPT} ${FILESDIR}/pkg32.sh ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/pkg32.sh
+ ${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64 ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64.bin
+ ${INSTALL_SCRIPT} ${FILESDIR}/wine.sh ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64
+ ${INSTALL_SCRIPT} ${FILESDIR}/wine-wow64.sh ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine
.endif
${RM} -r ${STAGEDIR}${PREFIX}/${PORTNAME}/include
${RM} -r ${STAGEDIR}${MANPREFIX}/man
diff --git a/emulators/wine-proton/files/pkg32.sh b/emulators/wine-proton/files/pkg32.sh
new file mode 100644
index 000000000000..7aebca5b7cd1
--- /dev/null
+++ b/emulators/wine-proton/files/pkg32.sh
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+if [ "$(id -u)" = 0 ]
+then
+ echo "Don't run this script as root!"
+ exit 1
+fi
+
+I386_ROOT="${WINE_i386_ROOT:-$HOME/.i386-wine-pkg}"
+
+mkdir -p "$I386_ROOT"
+ABI=$(pkg config ABI | sed s/amd64/i386/)
+echo pkg -o ABI="$ABI" -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
+exec pkg -o ABI="$ABI" -o INSTALL_AS_USER=true -o RUN_SCRIPTS=false --rootdir "$I386_ROOT" "$@"
diff --git a/emulators/wine-proton/files/wine-wow64.sh b/emulators/wine-proton/files/wine-wow64.sh
new file mode 100644
index 000000000000..9efb09fc3d3b
--- /dev/null
+++ b/emulators/wine-proton/files/wine-wow64.sh
@@ -0,0 +1,34 @@
+#!/bin/sh -e
+TARGET="$(realpath "$0")"
+PREFIX="${TARGET%/*/*}"
+LOCALBASE="${PREFIX%/*}"
+
+I386_ROOT="${WINE_i386_ROOT:-$HOME/.i386-wine-pkg}"
+
+export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH:+$LIBGL_DRIVERS_PATH:}$LOCALBASE/lib/dri:$LOCALBASE/lib32/dri:$I386_ROOT/$LOCALBASE/lib/dri"
+export LD_32_LIBRARY_PATH="${LD_32_LIBRARY_PATH:+$LD_32_LIBRARY_PATH:}$I386_ROOT/$PREFIX/lib/wine:$LOCALBASE/lib32:$I386_ROOT/$LOCALBASE/lib:$I386_ROOT/$LOCALBASE/llvm10/lib:$I386_ROOT/$LOCALBASE/llvm11/lib"
+export LD_32_LIBRARY_PATH_RPATH=y
+
+if [ -z "$WINE_NO_WOW64" ]
+then
+ export PATH="${TARGET%/*}:${PATH}"
+ export WINESERVER="${TARGET}server"
+fi
+
+if [ ! -f "$I386_ROOT/$PREFIX/bin/wine" ]
+then
+ printf "%s doesn't exist!\n\n" "$I386_ROOT/$PREFIX/bin/wine"
+ printf "Try installing 32-bit wine with\n\t%s\n" "$PREFIX/bin/pkg32.sh install wine-proton mesa-dri"
+ exit 1
+fi
+
+WINE32_VERSION=$(env -u WINELOADERNOEXEC "$I386_ROOT/$PREFIX/bin/wine" --version)
+WINE64_VERSION=$(env -u WINELOADERNOEXEC "${TARGET}64" --version)
+if [ "$WINE32_VERSION" != "$WINE64_VERSION" ]
+then
+ printf "wine [%s] and wine64 [%s] versions do not match!\n\n" "$WINE32_VERSION" "$WINE64_VERSION"
+ printf "Try updating 32-bit wine with\n\t%s\n" "$PREFIX/bin/pkg32.sh upgrade"
+ exit 1
+fi
+
+exec "$I386_ROOT/$PREFIX/bin/wine" "$@"
diff --git a/emulators/wine-proton/files/wine.sh b/emulators/wine-proton/files/wine.sh
index 7dfe3e66c4ca..63d5ba68a1ab 100644
--- a/emulators/wine-proton/files/wine.sh
+++ b/emulators/wine-proton/files/wine.sh
@@ -1,4 +1,21 @@
#!/bin/sh
-TARGET="`realpath $0`"
-export WINESERVER=${WINESERVER-${TARGET}server32}
-exec "${TARGET}32" "$@"
+TARGET="$(realpath "$0")"
+
+if [ -z "$WINESERVER" ] && [ -f "${TARGET}server32" ]
+then
+ export WINESERVER="${TARGET}server32"
+fi
+
+export GST_PLUGIN_SYSTEM_PATH_1_0="${TARGET%/*/*/*}/lib/gstreamer-1.0"
+
+# workaround for https://bugs.winehq.org/show_bug.cgi?id=50257
+export LD_BIND_NOW=1
+export LD_32_BIND_NOW=1
+
+# workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255336
+if [ "$(uname -p)" = amd64 ]
+then
+ export LD_LIBMAP="libgcc_s.so.1=/lib/libgcc_s.so.1,${LD_LIBMAP}"
+fi
+
+exec "${TARGET}.bin" "$@"
diff --git a/emulators/wine-proton/pkg-plist b/emulators/wine-proton/pkg-plist
index bdd4d0d17b07..6020329c2d1f 100644
--- a/emulators/wine-proton/pkg-plist
+++ b/emulators/wine-proton/pkg-plist
@@ -8,8 +8,7 @@
%%DOCSDIR%%/ANNOUNCE
%%DOCSDIR%%/AUTHORS
%%DOCSDIR%%/README
-%%WINE32%%wine-proton/bin/wine
-%%WINE32%%wine-proton/bin/wine32
+%%WINE32%%wine-proton/bin/wine.bin
%%WINE32%%wine-proton/bin/wineserver32
%%WINE32%%wine-proton/lib/wine/avifile.dll16.so
%%WINE32%%wine-proton/lib/wine/comm.drv16.so
@@ -140,7 +139,9 @@
%%WINE32%%wine-proton/lib/wine/winsock.dll16.so
%%WINE32%%wine-proton/lib/wine/wintab.dll16.so
%%WINE32%%wine-proton/lib/wine/wow32.dll.so
+%%WINE64%%wine-proton/bin/pkg32.sh
%%WINE64%%wine-proton/bin/wine64
+%%WINE64%%wine-proton/bin/wine64.bin
%%WINE64%%wine-proton/bin/wineserver
wine-proton/bin/function_grep.pl
wine-proton/bin/msidb
@@ -149,6 +150,7 @@ wine-proton/bin/notepad
wine-proton/bin/regedit
wine-proton/bin/regsvr32
wine-proton/bin/widl
+wine-proton/bin/wine
wine-proton/bin/wineboot
wine-proton/bin/winebuild
wine-proton/bin/winecfg