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
@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