BuildingOnMac.wiki
author Wuzzy
Wed, 11 Jul 2018 13:39:34 +0100
changeset 1443 d25ab95f2311
parent 1080 01583db406ff
child 1497 7a5b840a3dd4
permissions -rw-r--r--
LuaAPI: deprecate lfCurrentHog

#summary Instructions for building Hedgewars on Mac OS X
#labels Phase-Implementation,Phase-Deploy,Phase-Support

= Building on Mac OS X =
== Prerequisites ==

  * XCode must be installed with command line tools
  * some knowledge of Terminal is preferred

==== Notes ====

   # it has been reported that Xcode 3.2.6 creates problem when linking frameworks! If you can't use another version, try this: https://discussions.apple.com/thread/2781968?threadID=2781968&tstart=105
   # for Xcode 4 onwards, you need to install the command line tools: open Xcode, go to Preferences, select "Downloads" and install the "Command Line Tools".
   # for Qt series 4.7, only versions 4.7.0 and 4.7.4 are not suffering from this bug http://bugreports.qt.nokia.com/browse/QTBUG-17333 any other version will not work with online games.
   # Lion has an incompatible ABI with older version of Freepascal! Use only the new Freepascal version 2.6.0 or newer. See http://bugs.freepascal.org/view.php?id=19269

=== Necessary libraries ===

Download the following libraries and place them under `/Library/Frameworks/`

  * SDL - http://www.libsdl.org/release/
  * SDL_image - http://www.libsdl.org/projects/SDL_image/release/
  * SDL_mixer - http://www.libsdl.org/projects/SDL_mixer/release/
  * SDL_net - http://www.libsdl.org/projects/SDL_net/release/
  * SDL_ttf - http://www.libsdl.org/projects/SDL_ttf/release/
  * Ogg sources - http://downloads.xiph.org/releases/ogg/
  * Vorbis sources - http://downloads.xiph.org/releases/vorbis/

See [Dependencies] for the required versions.

=== Optional libraries ===

The following libraries are optional:
 * Sparkle (auto-updater) - https://github.com/sparkle-project/Sparkle/releases/latest

==== Compiling Ogg Vorbis ====

Since there is no framework distribution for ogg vorbis libraries, we will need to compile our own. Extract the sources and open the relative .xcodeproj file.

It is likely that you will need to adjust some parameters, such as the Base SDK you have installed and for which architecture (ppc, i386, x86_64) you want to build. Go into "Project"->"Edit Project Settings", under "Build" set Architectures to Standard and Base SDK to 10.5 (otherwise newer).

After that build as usual and copy the generated framework to the usual `/Library/Frameworks/` directory.

==== (Optional) Server ====

If you want to compile server for hosting lan games, you need to download a Haskell compiler: we are going to use the Glasgow Haskell Compiler.

 * Download the Haskell Platform and install both the GHC and Haskell Platform - https://www.haskell.org/downloads#platform
 * Run `cabal update` to get an updated list of available libraries and install the necessary dependencies with
{{{
sudo cabal install gameServer/hedgewars-server.cabal
}}}
  * _(even more optional)_ if you feel experimental, you can also try to use the 64bit variant of Haskell, just make sure that your `~/.cabal/` directory doesn't conflict with previous installations

=== Necessary tools ===

Download and install the following toolchains

 * Freepascal compiler - https://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/
 * CMake - https://cmake.org/download/
 * Qt - https://www1.qt.io/download/
  * Note that for compiling the 64 bit version you need download the `cocoa` version of Qt

== Building process ==

  * Download the source tarball or clone the Mercurial repo
  * Configure the sources with the following line
{{{
cmake . -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DCMAKE_BUILD_TYPE=Release
}}}
  * Run `make` and `make install`

Enjoy!