INSTALL.md
changeset 12751 838515c4e6c5
parent 11862 fbe9bb9602eb
child 12817 b35b6978baa4
equal deleted inserted replaced
12750:6cec6b881a1c 12751:838515c4e6c5
       
     1 Building and installing Hedgewars
       
     2 =================================
       
     3 
       
     4 This file explains to you how to build/compile Hedgewars and how to install it.
       
     5 
       
     6 See also: <https://hedgewars.org/kb/BuildingHedgewars>
       
     7 
       
     8 Dependencies
       
     9 ------------
       
    10 
       
    11 ### Core dependencies
       
    12 
       
    13 To compile and install Hedgewars, you need at least:
       
    14 
       
    15 - A C++ compiler (e.g. GCC)
       
    16 - CMake >= 2.6.0
       
    17 - A make program (e.g. GNU Make)
       
    18 - Free Pascal Compiler (FPC) >= 2.2.4
       
    19 - Qt = 4.7.0
       
    20 - SDL >= 2.0
       
    21 - SDL\_net >= 2.0
       
    22 - SDL\_mixer >= 2.0
       
    23 - SDL\_image >= 2.0
       
    24 - SDL\_ttf >= 2.0
       
    25 
       
    26 ### Optional dependencies
       
    27 
       
    28 For some additional features, you can optionally install these dependencies:
       
    29 
       
    30 - For Hedgewars:
       
    31     - PhysFS >= 2.0.0 (recommended)
       
    32     - Lua = 5.1.0 (recommended)
       
    33 - For PNG screenshots:
       
    34     - libpng >= 1.2 (recommended)
       
    35 - For video recording:
       
    36     - FFmpeg or Libav
       
    37 - For the Hedgewars Server:
       
    38     - GHC >= 6.10
       
    39     - Various Haskell packages (see below)
       
    40 
       
    41 PhysFS will be internally built if `-DPHYSFS_SYSTEM=OFF` is passed to `cmake`
       
    42 (also allows to set `PHYSFS_LIBRARY` and `PHYSFS_INCLUDE_DIR` if needed).
       
    43 
       
    44 Lua will be automatically built if not found.
       
    45 
       
    46 ### Hedgewars Server dependencies
       
    47 
       
    48 The Hedgewars Server is an **optional** separate application.
       
    49 It provides the online lobby and allows players to create rooms.
       
    50 You will also be able to launch the server from the frontend
       
    51 (network play → local network → start server).
       
    52 
       
    53 **Most players do not need this!**
       
    54 
       
    55 To compile it, you need:
       
    56 
       
    57 - Glasgow Haskell Compiler (GHC) >= 6.10
       
    58 - These Haskell packages:
       
    59     - `containers`
       
    60     - `vector`
       
    61     - `bytestring`
       
    62     - `network` >= 2.3
       
    63     - `random`
       
    64     - `time`
       
    65     - `mtl` >= 2
       
    66     - `sandi`
       
    67     - `hslogger`
       
    68     - `process`
       
    69     - `deepseq`
       
    70     - `utf8-string`
       
    71     - `SHA`
       
    72     - `entropy`
       
    73     - `zlib` >= 0.5.3 and < 0.6
       
    74     - `regex-tdfa`
       
    75 
       
    76 
       
    77 Building
       
    78 --------
       
    79 
       
    80 ### Summary
       
    81 
       
    82 To build and install Hedgewars, obtain all dependencies, then run:
       
    83 
       
    84    $ cmake .
       
    85    $ make
       
    86    # make install
       
    87 
       
    88 ### Step 1: Configure
       
    89 
       
    90 For a default install with all dependencis, use this command:
       
    91 
       
    92     $ cmake .
       
    93 
       
    94 To build with a custom install directory, instead run:
       
    95 
       
    96     $ cmake -DCMAKE_INSTALL_PREFIX="<install_prefix>" .
       
    97 
       
    98 (Replace `<install_prefix>` with the directoy in which you
       
    99 want Hedgewars to be installed.)
       
   100 
       
   101 Add the `-DNOSERVER=ON` switch if you do not want to build
       
   102 the server.
       
   103 
       
   104 #### CMake options
       
   105 
       
   106 For more detailed build settings, change some CMake options.
       
   107 Run `ccmake` for an interactive way to edit them.
       
   108 
       
   109 Important CMake options:
       
   110 
       
   111 - `CMAKE_INSTALL_PREFIX`: Installation directory
       
   112 - `NOSERVER`: Set to `ON` to *not* build the server
       
   113 - `NOVIDEOREC`: Set to `ON` to *not* build the video recorder
       
   114 - `SYSTEM_PHYSFS`: Set to `OFF` to use Hedgewars-bundled PhysFS
       
   115 
       
   116 ### Step 2: Make
       
   117 
       
   118 Run:
       
   119 
       
   120     $ make
       
   121 
       
   122 This creates the following files:
       
   123 
       
   124 - `bin/hedgewars`: Hedgewars
       
   125 - `bin/hwengine`: Game engine, can be used to play demos and saved games
       
   126 - `bin/hedgewars-server`: Hedgewars Server (optional)
       
   127 
       
   128 ### Step 3: Installation
       
   129 
       
   130 To install Hedgewars to the install directory run:
       
   131 
       
   132     # make install
       
   133 
       
   134 That's all! Enjoy!
       
   135 
       
   136 Troubleshooting
       
   137 ---------------
       
   138 
       
   139 ### Qt is installed but it can't be found
       
   140 
       
   141 If this happens, set the following CMake option:
       
   142 
       
   143     QT_QMAKE_EXECUTABLE="<path_to_qmake>"
       
   144 
       
   145 (Replace `<path_to_qmake>` with the path to the `qmake` application.)
       
   146 
       
   147 If this didn't work, make sure you have the correct Qt version
       
   148 (see above).
       
   149 
       
   150 ### Hedgewars compiles successfully, but games instantly crash the map preview fails
       
   151 
       
   152 This is likely to be a problem with PhysFS. Try to build Hedgewars
       
   153 with the Hedgewars-bundled PhysFS by setting the CMake option
       
   154 `SYSTEM_PHYSFS=OFF`, then try to run `make` again.
       
   155 
       
   156 If the _bundled_ PhysFS fails, too, this is likely to be a bug in
       
   157 Hedgewars, please report at <https://issues.hedgewars.org/>.
       
   158 
       
   159 ### Broken/missing Haskell dependencies
       
   160 
       
   161 First, try to obtain the missing Haskell packages and make sure GHC
       
   162 is up-to date, then try again. Read the error messages carefully
       
   163 to figure out missing package names.
       
   164 
       
   165 If everything fails and you don't need the server, set the CMake
       
   166 option `NOSERVER=ON` so the server isn't built at all.
       
   167 
       
   168 ### Error messages related to libavcodec / libavformat
       
   169 
       
   170 Update Libav or FFmpeg (whatever is present on your system) to
       
   171 the latest version or install one of them if you haven't already.
       
   172 Then try to build again.
       
   173 
       
   174 If this still doesn't work and you give up, set the CMake option
       
   175 `NOVIDEOREC=ON`, but then the video recording functionality will
       
   176 not be available.
       
   177 
       
   178 ### Cleaning up
       
   179 
       
   180 In case you want to start over and start with a clean build,
       
   181 run `make clean`, then go back to step 2.
       
   182 
       
   183 If things got seriously out of hand, you may want to reset
       
   184 *everything* (even your configuration). If you use the
       
   185 Mercural repository, you can run `hg purge --all`. Proceed with
       
   186 step 1.
       
   187 
       
   188 ### Still can't build Hedgewars?
       
   189 
       
   190 Visit us in the forums or IRC (see `README.md`) and ask for help.