MG/Linux Compiling

This page explains how to compile MegaGlest on Linux platforms.

Requirements
cd mk/linux sudo ./setupBuildDeps.sh to install them. If your distribution is not supported or you prefer to install yourself: This is the current dependency list - where packages are available, the package names may start with lib and usually have -dev(el) towards the end:
 * Download the project from the GIT repository using the command line (recommended) or your favorite GIT tool (such as RabbitVCS or TortoiseGIT).
 * Install build dependencies. These are usally packaged by Linux distributions. On Debian, Ubuntu, Fedora, Opensuse and even more Linux distributions you may use

gcc gcc-c++ cmake SDL alut GL GLU vorbis x11 lua jpeg png curl ircclient glew ftgl fribidi cppunit vlc miniupnpc

Additionally for map editor and model viewer:

wxgtk xml2

Compilation

 * Update the branch you are working in with the latest GIT code

Scripted build
(Recommended way) cd mk/linux ./build-mg.sh ./megaglest
 * Start the build:
 * To start MegaGlest:

Building using CMake by Hand
cd mk/linux mkdir build cd build cmake ../../.. make cd mk/linux mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX= ../../.. make
 * Open a terminal window and navigate to the specified branch and type the following:
 * If nothing goes wrong you will see megaglest (and other binaries) in the same folder (mk/linux).
 * NOTE: most developer that are not planning to run megaglest from the standard linux LHS paths (like usr/local/bin) should run cmake with the following syntax so that the resulting binaries look in the local compiled folders for data files:

Notice a space between the parameter -DCMAKE_INSTALL_PREFIX and ..

Notes: The follow are build types supported using cmake:
 * None
 * Release
 * Debug
 * RelWithDebInfo
 * MinSizeRel

To change the build type execute cmake (default is Release) using, e.g.: cmake -D CMAKE_BUILD_TYPE=Debug

Other special CMake options for customized builds: -DBUILD_MEGAGLEST=On -DBUILD_MEGAGLEST_MAP_EDITOR=On -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=On -DBUILD_MEGAGLEST_MODEL_VIEWER=On -DWANT_STATIC_LIBS=On -DMINIUPNPC_VERSION_PRE1_6=Off -DMINIUPNPC_VERSION_PRE1_5=Off -DWANT_STREFLOP=Off -DUSE_FTGL=On -DWANT_GIT_STAMP=On -DCMAKE_INSTALL_PREFIX= -DMEGAGLEST_BIN_INSTALL_PATH= -DMEGAGLEST_DATA_INSTALL_PATH= -DMEGAGLEST_DESKTOP_INSTALL_PATH= -DMEGAGLEST_ICON_INSTALL_PATH= -DMEGAGLEST_MANPAGE_INSTALL_PATH= -DCUSTOM_DATA_INSTALL_PATH=

Cross Compiling Windows binaries on Linux
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime cd mk/linux ./build-mg-win.sh
 * This process is still experimental and is not fully supported at the moment but rather for educational purposes.
 * Download and extract the MingW win32 dependency archive from Sourceforge and extract into the source folder.
 * Install the MingW cross compiler for your distro. In Ubuntu run:
 * Open a terminal and cd to the root folder of your Mega-Glest folder.
 * Modify the script. You also need to change windows_deps/curl-7.20.1 to windows_deps/curl-7.21.3
 * Run the script:
 * If all goes well you should see the Windows .exe</tt> binaries produced in the data/glest_game</tt> folder.

Test binaries
To test running the game, run the binary in mk/linux</tt> like this: ./megaglest

These are some commandline options: ./megaglest --help ./megaglest --version ./megaglest --opengl-info

Trouble shooting
If your build fails, and you have not been building for a while, this is usually due to outdated build dependencies and in this case you should do: cd mk/linux sudo ./setupBuildDeps.sh If MegaGlest crashes you should do a full rebuild. To trigger a full rebuild you should just remove the build</tt> directory before the build, e.g. by run: cd mk/linux && rm -r build && ./build-mg.sh

Reporting bugs
If you think you have run into a bug in MegaGlest, and neither reading the README and FAQ nor searching for it at http://bugs.megaglest.org helps, then please report a new bug at http://bugs.megaglest.org/ (one-time registration is necessary to post). When filing a bug, please provide a log of the build process of a full rebuild.