Difference between revisions of "MG/Linux Compiling"

From MegaGlest
Jump to navigation Jump to search
(just a little clean up to bring step 5 down to a new line)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Linux Compiling:'''
+
This page explains how to compile [[MegaGlest]] on linux platforms.
  
1. [[MG/Getting The Code|Get the project ]] from [[MG/SVN Structure|SVN]] using the commandline or your favorite SVN tool ([http://www.rabbitvcs.org/ rabbitvcs] or [http://tortoisesvn.tigris.org/ tortoise])<br />
+
==Requirements==
2. Download package dependencies for your Linux distribution (see '''mk/linux/setupBuildDeps.sh''' which can do that for Debian,
+
*[[MG/Getting The Code|Get 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]).
Ubuntu, Fedora and Open SuSE based distro's). The following is the current dependency list:
+
*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
 +
**lua5.1
 +
**png
 +
**SDL
 +
**openal
 +
**curl
 +
**xerces-c
 +
**ogg
 +
**vorbis
 +
**vorbisfile
 +
**vorbisenc
 +
**z
 +
**GL
 +
**GLU
 +
**SDLmain
 +
**ircclient
  
'''jpeg, lua5.1, png, SDL, openal, curl, xerces-c, ogg, vorbis, vorbisfile, vorbisenc, z, GL, GLU, SDLmain, ''''''ircclient'''''' (and the tools require wx)'''
+
==Building using CMake by Script==
 +
*Go to the top level project directory (<tt>megaglest</tt> or trunk or whever you placed the project)
 +
*On linux run <tt>build-mg.sh</tt>
 +
*On windows run <tt>build-mg.bat</tt>
 +
*To compile for windows under linux run <tt>build-mg-win32.sh</tt>
  
<u>'''3.1 Build using CMake by Script'''</u>
+
==Building using CMake by Hand==
 
+
*Open a terminal window and navigate to '''trunk (or the specified branch)''' and type the following:
Go to the directory ''megaglest''.
 
 
 
*On linux run ''build-mg.sh''
 
 
 
*On windows run ''build-mg.bat''
 
 
 
*To compile for windows under linux run ''build-mg-win32.sh''
 
 
 
<u>'''3.2 Build using CMake by Hand'''</u>
 
 
 
a. Open a terminal window and navigate to '''trunk (or the specified branch)''' and type the following:
 
 
  mkdir build
 
  mkdir build
 
  cd build
 
  cd build
 
  cmake ..
 
  cmake ..
 
  make
 
  make
b. If nothing goes wrong you will see '''glest.bin''' (and other binaries) in the same folder ('''mk/linux''').
+
*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:
 +
mkdir build
 +
cd build
 +
cmake -DCMAKE_INSTALL_PREFIX= ..
 +
make
 +
 
 +
Notice a space between the parameter -DCMAKE_INSTALL_PREFIX and ..
 +
 
 
'''Notes:'''
 
'''Notes:'''
 
 
The follow are build types supported using cmake:
 
The follow are build types supported using cmake:
Release, Debug, RelWithDebInfo and MinSizeRel
+
*Release
To change the build type execute cmake as follows (default is Release):
+
*Debug
cmake -D CMAKE_BUILD_TYPE=Debug ..
+
*RelWithDebInfo
<u>'''4. (Optional) Cross Compiling Windows binaries on Linux using MingW:'''</u>
+
*MinSizeRel
 
 
a) Download and extract the MingW win32 dependency archive from [https://sourceforge.net/projects/megaglest/files/win32_deps_mingw.7z/download here] and extract under the '''source''' folder.
 
  
b) Install the MingW cross compiler for your distro. In Ubuntu run:
+
To change the build type execute cmake (default is Release) using:
 +
cmake -D CMAKE_BUILD_TYPE=<...>
  
  '''sudo apt-get install mingw32 mingw32-binutils mingw32-runtime'''
+
e.g.
c) Open a terminal and cd to the root folder of your Mega-Glest folder (usually trunk)
+
  cmake -D CMAKE_BUILD_TYPE=Debug
  
d) Modify the script:
+
Other special CMake options for customized builds:
You also need to change ''win32_deps/curl-7.20.1'' to'' win32_deps/curl-7.21.3''
 
e) Run the script:
 
  
  '''./build-mg-win.sh'''
+
  -DWANT_STATIC_LIBS=On
f) If all goes well you should see the Windows *.exe binaries produced in the '''data/glest_game''' folder.
+
-DMINIUPNPC_VERSION_PRE1_6=false
 +
-DMINIUPNPC_VERSION_PRE1_5=false
 +
-DWANT_STREFLOP=On
 +
-DUSE_FTGL=On
 +
-DWANT_SVN_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=
  
<u>'''5. Test binaries'''</u>
+
==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 [https://sourceforge.net/projects/megaglest/files/win32_deps_mingw.7z/download Sourceforge] and extract into the <tt>source</tt> 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 <tt>cd</tt> to the root folder of your Mega-Glest folder (usually trunk).
 +
*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:
 +
./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.
  
1. To test running the game, run the binary in mk/linux like this:
+
==Test binaries==
  ./glest.bin
+
To test running the game, run the binary in <tt>mk/linux</tt> like this:
 +
  ./megaglest
  
 
These are some commandline options:
 
These are some commandline options:
  ./glest.bin --help
+
  ./megaglest --help
  ./glest.bin --version
+
  ./megaglest --version
  ./glest.bin --opengl-info
+
  ./megaglest --opengl-info
  
'''There are some more useful scripts here''': [[MG/Misc Scripts|Misc Scripts]]
+
==See Also==
 +
*[[MegaGlest]]
 +
*[[MG/Misc Scripts|Miscellaneous MegaGlest Scripts]]
 +
*[[MG/Mac Compiling|Mac Compiling]]
 +
*[[MG/Windows Compiling|Windows Compiling]]
 +
*[[MG/FreeBSD Compiling|FreeBSD Compiling]]
 
[[Category:MG]]
 
[[Category:MG]]
 +
[[Category:Compiling]]

Revision as of 18:01, 13 October 2011

This page explains how to compile MegaGlest on linux platforms.

Requirements

  • Get the project from the SVN using the command line or your favorite SVN tool (such as RabbitVCS or TortoiseSVN).
  • 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
    • lua5.1
    • png
    • SDL
    • openal
    • curl
    • xerces-c
    • ogg
    • vorbis
    • vorbisfile
    • vorbisenc
    • z
    • GL
    • GLU
    • SDLmain
    • ircclient

Building using CMake by Script

  • Go to the top level project directory (megaglest or trunk or whever you placed the project)
  • On linux run build-mg.sh
  • On windows run build-mg.bat
  • To compile for windows under linux run build-mg-win32.sh

Building using CMake by Hand

  • Open a terminal window and navigate to trunk (or the specified branch) and type the following:
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:
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:

-DWANT_STATIC_LIBS=On
-DMINIUPNPC_VERSION_PRE1_6=false
-DMINIUPNPC_VERSION_PRE1_5=false
-DWANT_STREFLOP=On
-DUSE_FTGL=On
-DWANT_SVN_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:
./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