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

Mingw compilation

From Globulation2

Revision as of 09:00, 17 July 2007 by K776 (talk | contribs) (Second change to compilation guide (1 or 2 to go))
Jump to: navigation, search

Warning

This guide wont be effective until July 20th, when the files are garenteed to be uploaded and everything working. Till then, see an old revision of this page

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

Setting up Python/Scons, and Mercurial

  • Download and install python-2.5.1.msi into the directory C:\python\ (lowercase "python", default install is Python25, don't use this)
  • Download and install scons-0.97.win32.exe into the same directory as the python install (C:\python\)
  • Download and install Mercurial-0.9.4-f48290864625.exe locally (to any directory, preferably default C:\Mercurial though) 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. And now you are ready to go.


Setting up mingw

(Warning! For the first 3 steps, all install directories must be the exact same. Do not use spaces or capitals for the installation directory. For this guide, we will use the default c:\mingw)
  • Download and install MinGW-5.1.3.exe into the directory c:\mingw (lower case) and select the MinGW base tools package only during the installation selection process.
  • Next, download and install MSYS-1.0.10.exe in the same directory as MinGW (c:\mingw). 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).
  • And lastly, download and install msysDTK-1.0.1.exe in the same directory as mingw and msys (c:\mingw)


Compiling Prerequisites

  • 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.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.tar.bz2 -C /
  • Close the MSYS console (to ensure install is complete). Download and install gcc-4.1.2-mingw-setup.exe making sure you set the destination location to C:\mingw, tick all three boxes on the additional tasks page (making sure MSVCR71.DLL is the selected library (for Python 2.4 and 2.5)), and selecting the correctly install Python installation done before this section.
  • Double click the MSYS icon that has been placed on your desktop during MSYS's installation.
  • Finally, to allow the important command "make" to run, use the following command:
cp -a /bin/mingw32-make.exe /bin/make.exe


Compiling Globulation 2

Compiling from released source code

  • Download and extract the release to c:\mingw\home\XXX\ (where XXX is the username), then run:
mv glob2-0.8.xx glob2_release
  • Open glob2_release/configure.in and find:
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
and replace with:
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -I/usr/include/freetype2"
LDFLAGS="$LDFLAGS `sdl-config --libs` -lSDL_ttf"
  • In the same file, find:
LIBS="$LIBS -logg -lwsock32"
and replace with:
LIBS="$LIBS -logg -lwsock32 /lib/libvorbisfile.a /lib/libvorbis.a /lib/libogg.a"
  • In order for compiling to work properly, open the mingw console, and run the following commands:
cd glob2_release
(note there is a . at the end of the following command)
cp /usr/bin/SDL.dll /usr/bin/libvorbis-0.dll /usr/bin/libogg-0.dll /usr/bin/libvorbisenc-2.dll /usr/bin/libfreetype-6.dll .
  • Go to the bootstrap file, right click, hit save page as, save it to your computer, the move it to the folder glob2_release (in c:\mingw\home\xxx\glob2_release)
  • Now to 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:
./bootstrap && ./configure && make
  • To make the executable smaller in size, run the following command:
strip ./src/glob2.exe

Compiling from Mercurial

  • Download Globulation 2 from mercurial:
hg clone http://hg.globulation2.org/glob2/
  • Extract the master (the stable branch) from the mercurial download (this can also be used to extract other branches, such as core_rewrite_2007):
hg clone -r master glob2 glob2-master
  • Open glob2-master/configure.in and find:
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
and replace with:
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -I/usr/include/freetype2"
LDFLAGS="$LDFLAGS `sdl-config --libs` -lSDL_ttf"
  • In the same file, find:
LIBS="$LIBS -logg -lwsock32"
and replace with:
LIBS="$LIBS -logg -lwsock32 /lib/libvorbisfile.a /lib/libvorbis.a /lib/libogg.a"
  • Before compiling glob2, run these commands from the mingw console:
cd glob2-master
cp /usr/bin/SDL.dll /usr/bin/libvorbis-0.dll /usr/bin/libogg-0.dll /usr/bin/libvorbisenc-2.dll /usr/bin/libfreetype-6.dll .
  • Now to 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:
./bootstrap && ./configure && make
  • To make the executable smaller in size, run the following command:
strip ./src/glob2.exe
  • Finally, to get the data, maps, and campaigns needed to play the game, run the following commands:
./syncdata
./syncmaps


Testing Globulation 2 on windows

  • Download glob2_windows_runtime.tar.bz2
wget http://globulation2.org/dev/glob2_windows_runtime.tar.bz2
  • Extract it with :
tar jxf glob2_windows_runtime.tar.bz2
  • Copy the folders data/, maps/, and campaigns/ and the files AUTHORS and COPYING to glob2_runtime/, overwriting any existing files
  • Copy glob2.exe which is in the src directory (glob2/src/) to glob2_runtime/
  • Run glob2.exe from the glob2_runtime directory and play :)
Misc