0002-Remove-unuseful-binary-arch-detection.patch 5.94 KB
Newer Older
Vitaly Lipatov's avatar
Vitaly Lipatov committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
From aaf289cc98d5c86c3b466d93228e1cbf46e3408e Mon Sep 17 00:00:00 2001
From: Vitaly Lipatov <lav@etersoft.ru>
Date: Thu, 6 Feb 2025 12:27:43 +0300
Subject: [PATCH 2/2] Remove unuseful binary arch detection
To: wine-devel <wine-devel@winehq.org>

---
 src/winetricks | 81 ++------------------------------------------------
 1 file changed, 2 insertions(+), 79 deletions(-)

diff --git a/src/winetricks b/src/winetricks
index 0204c63..1f5e1cc 100755
--- a/src/winetricks
+++ b/src/winetricks
@@ -1054,34 +1054,6 @@ w_expand_env()
     winetricks_early_wine_arch cmd.exe /c "chcp 65001 > nul & echo %$1%"
 }
 
-# Determine what architecture a binary file is built for, silently continue in case of failure.
-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_file_arch="" ;;
-        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_file_arch="" ;;
-        esac
-    fi
-
-    echo "${_W_file_arch}"
-}
-
 # Get the latest tagged release from github.com API
 w_get_github_latest_release()
 {
@@ -4428,52 +4400,9 @@ winetricks_set_wineprefix()
         fi
         WINEBOOT_BIN="$(dirname "${WINESERVER_BIN}")/$(basename "${WINESERVER_BIN}"|sed 's,wineserver,wineboot,')"
 
-        _W_wineserver_binary_arch="$(winetricks_get_file_arch "${WINESERVER_BIN}")"
-        if [ -z "${_W_wineserver_binary_arch}" ]; then
-            # wineserver might be a script calling a binary in Wine's bindir.
-            if [ -z "${WINE_BINDIR}" ] && [ -x "${WINEBOOT_BIN}" ]; then
-                WINE_BINDIR="$(dirname "$(${READLINK_F} "${WINEBOOT_BIN}" 2>/dev/null)" 2>/dev/null)"
-            fi
-            # wineserver in Wine's bindir might be a script calling wineserver64 preferably over wineserver32 (Debian).
-            # Try these before testing wineserver itself
-            if [ -x "${WINE_BINDIR}/wineserver64" ]; then
-                _W_wineserver_binary_arch="$(winetricks_get_file_arch "${WINE_BINDIR}/wineserver64")"
-            elif [ -x "${WINE_BINDIR}/wineserver32" ]; then
-                _W_wineserver_binary_arch="$(winetricks_get_file_arch "${WINE_BINDIR}/wineserver32")"
-            elif [ -x "${WINE_BINDIR}/wineserver" ]; then
-                _W_wineserver_binary_arch="$(winetricks_get_file_arch "${WINE_BINDIR}/wineserver")"
-            fi
-        fi
-        if [ -z "${_W_wineserver_binary_arch}" ]; then
-            w_warn "Unknown file arch of ${WINESERVER_BIN}."
-        fi
-
         if [ -z "${WINE_BIN}" ]; then
             WINE_BIN="$(command -v "${WINE}")"
         fi
-        _W_wine_binary_arch="$(winetricks_get_file_arch "${WINE_BIN}")"
-        if [ -z "${_W_wine_binary_arch}" ]; then
-            # wine might be a script calling a binary in Wine's bindir.
-            if [ -z "${WINE_BINDIR}" ] && [ -x "${WINEBOOT_BIN}" ]; then
-                WINE_BINDIR="$(dirname "$(${READLINK_F} "${WINEBOOT_BIN}" 2>/dev/null)" 2>/dev/null)"
-            fi
-            if [ -x "${WINE_BINDIR}/wine" ]; then
-                _W_wine_binary_arch="$(winetricks_get_file_arch "${WINE_BINDIR}/wine")"
-            fi
-        fi
-        if [ -z "${_W_wine_binary_arch}" ]; then
-            w_warn "Unknown file arch of ${WINE_BIN}."
-        fi
-
-        # determine wow64 type (new/old)
-        # FIXME: check what upstream is calling them
-        if [ -z "${_W_wineserver_binary_arch}" ] || [ -z "${_W_wine_binary_arch}" ]; then
-            _W_wow64_style="unknown"
-        elif [ "${_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.):
@@ -4482,8 +4411,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
@@ -4494,6 +4421,8 @@ winetricks_set_wineprefix()
                 if [ -x "${WINE_BINDIR}/wine64" ]; then
                     # Workaround case where wine is in path, but wine64 is only in Wine's bindir
                     WINE64="${WINE_BINDIR}/wine64"
+                else
+                    WINE64="${WINE_BINDIR}/wine"
                 fi
             else
                 # Handle case where wine binaries (or binary wrappers) have a suffix
@@ -4566,15 +4495,9 @@ winetricks_set_wineprefix()
                 *) w_warn "You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug." ;;
             esac
 
-            if [ "${_W_wow64_style}" = "new" ]; then
-                w_warn "You appear to be using Wine's new wow64 mode. Note that this is EXPERIMENTAL and not yet fully supported. If reporting an issue, be sure to mention this."
-            elif [ "${_W_wow64_style}" = "unknown" ]; then
-                w_warn "WoW64 type could not be detected."
-            fi
         fi
 
     else
-        _W_wow64_style="none"
         WINE64="false"
         WINE_ARCH="${WINE}"
         WINE_MULTI="${WINE}"
-- 
2.42.4