Free and Open Source real time strategy game with a new take on micro-management

Difference between revisions of "Mingw compilation"

From Globulation2

Jump to: navigation, search
(Step 2: Continue compiling)
Line 30: Line 30:
hg clone http://hg.globulation2.org/glob2-new
hg clone http://hg.globulation2.org/glob2-new
:*Extract the master (the stable branch) from the mercurial download (this can also be used to extract other branches, such as beta4-rc):
:*Extract the master (the stable branch) from the mercurial download (this can also be used to extract other branches, such as beta4-rc):
hg clone -r default glob2 glob2_source
hg clone -r default glob2-new glob2_source
:*To compile the latest code, run:
:*To compile the latest code, run:
cd glob2_source
cd glob2_source

Revision as of 20:13, 26 July 2010

This page explains how to compile Globulation 2 on windows using mingw.

Installing required software for tutorial

Setting up Python, Scons, Mercurial, and NSIS

  • Download and install Python into the directory "C:\Python26" (default install is Python26, don't change this)
  • Download and install Scons into the same directory as the python install (C:\Python26\)
  • Download and install stable Mercurial locally so the command hg will work. When you get to the end of the install, make sure you check "add mercurial to your computers search path" or something similar.

(To create a windows installer)

  • Download and install NSIS into all its default installation folder "C:\Program Files\NSIS\".

Setting up MinGW and MSYS

  • Download and install MinGW-5.1.4.exe into the directory c:\mingw (lower case). During installation, select "Current" when asked what version, and then and select the MinGW base tools and g++ compiler packages only
  • And, download and install MSYS-1.0.10.exe into the directory c:\msys\1.0\ (lower case). At the end of the installation, it will ask you if you want to continue with the post-install. Select yes, and yes again when it ask if you have mingw installed. When it ask you to indicate the directory where it is installed, type in c:/mingw (yes, with a forward slash as the program prefers it that way).
  • Open msys by double clicking the desktop icon, run the following, then be sure to close the window so it takes effect:
echo "c:/mingw /mingw" > /etc/fstab

Compiling Prerequisites

  • Download glob2_required_libs_mingw-scons.tar.bz2 and put it in the home directory of msys (c:\msys\1.0\home\XXX\ where XXX is the username)
  • Double click the MSYS icon that has been placed on your desktop during MSYS's installation.
  • Go in the directory where you put the glob2_required_libs_mingw-scons.tar.bz2 (for example cd ~) and untar the libraries using the command below. This process could take a while:
tar jxf glob2_required_libs_mingw-scons.tar.bz2 -C /

Compiling Globulation 2

Step 1: Preparing for a compile

Compiling from Released source code

  • Download and extract the release to c:\msys\1.0\home\XXX\ (where XXX is the username), then run (changing the version numbers):

mv glob2-x.x.xx glob2_source

Compiling from Mercurial source files

  • Download Globulation 2 from mercurial:
hg clone http://hg.globulation2.org/glob2-new
  • Extract the master (the stable branch) from the mercurial download (this can also be used to extract other branches, such as beta4-rc):
hg clone -r default glob2-new glob2_source
  • To compile the latest code, run:
cd glob2_source
hg update -C tip

Step 2: Continue compiling

  • Start compiling Globulation 2. Don't worry about the warnings. If something is wrong, it will grind to a halt and it will let you know why. To compile, run (inside glob2_source):
scons
  • Once compiling has finished, run the following to prepare Globulation 2 for testing:
cp -a /local/bin/SDL.dll /local/lib/*.dll .
cp -a ./src/glob2.exe .
  • Run glob2.exe from the glob2_source directory and play :)

Building a Globulation 2 NSIS installer

  • In MSYS, run the following codes to compile a windows installable exe file:
cd glob2_source
cd windows
glob2_make_win32.sh
  • If all things go well, an exe ready for installation on windows computers is now ready within the windows folder. Test it (install and play), and if it works, send it to your friends ;)

Possible Issues

1. Make sure you have no hidden GNU-GCC installed somewhere. GCC is for example included in the FreePascal-Compiler. (You won't find any Lib anymore if another GCC is activ.)

2. Make sure path to GCC is set in Path Enviroment Variable. The Scons-Script just aborts (can't find libSDL) if it is not.

Conclusion

That concludes this Mingw compilation tutorial. If you have any problems, please write a bug report and one of the Windows maintainers should be able to help you. More information on bug reports can be found at the Bug Reports page. Happy compiling.

Misc