Difference between revisions of "MG/Linux Compiling"

From MegaGlest
Jump to navigation Jump to search
(7 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
=='''Recommended way:''' Scripted build ==
 
=='''Recommended way:''' Scripted build ==
  
*Change into the top level ''project'' directory. This is wherever you checked the repository out to (<tt>svn co ...</tt>), such as <tt>megaglest/</tt> or <tt>trunk/</tt>.
+
*Change into the top level ''project'' directory. This is wherever you checked the repository out to (<tt>git clone ...</tt>), probably <tt>megaglest-source/</tt>.
*Install / update the build dependencies: <pre>sudo mk/linux/setupBuildDeps.sh</pre>If your Linux distribution is not supported or you prefer to install dependencies manually, check below.
+
*You should have a <tt>mk/linux/</tt> subdirectory there, change into this: <pre>cd mk/linux</pre>
 +
*Install / update the build dependencies: <pre>sudo ./setupBuildDeps.sh</pre>If your Linux distribution is not supported or you prefer to install dependencies manually, check below.
 
*Start the build: <pre>./build-mg.sh</pre>
 
*Start the build: <pre>./build-mg.sh</pre>
*To start MegaGlest do: <pre>cd mk/linux</pre> <pre>./megaglest</pre>
+
*To start MegaGlest do: <pre>./megaglest</pre>
  
 
==Requirements==
 
==Requirements==
*[[MG/Getting The Code|Download the project]] from the [[MG/SVN Structure|SVN]] using the command line or your favorite SVN tool (such as [http://www.rabbitvcs.org/ RabbitVCS] or [http://tortoisesvn.tigris.org/ TortoiseSVN]).
+
*[[MG/Getting The Code|Download the project]] from the [[MG/Project Structure|GIT]] repository using the command line or your favorite GIT tool (such as [http://www.rabbitvcs.org/ RabbitVCS] or [https://code.google.com/p/tortoisegit/ TortoiseGIT]).
 
*Download package dependencies for your Linux distribution (see '''<tt>mk/linux/setupBuildDeps.sh</tt> which can do that for Debian, Ubuntu, Fedora and Open SuSE based distro's'''). The following is the current dependency list (and the tools require wx):
 
*Download package dependencies for your Linux distribution (see '''<tt>mk/linux/setupBuildDeps.sh</tt> which can do that for Debian, Ubuntu, Fedora and Open SuSE based distro's'''). The following is the current dependency list (and the tools require wx):
 
**jpeg
 
**jpeg
Line 18: Line 19:
 
**SDLmain
 
**SDLmain
 
**curl
 
**curl
**xerces-c
 
 
**openal
 
**openal
 
**ogg
 
**ogg
Line 42: Line 42:
 
==Building using CMake by Hand==
 
==Building using CMake by Hand==
 
*Open a terminal window and navigate to '''trunk (or the specified branch)''' and type the following:
 
*Open a terminal window and navigate to '''trunk (or the specified branch)''' and type the following:
 +
cd mk/linux
 
  mkdir build
 
  mkdir build
 
  cd build
 
  cd build
  cmake ..
+
  cmake ../../..
 
  make
 
  make
 
*If nothing goes wrong you will see <tt>megaglest</tt> (and other binaries) in the same folder (<tt>mk/linux</tt>).
 
*If nothing goes wrong you will see <tt>megaglest</tt> (and other binaries) in the same folder (<tt>mk/linux</tt>).
 
*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:
 
*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:
 +
cd mk/linux
 
  mkdir build
 
  mkdir build
 
  cd build
 
  cd build
  cmake -DCMAKE_INSTALL_PREFIX= ..
+
  cmake -DCMAKE_INSTALL_PREFIX= ../../..
 
  make
 
  make
  
Line 78: Line 80:
 
  -DMINIUPNPC_VERSION_PRE1_6=Off
 
  -DMINIUPNPC_VERSION_PRE1_6=Off
 
  -DMINIUPNPC_VERSION_PRE1_5=Off
 
  -DMINIUPNPC_VERSION_PRE1_5=Off
  -DWANT_STREFLOP=On
+
  -DWANT_STREFLOP=Off
 
  -DUSE_FTGL=On
 
  -DUSE_FTGL=On
  -DWANT_SVN_STAMP=On
+
  -DWANT_GIT_STAMP=On
 
  -DCMAKE_INSTALL_PREFIX=
 
  -DCMAKE_INSTALL_PREFIX=
 
  -DMEGAGLEST_BIN_INSTALL_PATH=
 
  -DMEGAGLEST_BIN_INSTALL_PATH=
Line 97: Line 99:
 
*Modify the script. You also need to change <tt>win32_deps/curl-7.20.1</tt> to <tt>win32_deps/curl-7.21.3</tt>
 
*Modify the script. You also need to change <tt>win32_deps/curl-7.20.1</tt> to <tt>win32_deps/curl-7.21.3</tt>
 
*Run the script:
 
*Run the script:
 +
cd mk/linux
 
  ./build-mg-win.sh
 
  ./build-mg-win.sh
 
*If all goes well you should see the Windows <tt>.exe</tt> binaries produced in the <tt>data/glest_game</tt> folder.
 
*If all goes well you should see the Windows <tt>.exe</tt> binaries produced in the <tt>data/glest_game</tt> folder.

Revision as of 15:50, 26 January 2014

This page explains how to compile MegaGlest on linux platforms.


Recommended way: Scripted build

  • Change into the top level project directory. This is wherever you checked the repository out to (git clone ...), probably megaglest-source/.
  • You should have a mk/linux/ subdirectory there, change into this:
    cd mk/linux
  • Install / update the build dependencies:
    sudo ./setupBuildDeps.sh
    If your Linux distribution is not supported or you prefer to install dependencies manually, check below.
  • Start the build:
    ./build-mg.sh
  • To start MegaGlest do:
    ./megaglest

Requirements

  • Download the project from the GIT repository using the command line or your favorite GIT tool (such as RabbitVCS or TortoiseGIT).
  • Download package dependencies for your Linux distribution (see mk/linux/setupBuildDeps.sh which can do that for Debian, Ubuntu, Fedora and Open SuSE based distro's). The following is the current dependency list (and the tools require wx):
    • jpeg
    • png
    • lua5.1
    • SDL
    • SDLmain
    • curl
    • openal
    • ogg
    • vorbis
    • vorbisfile
    • vorbisenc
    • alut
    • z
    • GL
    • GLU
    • glew-dev
    • ircclient
    • ftgl-dev
    • miniupnpc-dev
    • fribidi-dev
  • Additionally for Game Tools:
    • wxbase2.8
    • wxgtk2.8
    • gtk2.0-dev
    • xml2-dev

Building using CMake by Hand

  • Open a terminal window and navigate to trunk (or the specified branch) and type the following:
cd mk/linux
mkdir build
cd build
cmake ../../..
make
  • 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:
cd mk/linux
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX= ../../..
make

Notice a space between the parameter -DCMAKE_INSTALL_PREFIX and ..

Notes: The follow are build types supported using cmake:

  • Release
  • Debug
  • RelWithDebInfo
  • MinSizeRel

To change the build type execute cmake (default is Release) using:

cmake -D CMAKE_BUILD_TYPE=<...>

e.g.

cmake -D CMAKE_BUILD_TYPE=Debug

Other special CMake options for customized builds:

-DBUILD_MEGAGLEST=On
-DBUILD_MEGAGLEST_CONFIGURATOR=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 using MingW:

  • 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:
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
  • Open a terminal and cd to the root folder of your Mega-Glest folder (usually trunk).
  • Modify the script. You also need to change win32_deps/curl-7.20.1 to win32_deps/curl-7.21.3
  • Run the script:
cd mk/linux
./build-mg-win.sh
  • If all goes well you should see the Windows .exe binaries produced in the data/glest_game folder.

Test binaries

To test running the game, run the binary in mk/linux like this:

./megaglest

These are some commandline options:

./megaglest --help
./megaglest --version
./megaglest --opengl-info

See Also