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