Difference between revisions of "Cross-compile Wine for OSX on Linux"

From PlayOnLinux
Jump to: navigation, search
(Prerequisite)
(Tag: visualeditor)
 
Line 77: Line 77:
 
</pre>
 
</pre>
  
[[Catégorie:Winebuild]]
+
[[Category:Winebuild]]

Latest revision as of 14:02, 6 June 2015

This article is a memo. It explains how OSX binaries are currently built.

Prerequisite

  • Install a darwin compatible toolchain
  • Install MacOS X SDK (You must own a Mac compatible computer to get those files).
  • The building machine should be able to build Wine for linux i386. You may need to install wine build dependencies.

.deb can be found here: https://launchpad.net/~flosoft/+archive/ubuntu/cross-apple/

Additional components needed

You may need to install the following librairies:

  • libjpeg
  • libpng15

Prepare compilation environement

Get wine source from git

To cross compile wine, you need two differents work directories. One will be use to build the compilation tools, the other one will be used to build wine for OSX.

git clone git://source.winehq.org/git/wine.git ~/wine-tools
git clone git://source.winehq.org/git/wine.git ~/wine-git

Patch the code

Apply this patch to both source trees. It will allow to pass -isysrootfile and -iframeworkfile arguments to winegcc

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index fe0f033..03cc131 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1240,11 +1240,11 @@ static int is_target_arg(const char* arg)
 
 /*
  *      Directory Options
- *          -Bprefix  -Idir  -I-  -Ldir  -specs=file
+ *          -Bprefix  -Idir  -I-  -Ldir  -specs=file, -isysrootfile, -iframeworkfile
  */
 static int is_directory_arg(const char* arg)
 {
-    return arg[1] == 'B' || arg[1] == 'L' || arg[1] == 'I' || strncmp("-specs=", arg, 7) == 0;
+    return arg[1] == 'B' || arg[1] == 'L' || arg[1] == 'I' || strncmp("-specs=", arg, 7) == 0 || strncmp("-isysroot", arg, 8) == 0 || strncmp("-iframework", arg, 11) == 0;
 }
 
 /*

Build tools

Go to ~/wine-tools directory and compile the tools:

cd $HOME/wine-tools

./configure

make __tooldeps__

Cross compile wine

Set your environement

You need to set environement vars to use the good compiler. We are going to use Mac OS 10.6 framework to ensure compatibility with older Macs.

export FRAMEWORK="10.6"
export PATH="/usr/i686-apple-darwin10/bin/:$PATH"
export CC="i686-apple-darwin10-gcc"
export CFLAGS="-O3 -pipe -fno-strict-aliasing -fomit-frame-pointer -ffunction-sections -fdata-sections -maccumulate-outgoing-args -mno-push-args -freorder-blocks-and-partition"
export LDFLAGS="-m32 -mmacosx-version-min=$FRAMEWORK -isysroot/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk -iframework/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk -F/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/System/Library/Frameworks -F/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/Library/Frameworks/OpenCL.framework/ -L/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/lib -L/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/lib/system  -I/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/ -L/usr/i686-apple-darwin10/local/lib -I/usr/i686-apple-darwin10/local/include -I/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/X11/include/ -L/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/X11/lib/ -I/usr/include/freetype2 -I/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/include/ -I/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/include/libxml2 -L/usr/lib/apple/SDKs/MacOSX$FRAMEWORK.sdk/usr/lib/"
export CPPFLAGS="$LDFLAGS"
export WINE_TOOLS="~/wine-tools"

Build wine

Now, you can build wine:

cd $HOME/wine-git
./configure --prefix=/ --host=i686-apple-darwin10 --with-wine-tools=$WINE_TOOLS
make
make install DESTDIR="/install/destination"