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
(Possible Issues)
(Possible Issues)
Line 59: Line 59:


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



3. Called "scons: No such file or directory" Trouble
3. Called "scons: No such file or directory" Trouble


I got this trouble as many other people. I found the solution.
I got this trouble as many other people. I found the solution.
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 product version of python & scons.
It is not quite easy to fix it and explain it, this comes from a link who has been made fort the Python 2.6 Version AND scons-1.1.0 , Guess what this link is OUT TO DATE ! Why ? because nearly the python is V3 today and Scons V2, never the less you can either try to find the old python and scons version for windows if their are available to download, or Edit 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 like the Free Notepad++ who really edit well, do not even think to use the MS notepad because it does sometime corupt files, at least use MS WORDPAD at your own files risk !, Then change the ORIGINAL code
[[So this Trouble could come over again later]].

Where that Trouble come from ?
This comes from a "kind-link" who has been made for the use of Python 2.6 Version AND scons-1.1.0 , Guess what this link is OUT TO DATE !

What you can do to make it works ?
You can either try to find the old python2.6 and scons1.1.0 version for windows if theire still available for download.

OR THE MOST COMPLICATED WAY, Edit 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 :


"
"
#! C:/Python26/python
''' #! C:/Python26/python


from os.path import join
from os.path import join
Line 72: Line 86:
sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-1.1.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-1.1.0'), join(sys.prefix, 'scons')] + sys.path
sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-1.1.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-1.1.0'), join(sys.prefix, 'scons')] + sys.path
import SCons.Script
import SCons.Script
SCons.Script.main()
SCons.Script.main()'''
"
"
By be aware that every "'''*'''" need your changes
By be aware that every "[[*]]" need your changes
"
"
#! C:/Python'''*'''/python
'''#! C:/Python[[*]]/python


from os.path import join
from os.path import join
import sys
import sys


sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-'''*''''), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-'''*''''), join(sys.prefix, 'scons')] + sys.path
sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-[[*]]), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-[[*]]), join(sys.prefix, 'scons')] + sys.path
import SCons.Script
import SCons.Script
SCons.Script.main()
SCons.Script.main()'''
"
"


like for python2.6 version and scons 1.3.0 this would like to that:
like for python2.6 version and scons 1.3.0 this would like to that:
"
"
#! C:/Python27/python
'''#! C:/Python27/python


from os.path import join
from os.path import join
Line 95: Line 109:
sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-1.3.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-1.3.0'), join(sys.prefix, 'scons')] + sys.path
sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-1.3.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-1.3.0'), join(sys.prefix, 'scons')] + sys.path
import SCons.Script
import SCons.Script
SCons.Script.main()
SCons.Script.main()'''
"
"


''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' !''
''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' !''


==Conclusion==
==Conclusion==

Revision as of 00:54, 27 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 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 an overview of what branches and tags exist.
Tags are used to mark certain versions like when glob2 publishes a new released. beta4.5 for example is the 5th version of the beta-4 series of releases. 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. tip is a special tag. It is the revision last committed to the repository. In general this is not what you want but you get it by default.
Branches are used to mark a sequence of revisions that are not necessarily all stable. Somewhere after beta4.5 on the beta4-rc branch there may be versions that don't compile. If you want to help on a beta4.6 you would need to get the branch beta4-rc. default is the main branch. If you want to play this is not the branch you want. If you want to fix bugs, this is not what you want as bugs get fixed in the earliest supported branches (those with an -rc). 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).
  • update to the right revision.
hg update -C \[branch name or tag name you picked above\]

Step 2: actually 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 the folder glob2):
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.


3. Called "scons: No such file or directory" Trouble


I got this trouble as many other people. I found the solution. 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 product version of python & scons. So this Trouble could come over again later.

Where that Trouble come from ? This comes from a "kind-link" who has been made for the use of Python 2.6 Version AND scons-1.1.0 , Guess what this link is OUT TO DATE !

What you can do to make it works ? You can either try to find the old python2.6 and scons1.1.0 version for windows if theire still available for download.

OR THE MOST COMPLICATED WAY, Edit 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 :

" #! C:/Python26/python

from os.path import join import sys

sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-1.1.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-1.1.0'), join(sys.prefix, 'scons')] + sys.path import SCons.Script SCons.Script.main() " By be aware that every "*" need your changes "

#! C:/Python*/python

from os.path import join import sys

sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-*), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-*), join(sys.prefix, 'scons')] + sys.path import SCons.Script SCons.Script.main() "

like for python2.6 version and scons 1.3.0 this would like to that: " #! C:/Python27/python

from os.path import join import sys

sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-1.3.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-1.3.0'), join(sys.prefix, 'scons')] + sys.path import SCons.Script SCons.Script.main() "

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' !

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