summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAmbroz Bizjak <abizjak.pro@gmail.com>2019-06-26 18:38:14 +0200
committerAmbroz Bizjak <abizjak.pro@gmail.com>2019-06-27 14:38:57 +0200
commit96c957f92cabf2b77b8df1950f46c22dda65c186 (patch)
tree09d3f586b8cd3bc033fdd810f2e981d58b6fcc8b /pkgs
parent54cbf55543a8da5d8198e15e46fa92607e169b63 (diff)
downloadnixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.tar
nixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.tar.gz
nixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.tar.bz2
nixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.tar.lz
nixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.tar.xz
nixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.tar.zst
nixpkgs-96c957f92cabf2b77b8df1950f46c22dda65c186.zip
wine: Set WINELOADER in wrapper, wrap also wine64.
Fixes #63170. Note that this brings back wrapping of wine64 which was removed in #28486 because the underlying issue is now fixed.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/misc/emulators/wine/base.nix21
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/misc/emulators/wine/base.nix b/pkgs/misc/emulators/wine/base.nix
index e86db53c88a..8edf7ad3959 100644
--- a/pkgs/misc/emulators/wine/base.nix
+++ b/pkgs/misc/emulators/wine/base.nix
@@ -95,10 +95,25 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
           ((map (links "share/wine/gecko") geckos)
         ++ (map (links "share/wine/mono")  monos))}
   '' + lib.optionalString supportFlags.gstreamerSupport ''
-    for i in wine ; do
-      if [ -e "$out/bin/$i" ]; then
-        wrapProgram "$out/bin/$i" \
+    # Wrapping Wine is tricky.
+    # https://github.com/NixOS/nixpkgs/issues/63170
+    # https://github.com/NixOS/nixpkgs/issues/28486
+    # The main problem is that wine-preloader opens and loads the wine(64) binary, and
+    # breakage occurs if it finds a shell script instead of the real binary. We solve this
+    # by setting WINELOADER to point to the original binary. Additionally, the locations
+    # of the 32-bit and 64-bit binaries must differ only by the presence of "64" at the
+    # end, due to the logic Wine uses to find the other binary (see get_alternate_loader
+    # in dlls/kernel32/process.c). Therefore we do not use wrapProgram which would move
+    # the binaries to ".wine-wrapped" and ".wine64-wrapped", but use makeWrapper directly,
+    # and move the binaries to ".wine" and ".wine64".
+    for i in wine wine64 ; do
+      prog="$out/bin/$i"
+      if [ -e "$prog" ]; then
+        hidden="$(dirname "$prog")/.$(basename "$prog")"
+        mv "$prog" "$hidden"
+        makeWrapper "$hidden" "$prog" \
           --argv0 "" \
+          --set WINELOADER "$hidden" \
           --prefix GST_PLUGIN_SYSTEM_PATH_1_0 ":" "$GST_PLUGIN_SYSTEM_PATH_1_0"
       fi
     done