# HG changeset patch # User raptor # Date 1568762935 -7200 # Node ID 05c417d4d891451b1ae7eb910e36ca878bf7cb7b # Parent 3a573bba359e5b63385420579596c9446330dce5 Update macOS building instructions diff -r 3a573bba359e -r 05c417d4d891 BuildingOnMac.wiki --- a/BuildingOnMac.wiki Mon Sep 16 16:49:13 2019 +0100 +++ b/BuildingOnMac.wiki Wed Sep 18 01:28:55 2019 +0200 @@ -2,74 +2,115 @@ #labels Phase-Implementation,Phase-Deploy,Phase-Support = Building on macOS = -**Note: These instructions are OUTDATED!** +Also known as OS X or Mac OS X. + +*Note:* These instructions were run on OS X 10.11 and backwards compiled for OS X 10.8 (Aug 2019). Newer versions will likely work but may require some adaptation. == Prerequisites == - * XCode must be installed with command line tools - * some knowledge of Terminal is preferred +=== Required Build Dependencies === + +Homebrew (https://brew.sh/) can be used to gather many of these dependencies, but is not required. All can be found as installers, frameworks, or built manually without Homebrew. + +Unless otherwise specified, latest versions of the following dependencies can be used. + +==== Compilers and Environment ==== + + * Xcode command line tools + * CMake 3.9 or later + * fpc 2.6.x OR fpc 3.1.1+ (nothing in between, due a crashing bug) + +==== Libraries ==== + +Libraries can be dynamically linked libraries (.dylib) or Apple frameworks (.framework). All must be on the system library or framework paths for CMake to find them. Frameworks can be put in your home directory at `~/Library/Frameworks` + + * Qt 5.9.x or later (unified installer works) + * SDL2 + * SDL2_image (2.0.4 works, 2.0.5 might be buggy) + * SDL2_mixer + * SDL2_net + * SDL2_ttf + * Ogg + * Vorbis + * libpng 1.6.x + * physfs 3.0.x + + +==== Notes ==== +# Other dependencies are linked with the SDL2 libraries, but not specifically used in Hedgewars. They may include: + * FreeType + * FLAC + * Opus + * GLEW + * modplug + * mpg123 + * webp +# Good places to find required frameworks are found in the development packages for the various SDL2 libraries. They are found in the `Frameworks` subdirectory within the .framework itself. Example: `SDL2_ttf.framework/Frameworks/FreeType.framework` +# Another good place for the frameworks/libraries are in the Hedgewars.app of a previous version (E.g. Hedgewars 1.0.0 Beta 2) + +=== Optional Dependencies === + +By default, the following optional features are turned on in the build system, and require the following dependencies. + + * Video recording + * ffmpeg 4.2 (later versions are untested) + * yasm 1.3+ + * Automatic updates + * Sparkle + * hedgewar-server + * ghc, cabal (Haskell) + * xz + +==== Haskell Installation ==== + +Steps to get the Haskell environment set up for compiling hedgewars-server: + +# Install ghc, cabal with instructions at https://www.haskell.org/ghcup/ +# Load ghc environment: `source ~/.ghcup/env` +# Install cabal-uninstall: `cabal install cabal-uninstall` +# Install haskell packages: `cabal install vector bytestring 'network < 2.7' time mtl sandi 'hslogger < 1.3' process utf8-string SHA entropy zlib random regex-tdfa deepseq` + +`cabal-uninstall` is for when you accidentally install newer package versions that don't work with hedgewars-server (e.g. hslogger-1.3.0.0) + + +== Building Hedgewars == + +=== Environment Setup === + + * Set macOS version to target for Xcode tools. The earlier the better: +{{{ +export MACOSX_DEPLOYMENT_TARGET=10.8 +}}} + * (Optional) Load haskell environment: +{{{ +source ~/.ghcup/env +}}} + * Create (mkdir) a `build` subdirectory in the hedgewars source code + + +=== Build === + +CMake is used to manage the build process, and is run with different flags depending on which optional dependencies you have elected to install. + +Take note of where QT is installed; it is a required build flag (see below). + +Steps to build: + +# `cd /path/to/hg/hedgewars/build` +# `cmake .. -DCMAKE_PREFIX_PATH=/Users/user/Qt/5.9.8/clang_64/ -DCMAKE_BUILD_TYPE=Release` +# `make -j2` +# `make install` + +A Hedgewars.app file will be created in the same folder you ran CMake. + +To build the DMG, also run: + +# `make dmg` ==== 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` +# To build a debug build, use the flag `-DCMAKE_BUILD_TYPE=Debug` instead of the `Release` one +# To build a minimum-features build, use the additional flags of `-DNOSERVER=1`, `-DNOVIDEOREC=1`, and `-DNOAUTOUPDATE=1`, for disabling of hedgewars-server, video recording, and Sparkle autoupdating, respectively. +# The build uses CMake BundleUtilities which automatically deploys all libraries and dependencies into the .app, and repairs the RPATH of each library and binary as needed. If there is a missing dependency, the `make install` portion of the build will fail. The fix is usually to find the correct .framework and put in on library path, then run `make dmg` again. Enjoy!