Commit 04bb9961 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add patches with rewrite new style wow64 support (github #2191)

parent e94f32d9
From a5fbd3bb1e8d45f1fb68ffe52c4e455aa093aa6c Mon Sep 17 00:00:00 2001
From: Vitaly Lipatov <lav@etersoft.ru>
Date: Tue, 20 Feb 2024 00:02:13 +0300
Subject: [PATCH 1/3] Remove unuseful binary arch detection
To: wine-devel <wine-devel@winehq.org>
---
src/winetricks | 53 +++++++++-----------------------------------------
1 file changed, 9 insertions(+), 44 deletions(-)
diff --git a/src/winetricks b/src/winetricks
index 4bdc9da..86a2570 100755
--- a/src/winetricks
+++ b/src/winetricks
@@ -1064,34 +1064,6 @@ w_expand_env()
winetricks_early_wine_arch cmd.exe /c echo "%$1%"
}
-# Determine what architecture a binary file is built for
-winetricks_get_file_arch()
-{
- _W_file="$1"
- # macOS uses Mach-O binaries, not ELF
- if [ "$(uname -s)" = "Darwin" ]; then
- _W_lipo_output="$(lipo -archs "${_W_file}")"
- case "${_W_lipo_output}" in
- "arm64") _W_file_arch="arm64" ;;
- "i386") _W_file_arch="i386" ;;
- "x86_64") _W_file_arch="x86_64" ;;
- *) w_die "Unknown file arch: ${_W_lipo_output}" ;;
- esac
- else
- # Assume ELF binaries for everything else
- _W_ob_output="$(od -An -t x1 -j 0x12 -N 1 "${_W_file}" | tr -d "[:space:]")"
- case "${_W_ob_output}" in
- "3e") _W_file_arch="x86_64" ;;
- "03"|"06") _W_file_arch="i386" ;;
- "b7") _W_file_arch="aarch64" ;;
- "28") _W_file_arch="aarch32" ;;
- *) w_die "Unknown file arch: ${_W_ob_output}";;
- esac
- fi
-
- echo "${_W_file_arch}"
-}
-
# Get the latest tagged release from github.com API
w_get_github_latest_release()
{
@@ -5060,20 +5032,6 @@ winetricks_set_wineprefix()
# Using the variable W_SYSTEM32_DLLS instead of SYSTEM32 because some stuff does go under system32 for both arch's
# e.g., spool/drivers/color
if test -d "${W_DRIVE_C}/windows/syswow64"; then
- # Check the bitness of wineserver + wine binary, used later to determine if we're on a WOW setup (no wine64)
- # https://github.com/Winetricks/winetricks/issues/2030
- WINESERVER_BIN="$(which "${WINESERVER}")"
- _W_wineserver_binary_arch="$(winetricks_get_file_arch "${WINESERVER_BIN}")"
- WINE_BIN="$(which "${WINE}")"
- _W_wine_binary_arch="$(winetricks_get_file_arch "${WINE_BIN}")"
-
- # determine wow64 type (new/old)
- # FIXME: check what upstream is calling them
- if [ "${_W_wineserver_binary_arch}" = "${_W_wine_binary_arch}" ]; then
- _W_wow64_style="new"
- else
- _W_wow64_style="classic"
- fi
# Probably need fancier handling/checking, but for a basic start:
# Note 'wine' may be named 'wine-stable'/'wine-staging'/etc.):
@@ -5082,8 +5040,6 @@ winetricks_set_wineprefix()
# WINE_MULTI = generic wine, new name
if [ -n "${WINE64}" ]; then
true
- elif [ "${_W_wow64_style}" = "new" ]; then
- WINE64="${WINE}"
elif [ "${WINE%??}64" = "${WINE}" ]; then
WINE64="${WINE}"
elif command -v "${WINE}64" >/dev/null 2>&1; then
@@ -5093,7 +5049,16 @@ winetricks_set_wineprefix()
WINE64="$(dirname "${WINE}")/"
[ "${WINE64}" = "./" ] && WINE64=""
WINE64="${WINE64}$(basename "${WINE}" | sed 's/^wine/wine64/')"
+ test -x "${WINE64}" || WINE64="${WINE}"
+ fi
+
+ # if we can't detect wine64 command, it is the new wow64 mode
+ if echo "${WINE64}" | grep -q "wine64" ; then
+ _W_wow64_style="classic"
+ else
+ _W_wow64_style="new"
fi
+
WINE_ARCH="${WINE64}"
WINE_MULTI="${WINE}"
W_ARCH=win64
--
2.42.1
From 815a01132de8fbb2b66f68a29e0aa2f024b0541c Mon Sep 17 00:00:00 2001
From: Vitaly Lipatov <lav@etersoft.ru>
Date: Tue, 20 Feb 2024 12:12:31 +0300
Subject: [PATCH 2/3] add w_expand_env32 and w_expand_env64 and using them to
get correct paths
To: wine-devel <wine-devel@winehq.org>
---
src/winetricks | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/src/winetricks b/src/winetricks
index 86a2570..7db190d 100755
--- a/src/winetricks
+++ b/src/winetricks
@@ -1064,6 +1064,16 @@ w_expand_env()
winetricks_early_wine_arch cmd.exe /c echo "%$1%"
}
+w_expand_env32()
+{
+ winetricks_early_wine "${W_SYSTEM32_DLLS_WIN}\\cmd.exe" /c echo "%$1%"
+}
+
+w_expand_env64()
+{
+ WINE=${WINE64} winetricks_early_wine "${W_SYSTEM64_DLLS_WIN64}\\cmd.exe" /c echo "%$1%"
+}
+
# Get the latest tagged release from github.com API
w_get_github_latest_release()
{
@@ -5063,9 +5073,6 @@ winetricks_set_wineprefix()
WINE_MULTI="${WINE}"
W_ARCH=win64
- W_PROGRAMS_WIN="$(w_expand_env ProgramFiles)"
- W_PROGRAMS_UNIX="$(w_pathconv -u "${W_PROGRAMS_WIN}")"
-
# Common variable for 32-bit dlls on win32/win64:
W_SYSTEM32_DLLS="${W_WINDIR_UNIX}/syswow64"
W_SYSTEM32_DLLS_WIN="C:\\windows\\syswow64"
@@ -5074,18 +5081,21 @@ winetricks_set_wineprefix()
W_SYSTEM64_DLLS_WIN32="C:\\windows\\sysnative" # path to access 64-bit dlls from 32-bit apps
W_SYSTEM64_DLLS_WIN64="C:\\windows\\system32" # path to access 64-bit dlls from 64-bit apps
+ W_PROGRAMS_WIN="$(w_expand_env64 ProgramFiles)"
+ W_PROGRAMS_UNIX="$(w_pathconv -u "${W_PROGRAMS_WIN}")"
+
# There's also ProgramW6432, which =%ProgramFiles%(but only available when running under a 64 bit OS)
# See https://ss64.com/nt/syntax-variables.html
- W_PROGRAMW6432_WIN="$(w_expand_env ProgramW6432)"
+ W_PROGRAMW6432_WIN="$(w_expand_env64 ProgramW6432)"
W_PROGRAMW6432_UNIX="$(w_pathconv -u "${W_PROGRAMW6432_WIN}")"
# 64-bit Windows has a second directory for program files
- W_PROGRAMS_X86_WIN="${W_PROGRAMS_WIN} (x86)"
- W_PROGRAMS_X86_UNIX="${W_PROGRAMS_UNIX} (x86)"
+ W_PROGRAMS_X86_WIN="$(w_expand_env32 ProgramFiles)"
+ W_PROGRAMS_X86_UNIX="$(w_pathconv -u "${W_PROGRAMS_X86_WIN}")"
- W_COMMONFILES_X86_WIN="$(w_expand_env CommonProgramFiles\(x86\))"
+ W_COMMONFILES_X86_WIN="$(w_expand_env64 CommonProgramFiles\(x86\))"
W_COMMONFILES_X86="$(w_pathconv -u "${W_COMMONFILES_X86_WIN}")"
- W_COMMONFILES_WIN="$(w_expand_env CommonProgramW6432)"
+ W_COMMONFILES_WIN="$(w_expand_env64 CommonProgramW6432)"
W_COMMONFILES="$(w_pathconv -u "${W_COMMONFILES_WIN}")"
# 64-bit prefixes still have plenty of issues/a lot of verbs only install 32-bit libraries
@@ -5130,9 +5140,6 @@ winetricks_set_wineprefix()
WINE_MULTI="${WINE}"
W_ARCH=win32
- W_PROGRAMS_WIN="$(w_expand_env ProgramFiles)"
- W_PROGRAMS_UNIX="$(w_pathconv -u "${W_PROGRAMS_WIN}")"
-
# Common variable for 32-bit dlls on win32/win64:
W_SYSTEM32_DLLS="${W_WINDIR_UNIX}/system32"
W_SYSTEM32_DLLS_WIN="C:\\windows\\system32"
@@ -5143,19 +5150,22 @@ winetricks_set_wineprefix()
W_SYSTEM64_DLLS_WIN32="C:\\does-not-exist-on-win32" # path to access 64-bit dlls from 32-bit apps
W_SYSTEM64_DLLS_WIN64="C:\\does-not-exist-on-win32" # path to access 64-bit dlls from 64-bit apps
+ W_PROGRAMS_WIN="$(w_expand_env32 ProgramFiles)"
+ W_PROGRAMS_UNIX="$(w_pathconv -u "${W_PROGRAMS_WIN}")"
+
W_PROGRAMS_X86_WIN="${W_PROGRAMS_WIN}"
W_PROGRAMS_X86_UNIX="${W_PROGRAMS_UNIX}"
- W_COMMONFILES_X86_WIN="$(w_expand_env CommonProgramFiles)"
+ W_COMMONFILES_X86_WIN="$(w_expand_env32 CommonProgramFiles)"
W_COMMONFILES_X86="$(w_pathconv -u "${W_COMMONFILES_X86_WIN}")"
- W_COMMONFILES_WIN="$(w_expand_env CommonProgramFiles)"
+ W_COMMONFILES_WIN="$(w_expand_env32 CommonProgramFiles)"
W_COMMONFILES="$(w_pathconv -u "${W_COMMONFILES_WIN}")"
fi
## Arch independent variables:
# Note: using AppData since it's arch independent
- W_APPDATA_WIN="$(w_expand_env AppData)"
+ W_APPDATA_WIN="$(w_expand_env32 AppData)"
W_APPDATA_UNIX="$(w_pathconv -u "${W_APPDATA_WIN}")"
case "${W_APPDATA_WIN}" in
--
2.42.1
......@@ -17,6 +17,10 @@ Source: %name-%version.tar
Patch2: 0001-winetricks-try-use-xvt-as-terminal.patch
Patch10: 0001-Remove-unuseful-binary-arch-detection.patch
Patch11: 0002-add-w_expand_env32-and-w_expand_env64-and-using-them.patch
Patch12: 0003-Rename-w_try_regsvr-to-w_try_regsvr32.patch
BuildArch: noarch
ExclusiveArch: %ix86 x86_64 %arm aarch64
......@@ -50,6 +54,9 @@ or tweak various Wine settings individually.
%prep
%setup
%patch2 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
# fix req. Disable autoreq at all?
%__subst 's|fusermount|a= fusermount|' src/winetricks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment