Skip to content

Commit

Permalink
emulators/wine-proton: add wow64 wrapper.
Browse files Browse the repository at this point in the history
PR:		255381
  • Loading branch information
shkhln authored and lwhsu committed May 23, 2021
1 parent 1c2c1de commit d8fafe8
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 6 deletions.
7 changes: 6 additions & 1 deletion emulators/wine-proton/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions emulators/wine-proton/files/pkg32.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
34 changes: 34 additions & 0 deletions emulators/wine-proton/files/wine-wow64.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
23 changes: 20 additions & 3 deletions emulators/wine-proton/files/wine.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
6 changes: 4 additions & 2 deletions emulators/wine-proton/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d8fafe8

Please sign in to comment.