Opened 7 years ago

Closed 6 years ago

#53651 closed enhancement (fixed)

wine, wine-crossover, wine-devel: add 64-bit support

Reported by: axet (Alexey Kuznetsov) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: jyrkiwahlstedt, mojca (Mojca Miklavec), 1-61803
Port: wine wine-crossover wine-devel

Description

Hello!

According to wine FAQ here is a two type of prefixes 32 and 64 bits. But macports wine seems to be compiled without 64 bit support

https://wiki.winehq.org/FAQ

axet-laptop:~ axet$ WINEARCH=win64 WINEPREFIX=~/test wine winecfg
wine: created the configuration directory '/Users/axet/test'
wine: WINEARCH set to win64 but '/Users/axet/test' is a 32-bit installation.

mac osx 10.12.3, wine-devel

Change History (14)

comment:1 Changed 7 years ago by kencu (Ken)

As per that FAQ you referenced, 64 bit wine is really only for Linux at present. There are some MacOS initiatives for it, it appears, but also some ABI issues that might make it never work generally.

comment:2 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jyrkiwahlstedt added; ryandesign@… jwa@… removed
Owner: set to ryandesign
Port: wine wine-crossover added
Status: newassigned
Summary: WINEARCH=win64 not workingwine, wine-crossover, wine-devel: add 64-bit support
Type: defectenhancement

Yes, wine ports in MacPorts are compiled for 32-bit only, based on this statement on why 64-bit Windows apps cannot run in Wine on macOS:

https://www.winehq.org/wwn/364#Wine64%20on%20Mac%20OS%20X

Nevertheless, wine apparently compiles 64-bit on macOS now and may work for some Windows programs; the developers offer separate 32-bit and 64-bit macOS binaries for wine. I have not yet attempted to build the wine ports 64-bit and don't know what would happen if we did that. Can a 32-bit Windows program run in 64-bit wine? If not, most users would probably want to build wine universal.

comment:3 in reply to:  2 Changed 7 years ago by casr (Chris Rawnsley)

Replying to ryandesign:

Nevertheless, wine apparently compiles 64-bit on macOS now

Yes, but only as recently as the 2.0 release.

Can a 32-bit Windows program run in 64-bit wine?

Not directly but the 64-bit version can utilise the 32-bit binaries via WoW (Windows on Windows).

I have been looking into updating the Wine port to have 64-bit support and it looks to be an unusual one. A quick summary of the build process is roughly:

tar xjf wine-2.0.tar.bz2
# Directory wine-2.0 is created

mkdir wine32-build wine64-build

# Make sure 64-bit headers and libs are available...
cd wine64-build; ../wine-2.0/configure --enable-win64; make

# Make sure 32-bit headers and libs are available...
cd wine32-build; ../wine-2.0/configure --with-wine64=../wine-64-build; make

I'm not sure of the best way to handle this within MacPorts but I imagine it would be something like creating a wine64 port and then referencing it in the original wine port. The switch --with-wine64=../wine-64-build is where is where I get stuck though. How would you reference another port’s build directory?

comment:4 Changed 7 years ago by casr (Chris Rawnsley)

I discovered the muniversal port group today and created the patch below. It's going in the right direction but be aware of:

  • that it currently does not download nor install wine-mono for x86_64 version
  • /opt/local/lib64 is created

I tried --libdir=${prefix}/lib but lipo didn't know what to do with the fakedll directory so I'm leaving it for now.

--- x11/wine/Portfile.orig
+++ x11/wine/Portfile
@@ -1,6 +1,7 @@
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 
 PortSystem                  1.0
+PortGroup                   muniversal 1.0
 PortGroup                   compiler_blacklist_versions 1.0
 
 # Please keep the wine, wine-devel and wine-crossover ports as similar as possible.
@@ -13,12 +14,14 @@ name                        wine
 conflicts                   wine-devel wine-crossover
 set my_name                 wine
 version                     2.0
+revision                    1
 set branch                  [lindex [split ${version} .] 0].0
 license                     LGPL-2.1+
 categories                  x11
 maintainers                 ryandesign jwa openmaintainer
 homepage                    https://www.winehq.org
 platforms                   darwin
+supported_archs             i386 x86_64
 use_bzip2                   yes
 distname                    ${my_name}-${version}
 dist_subdir                 ${my_name}
@@ -95,6 +98,16 @@ patchfiles                  BOOL.patch \
                             mach_machine.patch \
                             tiger-shell.patch
 
+pre-configure {
+    if {[variant_isset universal]} {
+        foreach arch ${universal_archs_to_use} {
+            file mkdir ${worksrcpath}-${arch}
+        }
+
+        configure.cmd ${worksrcpath}/configure
+    }
+}
+
 # Wine requires the program specified in INSTALL to create intermediate
 # directories; /usr/bin/install doesn't.
 # http://bugs.winehq.org/show_bug.cgi?id=35310
@@ -141,9 +154,10 @@ configure.args              --without-alsa \
                             --x-include=${prefix}/include \
                             --x-lib=${prefix}/lib
 
-# 64-bit Wine exists for Linux, but does not work on OS X.
-# http://www.winehq.org/pipermail/wine-devel/2014-February/103074.html
-supported_archs             i386
+configure.universal_args
+
+set merger_configure_args(x86_64) --enable-win64
+set merger_configure_args(i386)   --with-wine64=${workpath}/${worksrcdir}-x86_64
 
 # llvm-gcc-4.2 doesn't respect force_align_arg_pointer; wine builds but fails to run
 # http://bugs.winehq.org/show_bug.cgi?id=28030
Version 1, edited 7 years ago by casr (Chris Rawnsley) (previous) (next) (diff)

comment:5 Changed 7 years ago by casr (Chris Rawnsley)

Okay, so I had a bit more of a tinker around and patched it so that the DLL directory is treated separately; patch below.

--- x11/wine/Portfile.orig	2017-03-10 23:49:01.000000000 +0000
+++ x11/wine/Portfile	2017-03-10 23:48:32.000000000 +0000
@@ -1,6 +1,7 @@
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 
 PortSystem                  1.0
+PortGroup                   muniversal 1.0
 PortGroup                   compiler_blacklist_versions 1.0
 
 # Please keep the wine, wine-devel and wine-crossover ports as similar as possible.
@@ -13,12 +14,14 @@
 conflicts                   wine-devel wine-crossover
 set my_name                 wine
 version                     2.0
+revision                    2
 set branch                  [lindex [split ${version} .] 0].0
 license                     LGPL-2.1+
 categories                  x11
 maintainers                 ryandesign jwa openmaintainer
 homepage                    https://www.winehq.org
 platforms                   darwin
+supported_archs             i386 x86_64
 use_bzip2                   yes
 distname                    ${my_name}-${version}
 dist_subdir                 ${my_name}
@@ -91,10 +94,21 @@
                             port:pkgconfig
 
 patchfiles                  BOOL.patch \
+                            patch-configure.diff \
                             cups_headers.patch \
                             mach_machine.patch \
                             tiger-shell.patch
 
+pre-configure {
+    if {[variant_isset universal]} {
+        foreach arch ${universal_archs_to_use} {
+            file mkdir ${worksrcpath}-${arch}
+        }
+
+        configure.cmd ${worksrcpath}/configure
+    }
+}
+
 # Wine requires the program specified in INSTALL to create intermediate
 # directories; /usr/bin/install doesn't.
 # http://bugs.winehq.org/show_bug.cgi?id=35310
@@ -141,9 +155,14 @@
                             --x-include=${prefix}/include \
                             --x-lib=${prefix}/lib
 
-# 64-bit Wine exists for Linux, but does not work on OS X.
-# http://www.winehq.org/pipermail/wine-devel/2014-February/103074.html
-supported_archs             i386
+configure.universal_args
+
+set merger_configure_args(x86_64) "--enable-win64 --libdir=${prefix}/lib"
+set merger_configure_args(i386)   --with-wine64=${workpath}/${worksrcdir}-x86_64
+
+if {${build_arch} eq "x86_64"} {
+    default_variants            +universal
+}
 
 # llvm-gcc-4.2 doesn't respect force_align_arg_pointer; wine builds but fails to run
 # http://bugs.winehq.org/show_bug.cgi?id=28030
--- /dev/null	2017-03-10 23:49:01.000000000 +0000
+++ x11/wine/files/patch-configure.diff	2017-03-10 23:43:19.000000000 +0000
@@ -0,0 +1,19 @@
+# Output DLLs to different directories so that we don't have a clash when
+# they're merged back together
+
+--- configure.orig
++++ configure
+@@ -7320,7 +7320,12 @@
+ 
+ 
+ 
+-dlldir="\${libdir}/wine"
++if test "x$enable_win64" = "xyes"
++then
++  dlldir="\${libdir}/wine64"
++else
++  dlldir="\${libdir}/wine"
++fi
+ 
+ DLLFLAGS="-D_REENTRANT"
+ 
Last edited 7 years ago by casr (Chris Rawnsley) (previous) (diff)

comment:6 Changed 7 years ago by pete27

Thanks for the patch. Any idea how I can get wine-mono and wine-gecko x64 to work?

comment:7 Changed 7 years ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:9 Changed 7 years ago by 1-61803

Cc: 1-61803 added

comment:10 Changed 6 years ago by Chris Rawnsley <chris@…>

comment:11 Changed 6 years ago by raimue (Rainer Müller)

In 89ddfe3ef0c209887af6cdfaacbc2f77d9edf89d/macports-ports:

wine: Install wine_gecko-*-x86_64.msi

See: #53651

comment:12 Changed 6 years ago by raimue (Rainer Müller)

In 6641a5273e4d3a4fa33f21433152d09d3aa55cc8/macports-ports:

wine-devel: Merge 64-bit support from wine

Use a slightly different approach to modify dlldir for 64-bit, as it
is no longer set in the configure script.

See: #53651

comment:13 Changed 6 years ago by raimue (Rainer Müller)

In c62f20f7ee524701f74ccfc48df8f755c9a64bd5/macports-ports:

wine-crossover: Merge 64-bit support from wine

See: #53651

comment:14 Changed 6 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.