I’m experimenting with Wine for Mac, and one thing I have noticed is that it is a pain to compile from source. In fact, that is the only way you can get Wine for Mac as there are no prebuilt binaries. For starters, you need to compile libraries that Wine depends on, which isn’t too bad with the help of MacPorts, but it gets a little complicated with Snow Leopard. Everything compiled via MacPorts is 64-bit on Snow Leopard, and Wine currently only compiles in 32-bit. To solve this, add the “+universal” variant at the end of all the packages you install (i.e. “sudo port install fontconfig +universal”). In some cases, a package will not build in 32-bit mode (in particular the mpg123 library). I was more or less able to get Wine working following the steps outlined on the Wine wiki: http://wiki.winehq.org/MacOSX/Building, but programs I ran on it didn’t look that great. For whatever reason, I was missing xrender, which I think attributed to applications looking bad. I tried installing it with MacPorts, but then I had two versions of X11 on my system, which was causing conflicts when I tried compiling Wine. No good. Each person who compiles Wine has the potential to have different dependencies, which may lead to different behaviors when running Wine. For instance, when I was running Steam, none of the buttons were rounded, and checkboxes weren’t showing up. I almost reported this as a Mac related bug, when the cause was me missing a library somewhere.
What I came up with as a potential solution to this problem involves a program called WineBottler. It is probably the closest thing there is to a distributable binary of Wine, and works great out of the box. This application confirmed my theory that I was missing a library for running Steam. WineBottler had all the libraries to make Wine run well, but it didn’t have the latest version. What I ended up doing was downloading the latest source using git, configuring the build and linking to those libraries included with WineBottler, and installing the newer build over the binaries originally shipped with WineBottler.
- Download the latest version of WineBottler and install it.
- Start out by getting the Wine source outlined here: http://wiki.winehq.org/GitWine
- If you’re on Snow Leopard, run the following commands:
$ export CFLAGS="-arch i386 -m32"; $ export CXXFLAGS="$CFLAGS"
- Set the CPPFLAGS environment variable:
$ export CPPFLAGS="-I/usr/X11/include -I/Applications/Wine.app/Contents/Resources/include"
- Set the LDFLAGS environment variable:
$ export LDFLAGS="-L/usr/X11/lib -L/Applications/Wine.app/Contents/Resources/lib"
- Configure Wine:
$ ./configure --prefix=/Applications/Wine.app/Contents/Resources
- Build Wine:
$ make depend && make && make install
Referencing the already compiled libraries from Wine.app allow us to build newer versions of Wine without having to worry about having all the correct libraries. Setting the prefix when we run ./configure automatically copies all the newly built binaries over to Wine.app. So now when I open the Wine config for Steam, I now have the latest version of Wine (it was originally 1.1.34):
One potential downside to this is that you may not be able to debug Wine with this setup. I know there is an option in WineBottler to output errors to a log file in ~/Library/Logs/Wine.log, but I’m not sure how verbose it is. And you can’t run “make test” without setting DYLD_FALLBACK_LIBRARY_PATH. I’ve tried doing both in the command line without success thus far.
One direction I hope Wine starts moving towards is removing these dependencies in favor of libraries that are already included in OS X. This would make creating prebuilt binaries much easier, and open Wine up to those who are less technically inclined. I think the Wine maintainers recognize that to some extent, and have listed implementing a Quartz Driver a priority for Wine’s 1.2 release. I personally don’t know what Quartz does/doesn’t allow, but it is conceivable to remove x11 and freetype as required libraries because TrueType rendering is natively supported on the Mac (Apple created it). As I learn more about Wine, I will try and post more information that new developers might find useful.
