author | sheepluva |
Thu, 23 Mar 2023 20:47:32 +0000 | |
changeset 2221 | 4bf8172a73a1 |
parent 1978 | 8aa416c2647a |
permissions | -rw-r--r-- |
1963 | 1 |
#summary Instructions for building Hedgewars on macOS |
117 | 2 |
#labels Phase-Implementation,Phase-Deploy,Phase-Support |
25
4f6f055c0848
Created wiki page through web user interface.
vittorio.giovara@gmail.com
parents:
diff
changeset
|
3 |
|
1963 | 4 |
= Building on macOS = |
1975 | 5 |
Also known as OS X or Mac OS X. |
6 |
||
7 |
*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. |
|
1497 | 8 |
|
755 | 9 |
== Prerequisites == |
25
4f6f055c0848
Created wiki page through web user interface.
vittorio.giovara@gmail.com
parents:
diff
changeset
|
10 |
|
1975 | 11 |
=== Required Build Dependencies === |
12 |
||
1976 | 13 |
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. |
1975 | 14 |
|
15 |
Unless otherwise specified, latest versions of the following dependencies can be used. |
|
16 |
||
17 |
==== Compilers and Environment ==== |
|
18 |
||
1977 | 19 |
* Xcode command-line tools |
20 |
* CMake 3.9 or later |
|
21 |
* fpc 2.6.x OR fpc 3.1.1+ (nothing in between, due a crashing bug) |
|
1975 | 22 |
|
23 |
==== Libraries ==== |
|
24 |
||
1976 | 25 |
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`. |
1975 | 26 |
|
1977 | 27 |
* Qt 5.9.x or later (unified installer works) |
28 |
* SDL2 |
|
29 |
* SDL2_image (2.0.4 works, 2.0.5 might be buggy) |
|
30 |
* SDL2_mixer |
|
31 |
* SDL2_net |
|
32 |
* SDL2_ttf |
|
33 |
* Ogg |
|
34 |
* Vorbis |
|
35 |
* libpng 1.6.x |
|
36 |
* physfs 3.0.x |
|
1975 | 37 |
|
38 |
||
39 |
==== Notes ==== |
|
1977 | 40 |
|
41 |
# Other dependencies are linked with the SDL2 libraries, but not specifically used in Hedgewars. They may include: |
|
1978 | 42 |
* !FreeType |
1975 | 43 |
* FLAC |
44 |
* Opus |
|
45 |
* GLEW |
|
46 |
* modplug |
|
47 |
* mpg123 |
|
48 |
* webp |
|
1977 | 49 |
# 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` |
1978 | 50 |
# Another good place for the frameworks/libraries are in the `Hedgewars.app` of a previous version (E.g. Hedgewars 1.0.0 Beta 2) |
1975 | 51 |
|
52 |
=== Optional Dependencies === |
|
53 |
||
1978 | 54 |
By default, the following optional features are turned on in the build system, and require the following dependencies: |
1975 | 55 |
|
1977 | 56 |
* Video recording |
57 |
* ffmpeg 4.2 (later versions are untested) |
|
58 |
* yasm 1.3+ |
|
59 |
* Automatic updates |
|
60 |
* Sparkle |
|
61 |
* hedgewar-server |
|
62 |
* ghc, cabal (Haskell) |
|
63 |
* xz |
|
1975 | 64 |
|
65 |
==== Haskell Installation ==== |
|
66 |
||
67 |
Steps to get the Haskell environment set up for compiling hedgewars-server: |
|
68 |
||
1977 | 69 |
# Install ghc, cabal with instructions at https://www.haskell.org/ghcup/ |
70 |
# Load ghc environment: `source ~/.ghcup/env` |
|
71 |
# Install cabal-uninstall: `cabal install cabal-uninstall` |
|
72 |
# 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` |
|
1975 | 73 |
|
74 |
`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) |
|
75 |
||
76 |
||
77 |
== Building Hedgewars == |
|
78 |
||
79 |
=== Environment Setup === |
|
80 |
||
1977 | 81 |
* Set macOS version to target for Xcode tools. The earlier, the better: |
1975 | 82 |
{{{ |
83 |
export MACOSX_DEPLOYMENT_TARGET=10.8 |
|
84 |
}}} |
|
1977 | 85 |
* (Optional) Load haskell environment: |
1975 | 86 |
{{{ |
87 |
source ~/.ghcup/env |
|
88 |
}}} |
|
1978 | 89 |
* Create (`mkdir`) a `build` subdirectory in the Hedgewars source code |
1975 | 90 |
|
91 |
||
92 |
=== Build === |
|
93 |
||
94 |
CMake is used to manage the build process, and is run with different flags depending on which optional dependencies you have elected to install. |
|
95 |
||
1976 | 96 |
Take note of where Qt is installed; it is a required build flag (see below). |
1975 | 97 |
|
98 |
Steps to build: |
|
99 |
||
1977 | 100 |
# `cd /path/to/hg/hedgewars/build` |
101 |
# `cmake .. -DCMAKE_PREFIX_PATH=/Users/user/Qt/5.9.8/clang_64/ -DCMAKE_BUILD_TYPE=Release` |
|
102 |
# `make -j2` |
|
103 |
# `make install` |
|
1975 | 104 |
|
1976 | 105 |
A `Hedgewars.app` file will be created in the same folder you ran CMake. |
1975 | 106 |
|
107 |
To build the DMG, also run: |
|
108 |
||
1977 | 109 |
* `make dmg` |
25
4f6f055c0848
Created wiki page through web user interface.
vittorio.giovara@gmail.com
parents:
diff
changeset
|
110 |
|
755 | 111 |
==== Notes ==== |
116
1c3643e4f6c5
Edited wiki page BuildingOnMac through web user interface.
vittorio.giovara@gmail.com
parents:
113
diff
changeset
|
112 |
|
1977 | 113 |
* To build a debug build, use the flag `-DCMAKE_BUILD_TYPE=Debug` instead of the `Release` one |
114 |
* 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. |
|
1978 | 115 |
* 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. |
25
4f6f055c0848
Created wiki page through web user interface.
vittorio.giovara@gmail.com
parents:
diff
changeset
|
116 |
|
1963 | 117 |
Enjoy! |