logoalt Hacker News

radarroarkyesterday at 11:12 PM9 repliesview on HN

Anyone have experience with distributing win32 programs for Linux and/or MacOS by bundling wine? I take it that statically linking is out of the question, but I am guessing you could make an AppImage binary for linux that includes wine, and for MacOS you could include wine in the app bundle. I haven't tried either though. I'm interested in this so I can use win32 as a cross-platform desktop GUI library.


Replies

forestoyesterday at 11:44 PM

You might consider Flatpak packaging.

Flathub offers the org.winehq.Wine package, which you can use in the base and base-version fields of your own package's manifest. It wouldn't cause your code to be statically linked with Wine. Your package could then be distributed from your own flatpak remote.

There was an announcement about a year ago of an effort to make a paid flatpak market, apparently to be called Flathub LLC. I don't know if that effort is still active.

https://discourse.flathub.org/t/request-for-proposals-flathu...

Winelib might also be worth considering, depending on how you are able to navigate the relevant licenses.

https://gitlab.winehq.org/wine/wine/-/wikis/Winelib-User's-G...

I think Qt would yield better results than Wine for most things. Since your comment suggests that you're making proprietary software, you would have to take special care with linking or else submit to the Qt Group's commercial license terms.

show 3 replies
circuit10yesterday at 11:40 PM

Winelib sounds like what you’re describing about static linking: https://gitlab.winehq.org/wine/wine/-/wikis/Winelib-User's-G...

show 1 reply
darthcircuittoday at 1:59 AM

Check out GameImage!

https://github.com/gameimage/gameimage

This started out with bundling wine in appimages, but is expanded a lot. The author created a new appimage alternative that adds some stuff to make games work more reliably. I’ve used this several times to create portable versions of old windows games for my Steam Deck. It’s awesome!

mid-kidtoday at 12:25 AM

I've seen a few russian pirated game releases for linux do this, they just bundle a copy of wine (downloaded from the same places as e.g. lutris gets it from), and a start script that sets the WINEPREFIX variable to a pre-populated prefix, with the game already installed and all the needed registry configurations already present. I suppose you could bundle all this in an AppImage, the annoying part however is that the WINEPREFIX is supposed to be read-write, so you'd have to set it to some place specific to your app, to avoid messing with the user's main prefix. These prefixes are huge (hundreds of MB upon creation), so I'm not sure I'd consider this a desireable solution.

If this is your distribution method, consider having the user install wine before running your app.

kccqzytoday at 2:10 AM

I don’t have experience but I have heard of winelib which is a library implementing Win32 APIs. I suppose you don’t compile your code as PE executable, but compile to Linux natively while dynamically linking to winelib.

Rohansiyesterday at 11:20 PM

I'm curious why you'd want this over using a GUI library that is actually cross-platform? The way you've worded things suggests to me that you're building something new.

show 4 replies
cmxchyesterday at 11:22 PM

Depending on the use case, you might be able to get away with PowerShell with Pinvoke bindings if your code is more script-like than compiled code.

Instead of making your own GUI library, you could just make a shim that translates to whatever framework you want to support.

See: https://learn.microsoft.com/en-us/dotnet/standard/native-int...

transcriptasetoday at 12:20 AM

That sounds antithetical to the “never just works” philosophy of Linux software.