Skip to content

Instantly share code, notes, and snippets.

@publicarray
Last active December 25, 2019 02:29
Show Gist options
  • Save publicarray/c1631c76e147adc32e608d9e5fd390ee to your computer and use it in GitHub Desktop.
Save publicarray/c1631c76e147adc32e608d9e5fd390ee to your computer and use it in GitHub Desktop.
Compile a wineskin base on macOS 10.11 and newer

Option 1 - Compiling

Get the source

git clone git://source.winehq.org/git/wine.git

Or from the Github mirror

git clone https://github.com/wine-mirror/wine.git

Or download a release from www.winehq.org and extract the files.

Install dependencies

brew update
brew install wine --only-dependencies --without-x11 --devel

Apply patches (optional)

You can find wine-staging patches at: https://github.com/wine-staging/wine-staging

git apply --check 0001-secur32-Set-output-buffer-size-to-zero-during-handsh.patch
git apply 0001-secur32-Set-output-buffer-size-to-zero-during-handsh.patch

Prepare

Using Wineskin install the Wine Engine Base. Attempt a build. When asked if you want to install gcc-4.2 press 'N'. We will be using clang instead.

We need to trick Wineskin into beliving gcc-4.2 is installed. We can do this by symlinking our current version.

sudo ln -s /usr/bin/gcc /usr/local/bin/gcc-4.2

Edit configuration

Open ~/Library/Application Support/Wineskin/EngineBase/W2.5.5v1EngineBase/config.txt in your favourite editor. Next add the CC CXX and CFLAGS varables so that wine is now compiled with clang rather than the outdated gcc-4.2.

{location to the wine source code}
{wrapper_name}
CC=clang CXX=clang++ CFLAGS=-std=gnu89 --without-x --without-xml --disable-option-checking --without-oss --without-cms --disable-tests --without-v4l --without-alsa --without-audioio --without-capi --with-coreaudio --without-esd --without-hal --without-jack --with-xcomposite --with-xcursor --with-xinerama --with-xinput --with-xrandr --with-xrender --with-xshape --with-xshm --with-xslt --with-xxf86vm --without-fontconfig --without-gphoto --without-gstreamer --without-dbus
W2.5.5v1EngineBase
/Users/{user}/Library/Application Support/Wineskin/7za
10.11

On the last line is the operating system version number. Make sure it matches with yours.

Build

~/Library/Application\ Support/Wineskin/EngineBase/W2.5.5v1EngineBase/WineskinEngineBuild
brew rm $(join <(brew leaves) <(brew deps wine))
brew cleanup
cd {wine_source} && make clean
sudo periodic daily

don't forget to remove the wine source files.

Option 2 - download binary and convert/7zip

export WINE_VER=3.9
export WINE_BRANCH=devel # stable devel staging
wget "https://dl.winehq.org/wine-builds/macosx/pool/portable-winehq-$WINE_BRANCH-$WINE_VER-osx64.tar.gz"
tar xf portable-winehq-*-osx64.tar.gz
echo "WS9Wine$WINE_VER-$WINE_BRANCH-64bit" > usr/version
mv usr/ wswine.bundle
# tar cf - wswine.bundle | ~/Library/Application\ Support/Wineskin/7za a -si "WS9Wine$WINE_VER-$WINE_BRANCH-64bit.tar.7z"
brew install p7zip
tar cf - wswine.bundle | 7za a -si "WS9Wine$WINE_VER-$WINE_BRANCH-64bit.tar.7z"
mv "WS9Wine$WINE_VER-$WINE_BRANCH-64bit.tar.7z" ~/Library/Application\ Support/Wineskin/Engines/

rm -rdf wswine.bundle
rm portable-winehq-*-osx64.tar.gz
@l3laze
Copy link

l3laze commented Jul 25, 2017

When is the last time you tried this?

Just gave it a shot yesterday on OS X 10.11.6 and it fails completely with the usual "compiler can't create executables" issue, just like every other set of directions for building a Wineskin engine from Wine source does for me =\

Edit: And of course now that I said something after so many failed attempts it's finally starting to work (building now, though of course that may fail).

Another edit: Part of my failure was because I didn't copy your ./configure arguments (CC=clang CXX=clang++ CFLAGS=-std=gnu89 --without-x --without-xml --disable-option-checking --without-oss --without-cms --disable-tests --without-v4l --without-alsa --without-audioio --without-capi --with-coreaudio --without-esd --without-hal --without-jack --with-xcomposite --with-xcursor --with-xinerama --with-xinput --with-xrandr --with-xrender --with-xshape --with-xshm --with-xslt --with-xxf86vm --without-fontconfig --without-gphoto --without-gstreamer --without-dbus) and instead tried to use the Wineskin defaults. I noticed the CFLAGS=-std=gnu89 yesterday when I was trying to figure this out, but didn't try it personally and until I saw it again in your args I thought that it was wrong. Lol.

One more edit: It compiled, and it even showed up in my Engines list, but nothing works. Can't install anything, can't run RegEdit, Uninstaller, Task Manager, or anything else. I'm guessing it's something wrong on my end, but I just don't have the ability to care any more right now.

Last edit: Wine 2.02 Stable compiled and so far is working as expected (Steam is installing fine, will try a game shortly). Thank you; sorry for the earlier doubt.

@l3laze
Copy link

l3laze commented Apr 22, 2018

No longer working as of April 22nd, 2018. homebrew/dupes has been moved to homebrew/homebrew-core, and apple-gcc42 will not install on version of Mac OS newer than Mavericks "due to an upstream incompatibility."

@publicarray
Copy link
Author

@l3laze Thanks for letting me know. 👍 As a workaround you can still symlink gcc. It's not used but for some reason this path is hard-coded in the WineskinEngineBuild. If you are worried you can just remove the symlink once done.

@publicarray
Copy link
Author

publicarray commented May 1, 2018

Here is another method that does not involve compiling. I haven't tested it though. https://github.com/marnovo/WINE-tools#how-to-build-a-wine-engine-from-a-compiled-tarball

Edit: Added an example:

# wget https://dl.winehq.org/wine-builds/macosx/pool/portable-winehq-staging-3.9-osx64.tar.gz
wget https://dl.winehq.org/wine-builds/macosx/pool/portable-winehq-devel-3.7-osx64.tar.gz
tar xf portable-winehq-devel-3.7-osx64.tar.gz
echo "WS9Wine3.7-64bit" > usr/version
mv usr/ wswine.bundle
tar cf - wswine.bundle | ~/Library/Application\ Support/Wineskin/7za a -si WS9Wine3.7-64bit.tar.7z
mv WS9Wine3.7-64bit.tar.7z ~/Library/Application\ Support/Wineskin/Engines/

@Gcenx
Copy link

Gcenx commented Mar 29, 2019

I wouldn’t bother with the WineskinEngineBuilder anymore even with the workarounds you mention here it won’t compile Wine-4.x.
Homebrew won’t allow that command if your above macOS Sierra.

EngineRepacking is integrated into both Unofficial Wineskin and PortingKit

At precent my project nor PortingKit are proving an updating build system, I’m working on 2 different systems but I don’t consider any of them ready for an end user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment