Cross building Commander Genius for MacOS using a Linux System
This is for people who don’t own a Mac or just want to automate a build without relying on such system, because you know…
Having a Linux build server for different build releases is much better. That also means, that the builds are compiled and linked, but not tested. Someone with a Mac system will have to do that.
Requirements
First ensure you have the following installed on your system:
Clang 3.4+
, cmake
, git
, patch
, Python
, libssl-devel
(openssl)lzma-devel
, libxml2-devel
, the bash shell
wget
and openssl
.
Secondly clone the osxcross repository:
git clone https://github.com/tpoechtrager/osxcross.git
Last but not least patience. 🙂
Simple approach
cd osxcross
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
mv MacOSX10.10.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
If all went fine, we are going add this to the path variable
export PATH=${PATH}:${HOME}/osxcross/target/bin
or similar. You might want to add this to your .bashrc so the compiler are always detected.
Complex Approach
NOTE: You need an Apple ID for this,
If the simple approach does not work, because the link is broken you might have to
- [Download Xcode: https://developer.apple.com/download/more] **
- [Mount Xcode.dmg (Open With -> DiskImageMounter) ***]
- Run:
./tools/gen_sdk_package.sh
(from the OSXCross package) - Copy the packaged SDK (*.tar.* or *.pkg) on a USB Stick
- (On Linux/BSD) Copy or move the SDK into the tarballs/ directory of OSXCross.
**
— Xcode up to 11 GM is known to work.
— Use Firefox if you have problems signing in.
***
— If you get a dialog with a crossed circle, ignore it.
— You don’t need to install Xcode.
Packing the SDK on Linux:
This method may require up to 25 GB of free disk space.
An SSD is recommended for this method.
- Download Xcode like described in ‚Packaging the SDK on Mac OS X‘
- Install
clang
,make
,libssl-devel
,lzma-devel
andlibxml2-devel
- Run
./tools/gen_sdk_package_pbzx.sh <xcode>.xip
- Copy or move the SDK into the tarballs/ directory
Now it is time to build the toolchain:
UNATTENDED=1 ./build.sh
Macports for other dependencies
Good news, after building the toolchain you already have access to mac ports.
Add another export to your .bashrc:
export MACOSX_DEPLOYMENT_TARGET=10.10
and you are good to go.
Now let’s install what the Commander Genius sources require:
osxcross-macports install libsdl2 libsdl2_mixer libsdl2_image libsdl2_ttf curl lua
That’s gonna take some minutes.
Build Commander Genius
Get the sources
git clone https://gitlab.com/Dringgstein/Commander-Genius.git
and build it:
mkdir CGBuildMac
cd CGBuildMac
export CG_SOURCES=<Your CG-Sources>
export OSXCROSSPATH=${HOME}/workspace/osxcross
export OSXOPT=${OSXCROSSPATH}/target/macports/pkgs/opt
x86_64-apple-darwin14-cmake ${CG_SOURCES} -DOSXCROSS=1 -DUSE_OPENGL=0 -DUSE_BOOST=0 -DSDL2_INCLUDE_DIR=${OSXOPT}/local/include/SDL2 -DSDL2_MIXER_INCLUDE_DIR=${OSXOPT}/local/include/SDL2 -DSDL2_INCLUDE_DIR=${OSXOPT}/local/include/SDL2
make
Now you have a binary called CGeniusExe under src.
Create a bundle for others
Unfortunately I cannot use CPack for this, since it is missing in the toolchain, so I decided to build it manually. I might improve this process later on. The script
bash buildMacOsBundle.sh
will create an app bundle and pack into a DMG for users to download.
Special thanks to the author of osxcross toolchain, tpoechtrager
Neueste Kommentare