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

Mingw compilation

From Globulation2

Revision as of 20:13, 27 July 2010 by FoxyBurner (talk | contribs) (Compiling from Released source code)
Jump to: navigation, search

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

Installing required software for tutorial

Setting up Python, Scons, Mercurial, and NSIS

NOTE: For Windows VISTA and above Users: You need to run as an administrator to install those packages, The Msi installer are perfect , some other got to have warnings some because no Valid or missing The Digital windows OS certificate (Xp, Vista,7 :logo ) accept to install it anyways, and another may ask for an authorization to install some other dependence files , do accept. For some "setup.exe" you might need to run them as administrator by right-clicking on it and select run as an administrators (specially for scons & MinGW)


  • Download and install Python into the directory "C:\Python26" (default install is Python_version_number, change this number to 26 during installation if you want to avoid a BUG, even if you got Python34 )! the Version 3.1.2 is under testing actually !
  • Download scons-1.1.0 and install it [**AS ADMINISTRATOR**] into the same directory as the python install (C:\Python26\) If you are installing a more recent scons version than the scons-1.1.0 An issue #3 [BUG] will occurred. An easy measure is not yet defined. The Version 2 has not been test yet (We are testing this And will update this soon) !
  • Download and install mercurial Mercurial-1.6.0 stable without TortoiseHg.The newiest HG mercurial with Tortoise has not been test yet TortoiseHG 1.1.0(x86) under testing! For the futur other download link to get mercurial.
  • The old Mercurial (outdated) References for this Wiki was (outdated) 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. PLEASE INSTALL ONLY ONE Mercurial ! The 1.6.0 version works Well !

OPTIONAL DOWNLOAD:

(To create a windows installer)

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

(To be proud of using MS WINDOWS GUI for tarballing archives matter)

  • Look for7-Zip (GNU) or winrar (winrar is a Commercial Shareware -with a 30day free-trial), You have also IZarc [Free](but it can't make Gzip archive, he does extract them However) for a more friendly GUI than command line, We are under Windows, do we ?

(In case of Bug or Issues, who knows ? )

Setting up MinGW and MSYS

  • Download MinGW- Minimalist GNU for Windows (the actual v5.x.x works well)and
  • Install it into the directory c:\mingw (lower case).
  • During installation, select "Current" when asked what version, and then
  • select the "MinGW base tools" (by default) and "g++ compiler" packages only
  • 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.
  • Then -the black windows prompt- will continue asking you to indicate where the directory is installed,type :
  • c:/mingw (yes, with a forward slash -linux habit to have- as the program prefers it that way).
  • Open msys by double clicking the desktop icon, type the following code into the emulated *NIX-shell, then be sure to close the window/program so it will takes effect:
echo "c:/mingw /mingw" > /etc/fstab

Compiling Prerequisites

  • Open in a news Windows Explorer windows the path "C:\msys\1.0" (we will drop some files into it later from an archive)
  • 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)
  • Open it with a bz2-tar archiver application like Winrar,or 7z, and
  • Drag and drop All Directories from the Archivers (e.g Winrar) into the path "C:\msys\1.0" (remember we already got a windows ready for that) , tell yes if it ask for over writting, or already existing files/folders. This could take a While.

NOTE: On Windows VISTA and Above you might need the Administrators Right to access copy or drag and drop files into the C Drive trees. an inheritance from linux chmod :(

ONCE Done, close the Archiver, and Windows that we opened for the drag and drop.


OLD_METHODE , 'command line geek'  :


  • 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

A ] Compiling from Released source code

  • Download [ Download_and_Install ] The c++ tarball archive source code file
  • Create a Folder name "glob2_source_building" at c:\msys\1.0\home\XXX\ (where XXX is the username)
  • Extract the archive [USING 7-Zip or assimilated software](Actual Stable source_code) there -in the folder you have just made.
  • Then Go Down to STEP2 ( quicker compiling way :)

Compiling from Mercurial source files

  • Download Globulation 2 from a remote repository (called here mercurial Source)

Do you look for more information about hg clone option&parameters see this MAN PAGE.

hg clone http://hg.globulation2.org/glob2-new glob2
The above command gets you all the history of glob2 back to November 2001 when it all began.


  • Pick a version you want to compile
cd glob2
hg branches
hg tags
these commands give you a list of what existing branches and tags are actually on the repository.

DESCRIPTION:

  • Tags Tags are used to name particular revisions of the repository and are very useful to compare different revisions, to go back to significant earlier versions or to mark branch points as releases, mark certain versions when glob2 publishes a new released (e.g beta4.5 is the beta-4 series 5th version ). This is better and more stable than the beta4.4 but should not desync against beta4.1. If you only want to play glob2 beta4, use the latest tag beta4.whatever_revision.
  • tip is a special Revision tag. It is the revision last committed to the Working repository. In general this is not what you want but you get it by default.
  • Branches are a kind of core-game or working-pool which is based on an existing release ( game source_code) so branches are set to define some news BIG changes or features like 'replay' or 'market_bug' or why not AI_changes ,They are used to mark a sequence of revisions that are not necessarily all stable. Somewhere between beta4-rc branch and beta4.5 there might be versions -branches with Revision update applied or not- that don't compile (mainly for Coding mistake or incompatible branch modification with the apply of an Revision (patch for other bug or merged branches) or not. If you want to help on a beta4.6 you would need to get the branch beta4-rc and update with the revision you would like to help for in this case beta4.6 -this will be explain later.If you would like to play the Beta4.5 with the latest patch (who may be unstable too) you will need to extract the Branch "beta4-rc" and later update it with a proper tags like "tip" or "beta4.5" or else(you got the tags list from the command 'hg tags').
  • default is the main branch where the latest changes is being made (New Series Version,New RC, or unstable version, so this might include new branch). IT's the right place to check it out what news stuff is being coded and implemented.
  • NOTE:If you would to play this branch is not the right -could be Desynchronized , and Unstable.If you look for fixing bugs, this is not the right 'setting' either, because you might look for the buggiest version. Bugs in the default could got fixed in the earliest supported branches (those with an -rc) but not always.If you want to implement new features that you are sure to finish do it in "default". If your feature is complex, use "default" but branch off a feature branch (hg branch my-complex-feature)-> the branch creation will not exist in the repository until the next commit -see HG MAN page for references.


  • Now time for Extracting The [branch name you picked above (this depending of your goal)] from the 'mercurial' download into the a separate folder for the updating & compilation work, I decided to named it "glob2_source_building". So if the compilation abort you do not have to download again from the remote site the mercurial data, avoiding a server overload.In a case of a compilation failure and ONLY in this case you should just delete glob2_source_building by using Windows explorer GUI (with contextual menu and mouse use) This folder should be found at "C:\msys\1.0\home\XXX" Where XXX is your PC's name or username.After that start over from down here.
hg clone -r [branch name you picked above e.g beta5-rc] glob2 glob2_source_building
cd glob2_source_building

Hg clone HELP here.


  • update to the Revision you would like to apply, have or work with.

The [OPTION] -C will assure you that no Hybrid code will be made by any merge branching uncommitted 'revision'. if the update tag chosen is an no consequent one like you choose to apply a Revision design for Beta3-series on your chosen branch beta5-rc , The updater will abort with no modification -If I correctly get the meaning in the manual see: Hg manual. Hint: Branch name could be alias as 'Feature-pool' and tag as 'Revision' ,both are proper called 'changeset' in the Hg manual.

hg update -C [tag 'revision' name you'd like to have e.g tip or beta4.5 ]

Hints: The list of tags are listed with the command "hg tags"

To get more information about How Mercurial Work have look there :Mercurial.

Step 2: actually compiling

  • Start compiling Globulation 2.This Stage could lead to some ISSUES,they are disccuss in the proper section below. Don't worry about the warnings while compiling. If something is wrong, it will grind to a halt and it will let you know why. To compile, run (inside "glob2_source_building" folder, you should already be there):
scons
  • Once compiling has finished
  • Make a 'TEST' directory call "test" or "whatever" using MS WINDOWS in your desktop or 'elsewhere' for the simplest example we will set it up in our windows desktop :) .
  • Copy into it all the file found in "C:\msys\1.0\local\lib" then do not forget to do,
  • Copy and past of the Glob2.exe from "C:\msys\1.0\home\XXX\glob2_source\src\" where XXX is the PC's name or user into this 'Test' directory you have made in your desktop, and...
  • launch it ! ENJOY IT !

If any DLL is missing find it in your local computer and copy it into the 'test' folder on your desktop.


Another old_school Method for testing ( Did not work on Windows, at least mine :( !

-Once compiling has finished, run (if you 'r ,kamikaze, 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 :) [this stage too might lead to lack of dll,bond ! who said that command line are better ....

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

ISSUE #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.)

ISSUE #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.

ISSUE #3. scons: No such file or directory Trouble

I got this trouble as many other people (http://globulation2.org/forums/viewtopic.php?t=210). It is not quite easy to explain how to make-it-works,The solution could be fixed easily but have to be dynamic with ever new python & scons product version . So this Trouble could come over again later.

  • Where that Trouble come from ?

This comes from a "linux-kind-link" who has been designed for Python 2.6 AND scons-1.1.0 Versions, Guess what this link is (OUT TO DATE) due to the fact that the Python today version and scons have evolve their name, their path could too ! That said, as you see The Trouble will come over and over if the way to bond the scoms path to the mingw sh (linux command bash, & emulated environment) will stay like that.

  • What the Community could do ?

Here some ideas: We might need to keep up-to-date either this Wiki page and the scoms file provided in the tarball file call 'Prerequisites' (http://dl.sv.nongnu.org/releases/glob2/mingw/glob2_required_libs_mingw-scons.tar.bz2). Yes, telling people what Python & scoms version STRICTLY to use and keeping this up to date with news release (because their release will getting old and might not stay available for download).

  • What YOU can do to make it works ?

The FIRST LAZY WAY:

Remove the actual Python and scons program from your computer, then download and install the old python2.6 **AND** scons1.1.0 version for windows if they are still available for download.

The SECOND LAZY WAY: (has not been test yet and may not solve the trouble)

Download the latest python and install it on c:\python26 and the latest scons on c:\python26\lib\site-packages\scons-1.1.0\

OR THE MOST COMPLICATED WAY: Editing the scoms file.

File with no Extension and normaly "located" at "c:\msys\1.0\bin\" or might also work or be found there at "c:\mingw\bin\" you should use a proper Text Editor , do not even think to use the MS notepad because it does sometime files coruption, at least you may use MS WORDPAD at your own files risk !,Better to use the Free Notepad++ who really edit well available as portable application also.

For Editing the ORIGINAL scoms file :

Replace the line:

#! C:/Python26/python , by your real information and software version and path location:

#! Drive:/Python_version_location/python

AND the two next occurrences of the expression or chart: 'scons-1.1.0' by your actual 'scons-version.x.x.x.'

Try to launch again 'scoms' in the 'glob2_source' folder from MSYS application (the emulated *NIX environment & prompt) , in fact the STEP 2 of this Wiki page, If 'scoms' start compiling - a lot of information will be writting in the MSYS application windows, you 'r done !

  • IF NOT see those hint :

you might need to check and found if your scons is on the right path as for the scons v1 it is like C:\Python27\Lib\site-packages\scons-1.3.0\SCons\Script\SConscript.pyc

IF the path Drive:\Python_version_path\Lib\site-packages\scons-version.x.x.x\SCons\" is not , you may need also to modified some other chart or expression in quotation mark e.g 'scons-1.1.0' to 'scons-2.0.0' You should found anyway on your computer somewhere the file 'SConscript.pyc' if the scons is correctly installed.


This Help is there and is provided AS IS , its works on my Windows Vista 32bit, and this Details Help should stay here long enought the file glob2_required_libs_mingw-scons.tar.bz2 containing the **OUTDATED** 'scoms link code' ! ALSO I M SORRY FOR THE OVERALL TEXT DESIGN but I m not use with this Web-tools and formatting ! even making a web-link is a problem well the help page is not working so feel free to correct my text design code.

ISSUE #4.

Some other little trouble occurred with .dll location after a correct compilation using the old method ,but this could be handle quickly using the method with the use of Windows GUI, remember the 'test' folder on your desktop :) .

Conclusion

That concludes this Mingw compilation tutorial.Well it does have again some correction to bring to this tutorial,like the use of Windows GUI for un-tarballing archives and copy and past more than the use of command line, after all we are under windows and this is a windows topic so we will try to clear code line who can be done by GUI application such as 7zip or Winrar, and many else page-improvement.

Also to give you and idea on a 4 cores pentium cpu @ 2.33GHZ the compilation of the RC beta5 got 12 minutes and the binary (Glob2.exe file) "pound" 133MB !! well the other geek guys made one at 98MB so we are 1.32 time more weighty with this type of compilation. But clearly as today the comparison between Beta4 & Beta 5 is amazing by the Glob2 binary file size ! from 4.8kb to 100Mb .


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. Also think about the IRC , easy connexion via YOG.

Happy compiling.

Misc