Skip to content

Commit

Permalink
Allow {WINE,WINESERVER}_BIN env vars
Browse files Browse the repository at this point in the history
Make it possible to set `WINE_BIN` and `WINESERVER_BIN` using
environment variables outside Winetricks. These affect binary bitness
detection during startup.

Winetricks performs a Wine binary bitness detection to print a warning.
In some environments such as Protontricks and Nix, the Wine executables are
wrappers that call binaries that are located elsewhere. In those
situations we want to provide the path to the binary that's only used
for the check to avoid printing unnecessary warnings.

Closes: #2183
  • Loading branch information
Matoking authored and austin987 committed Jan 13, 2025
1 parent b7cf27d commit 1d441b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/winetricks
Original file line number Diff line number Diff line change
Expand Up @@ -4402,7 +4402,13 @@ winetricks_set_wineprefix()
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="$(command -v "${WINESERVER}")"
# WINE_BIN and WINESERVER_BIN can be set outside Winetricks in case
# the `wine` and `wineserver` executables and the actual Wine binaries
# are located in different locations (usually the case for wrappers);
# this helps to avoid spurious "unknown file arch" warnings.
if [ -z "${WINESERVER_BIN}" ]; then
WINESERVER_BIN="$(command -v "${WINESERVER}")"
fi

# wineboot often is a link pointing to wineapploader in Wine's bindir. If we don't find binaries we may look for them there later
if [ -n "${READLINK_F}" ]; then
Expand Down Expand Up @@ -4436,7 +4442,9 @@ winetricks_set_wineprefix()
w_warn "Unknown file arch of ${WINESERVER_BIN}."
fi

WINE_BIN="$(command -v "${WINE}")"
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.
Expand Down

0 comments on commit 1d441b4

Please sign in to comment.