[pkg-wine-party] Bug#769234: Bug#769234: Automatically detect wine32 and wine64.

Austin English austinenglish at gmail.com
Fri Dec 11 22:08:48 UTC 2015


On Fri, Dec 11, 2015 at 3:52 PM, Jens Reyer <jre.winesim at gmail.com> wrote:
> Hi,
>
> please see below for another patch. IMO it is clean, simple and
> matches the logic of the wine-script perfectly.
>
> It tries to detect the correct wine version using the following
> precedence:
>
> 1. WINEARCH - can't be misinterpreted and was also used
>    previously.
> 2. WINEPREFIX - if it is set and system.reg exists, we have a
>    clean indicator if it is a 32-bit or 64-bit installation,
>    and therefore which wine to use.
> 3. WINELOADER - if it is set to a known loader, use this for
>    deciding which wine to use.
>    The 32-bit loaders seem to work with both wine32 and wine64,
>    but I see no point in doing this here. Instead it is easier
>    to choose the correct 32-bit or 64-bit wineprefix later if
>    wine loader and binary match.
>    Note that I'm not really familiar with the preloader.
> 4. Test with "file" if $1 is a 64-bit application. Note that some
>    64-bit applications have PE32 installers, or install single
>    PE32 executables. But those also seem to work with wine64 as
>    long as wine32 is installed. Therefore only testing for PE32+.
>
> Additionally to the posted patch, we'd need to depend on "file".
>
> It seems to work perfectly, except for one case which can't be solved
> here:
>
> 64-bit applications with PE32 installers still require manual
> intervention (e.g. export WINEARCH=win64) to install correctly. Then
> they will work automatically afterwards.
> Without manual intervention they are installed in a 32-bit prefix.
> Desktop launchers are broken then. Starting a 64-bit app directly will
> work, but will be running in a 64-bit prefix despite of being installed
> in a 32-bit prefix.
> Without these changes they will be installed in a 32-bit prefix, but
> then fail to work.
> So this patch may obfuscate the need for manual intervention.
>
> However one may use WoW64 (#762058) together with this patch.
>
> What do you think?
>
> Greets
> jre
>
>
> =======================================
> diff --git a/debian/scripts/wine b/debian/scripts/wine
> index eb929a9..a1463c9 100755
> --- a/debian/scripts/wine
> +++ b/debian/scripts/wine
> @@ -6,6 +6,32 @@ bindir=/usr/lib/$name
>  wine32=$bindir/wine
>  wine64=$bindir/wine64
>
> +if test -n "$WINEARCH"; then
> +    true
> +elif [ -n "$WINEPREFIX" ] &&
> +         [ -e "${WINEPREFIX}/system.reg" ] &&
> +         grep -q "^\#arch=win32" "${WINEPREFIX}/system.reg"; then
> +    echo "Setting WINEARCH=win32 because $WINEPREFIX is a 32-bit installation."
> +    WINEARCH=win32
> +elif [ -n "$WINEPREFIX" ] &&
> +         [ -e "${WINEPREFIX}/system.reg" ] &&
> +         grep -q "^\#arch=win64" "${WINEPREFIX}/system.reg"; then
> +    echo "Setting WINEARCH=win64 because $WINEPREFIX is a 64-bit installation."
> +    WINEARCH=win64
> +elif [ -n "$WINELOADER" ] &&
> +         [ "$(echo $WINELOADER|sed "s|-preloader||;s|wine32|wine|")" = "/usr/lib/$name/wine" ]; then
> +    echo "Setting WINEARCH=win32 because of WINELOADER $WINELOADER."
> +    WINEARCH=win32
> +elif [ -n "$WINELOADER" ] &&
> +         [ "$(echo $WINELOADER|sed "s|-preloader||")" = "/usr/lib/$name/wine64" ]; then
> +    echo "Setting WINEARCH=win64 because of WINELOADER $WINELOADER."
> +    WINEARCH=win64
> +elif [ -f "$1" ] &&
> +         file -bL "$1"|grep -Eq "PE32+ executable.*x86-64"; then
> +    echo "Setting WINEARCH=win64 because $1 is a PE32+ executable."
> +    WINEARCH=win64
> +fi
> +
>  if test -x $wine32 -a "$WINEARCH" != "win64"; then
>      wine=$wine32
>  elif test -x $wine64; then
>
> _______________________________________________
> pkg-wine-party mailing list
> pkg-wine-party at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-wine-party

Only speaking as an upstream observer, I haven't followed the issues
with the debian wine packaging too closely..

That said, I think going out of your way to detect what sort of prefix
to use is the wrong approach. A properly built wow64 install will
automatically use the correct wine bitness when launching
applications. Trying to detect what architecture to use is prone to
breakage, as you've seen.

In general, upstream recommends running 32-bit Wine if 64-bit
executables are not needed. For users on 64-bit OSes, the
recommendation is usually to remove Wine64 packages if you don't want
them.

I don't know what issues these wrapper scripts the package is using
are supposed to solve, they seem to be causing more issues than they
solve, AFAICT.

In any case, good luck, thanks for packaging/updating Wine on Debian.

-- 
-Austin



More information about the pkg-wine-party mailing list