[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[pkg-wine-party] Bug#742561: wine script - wine64 support



Followup-For: Bug #742561
Package: wine-development
Version: 1.7.27-1


Hi,

attached is a new patch to fix the wine64 support. I changed my approach
to only use wine64 if WINEARCH is set.

- Wine script:
  - Use wine64 if WINEARCH is win64, show help message and exit if
    wine64 is not installed.
  - Show help message and exit, if called without WINEARCH, but only
    wine64 is installed.
  - If WINEARCH is set, add it to the call of the wine executable.
- Add wine64 wrapper script to call wine script with WINEARCH set to
  win64.
- Patch winemenubuilder to set WINEARCH.

My patch for winemenubuilder only works if WINEARCH was set. Otherwise
it results in WINEARCH="(null)". Possible solutions might be:
- Change the patch to only add a WINEARCH entry if WINEARCH was set.
- Only apply the patch on amd64. With my proposed solution WINEARCH is
  always set when using wine64 (except if you call the executable
  directly) - so this would work.
NOTE: Just passing an empty WINEARCH to the wine executable (if WINEARCH
was not set) does not work,

Greets
jre

diff --git a/debian/patches/winemenubuilder.patch b/debian/patches/winemenubuilder.patch
index 3b2d8f3..d43a36c 100644
--- a/debian/patches/winemenubuilder.patch
+++ b/debian/patches/winemenubuilder.patch
@@ -3,21 +3,24 @@ author: Michael Gilbert <mgilbert@debian.org>
 
 --- a/programs/winemenubuilder/winemenubuilder.c
 +++ b/programs/winemenubuilder/winemenubuilder.c
-@@ -1455,7 +1455,7 @@ static BOOL write_desktop_entry(const ch
+@@ -1455,8 +1455,8 @@
  
      fprintf(file, "[Desktop Entry]\n");
      fprintf(file, "Name=%s\n", linkname);
 -    fprintf(file, "Exec=env WINEPREFIX=\"%s\" wine %s %s\n",
-+    fprintf(file, "Exec=env WINEPREFIX=\"%s\" wine-development %s %s\n",
-             wine_get_config_dir(), path, args);
+-            wine_get_config_dir(), path, args);
++    fprintf(file, "Exec=env WINEPREFIX=\"%s\" WINEARCH=\"%s\" wine-development %s %s\n",
++            wine_get_config_dir(), getenv( "WINEARCH" ), path, args);
      fprintf(file, "Type=Application\n");
      fprintf(file, "StartupNotify=true\n");
-@@ -2529,7 +2529,7 @@ static BOOL write_freedesktop_associatio
+     if (descr && lstrlenA(descr))
+@@ -2529,7 +2529,8 @@
          fprintf(desktop, "Type=Application\n");
          fprintf(desktop, "Name=%s\n", friendlyAppName);
          fprintf(desktop, "MimeType=%s;\n", mimeType);
 -        fprintf(desktop, "Exec=env WINEPREFIX=\"%s\" wine start /ProgIDOpen %s %%f\n", wine_get_config_dir(), progId);
-+        fprintf(desktop, "Exec=env WINEPREFIX=\"%s\" wine-development start /ProgIDOpen %s %%f\n", wine_get_config_dir(), progId);
++        fprintf(desktop, "Exec=env WINEPREFIX=\"%s\" WINEARCH=\"%s\" wine-development start /ProgIDOpen %s %%f\n",
++                wine_get_config_dir(), getenv( "WINEARCH" ), progId);
          fprintf(desktop, "NoDisplay=true\n");
          fprintf(desktop, "StartupNotify=true\n");
          if (openWithIcon)
diff --git a/debian/rules b/debian/rules
index 11961f0..c5b2d1d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -72,6 +72,7 @@ override_dh_auto_configure:
 override_dh_install: $(INSTALLS)
 	mkdir -p debian/tmp
 	cp debian/scripts/wine debian/tmp/wine$(VERSION)
+	cp debian/scripts/wine64 debian/tmp/wine64$(VERSION)
 	sed 's|LIBDIR|$(LIBDIR)|g' < debian/scripts/winegcc > debian/tmp/winegcc$(DEB_BUILD_ARCH_BITS)$(VERSION)
 	cp tools/winedump/README debian/tmp/README.winedump
 	cp programs/winedbg/README debian/tmp/README.winedbg
diff --git a/debian/scripts/wine b/debian/scripts/wine
index 7609c69..d579234 100755
--- a/debian/scripts/wine
+++ b/debian/scripts/wine
@@ -6,20 +6,43 @@ bindir=/usr/lib/$name
 wine32=$bindir/wine
 wine64=$bindir/wine64
 
-if test -x $wine32; then
+if test "$WINEARCH" = "win64" ; then
+    if test -x $wine64; then
+        wine=$wine64
+    else
+        echo "error: WINEARCH is win64, but unable to find wine64 executable."
+        if [ "$(dpkg --print-architecture)" = "amd64" ]; then
+            echo "as root, please execute \"apt-get install $(echo $name | sed s/wine/wine64/)\""
+        else
+            echo "you need $(echo $name | sed s/wine/wine64/). but this is only available on architecture amd64."
+        fi
+        exit 1
+    fi
+elif test -x $wine32; then
     wine=$wine32
 elif test -x $wine64; then
     wine=$wine64
+    echo "error: unable to find wine executable."
     if [ "$(dpkg --print-architecture)" = "amd64" -a "$(dpkg --print-foreign-architectures)" != "i386" ]; then
         echo "it looks like multiarch needs to be enabled.  as root, please"
         echo "execute \"dpkg --add-architecture i386 && apt-get update &&"
-        echo "apt-get install $(echo $name | sed s/wine/wine32/)\""
+    else
+        echo -n "as root, please execute \""
     fi
+    echo "apt-get install $(echo $name | sed s/wine/wine32/)\""
+    echo "if you want to use wine64 set WINEARCH to win64, or use \"$(echo $name | sed s/wine/wine64/)\"."
+    exit 1
 else
     echo "error: unable to find wine executable.  this shouldn't happen."
     exit 1
 fi
 
+if test -z $WINEARCH; then
+    winearch=
+else
+    winearch="WINEARCH=$WINEARCH"
+fi
+
 if test -z $WINELOADER; then
     wineloader=$wine
 else
@@ -32,4 +55,4 @@ else
     winedebug=$WINEDEBUG
 fi
 
-WINELOADER=$wineloader WINEDEBUG=$winedebug $wine "$@"
+eval $winearch WINELOADER=$wineloader WINEDEBUG=$winedebug $wine "$@"
diff --git a/debian/scripts/wine64 b/debian/scripts/wine64
new file mode 100755
index 0000000..c546ae2
--- /dev/null
+++ b/debian/scripts/wine64
@@ -0,0 +1,4 @@
+#!/bin/sh -e
+
+# Execute wine script with WINEARCH set to win64
+WINEARCH=win64 $(echo $0|sed s/64//) $@
diff --git a/debian/wine64VERSION.install b/debian/wine64VERSION.install
index 7b83d9d..688b4bd 100644
--- a/debian/wine64VERSION.install
+++ b/debian/wine64VERSION.install
@@ -1 +1,3 @@
 usr/lib/*/*/wine64 usr/lib/wineVERSION
+debian/tmp/wine64VERSION usr/bin
+

Reply to: