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
Line 1: Line 1:
__TOC__
This developers article has been moved to http://globulation2.devjavu.com/
This page explains how to compile Globulation 2 on windows using [http://www.mingw.org/ mingw].


Note: Globulation 2 does not compile with mingw gcc versions 3.2.3, 2.95.3-8 and 3.4.2. But don't worry, gcc version 3.3.1 works and is included in glob2_required_libs_mingw.tar.bz2.
Please go there to find in. Thank you.


==Setting up mingw==
[[Category:NewWiki]]
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">(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)</td></tr></table>

:*Download and install [http://prdownloads.sf.net/mingw/MinGW-3.1.0-1.exe?download MinGW-3.1.0-1.exe] into the directory c:\mingw.

:*Next, download and install [http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download 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 [http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download msysDTK-1.0.1.exe] in the same directory as mingw and msys (c:\mingw)


==Compiling Prerequisites==
:*Download glob2_required_libs_mingw.tar.bz2 from http://globulation2.org/dev/glob2_required_libs_mingw.tar.bz2 and put them in the home directory of mingw (c:\mingw\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.tar.bz2 (for example cd ~) and untar the libraries like this :
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">tar jxf glob2_required_libs_mingw.tar.bz2 -C /</td></tr></table>

:*Download boost c++ precompiled libraries :
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">wget http://viral.media.mit.edu/releases/boost-1.33.1-mingw-bin.tar.gz</td></tr></table>

:*Manually install boost c++ with the following commands:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">tar zxf boost-1.33.1-mingw-bin.tar.gz</td></tr></table>
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">mv boost/include/boost-1_33_1/boost /usr/include && mv boost/lib/* /usr/lib</td></tr></table>

:*To allow the important command "make" to run, use the following command:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">mv /usr/bin/mingw32-make.exe /usr/bin/make.exe</td></tr></table>


==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:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">mv glob2-0.8.19 glob2_release</td></tr></table>

:*Download Globulation 2 from cvs (as anonymous for example):
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">export CVS_RSH="ssh" && cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/glob2 co glob2</td></tr></table>
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">mv glob2 glob2_cvs</td></tr></table>

:*In order for compiling to work properly, run the following commands:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">cd glob2_release</td></tr></table>
: (note there is a . at the end of this command)
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">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 .</td></tr></table>
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">cp ../glob2_cvs/bootstrap .</td></tr></table>

:*Open glob2_release/configure.in and find:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"</td></tr></table>
::and replace with:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -I/usr/include/freetype2"<br />LDFLAGS="$LDFLAGS `sdl-config --libs` -lSDL_ttf"</td></tr></table>

:*In the same file, find:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">LIBS="$LIBS -logg -lwsock32"</td></tr></table>
::and replace with:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">LIBS="$LIBS -lwsock32 /lib/libvorbisfile.a /lib/libvorbis.a /lib/libogg.a"</td></tr></table>

:*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:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">./bootstrap && ./configure && make</td></tr></table>

:*To make the executable smaller in size, run the following command:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">strip ./src/glob2.exe</td></tr></table>

===Compiling from CVS===
:*Download Globulation 2 from cvs (as anonymous for example):
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">export CVS_RSH="ssh" && cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/glob2 co glob2</td></tr></table>

:*Before compiling glob2, run these commands:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">cd glob2</td></tr></table>
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">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 .</td></tr></table>

:*Open configure.in and find:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"</td></tr></table>
::and replace with:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -I/usr/include/freetype2"<br />LDFLAGS="$LDFLAGS `sdl-config --libs` -lSDL_ttf"</td></tr></table>

:*In the same file, find:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">LIBS="$LIBS -logg -lwsock32"</td></tr></table>
::and replace with:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">LIBS="$LIBS -lwsock32 /lib/libvorbisfile.a /lib/libvorbis.a /lib/libogg.a"</td></tr></table>

:*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:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">./bootstrap && ./configure && make</td></tr></table>

:*To make the executable smaller in size, run the following command:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">strip ./src/glob2.exe</td></tr></table>

:*Finally, to get the data, maps, and campaigns needed to play the game, run the following commands:
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">./syncdata</td></tr></table>
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">./syncmaps</td></tr></table>


==Testing Globulation 2 on windows==
:*Download glob2_windows_runtime.tar.bz2
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">wget http://globulation2.org/dev/glob2_windows_runtime.tar.bz2</td></tr></table>

:*Extract it with :
::<table width="90%"><tr valign="top"><td style="border: 1px dashed #000000; padding: .3em .9em .3em; color: #000000; background-color: #F8F8FF">tar jxf glob2_windows_runtime.tar.bz2</td></tr></table>

:*Copy the folders data/, maps/, and campaigns/ and the file AUTHORS 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 :)

[[Category:Developer Resources]]

Revision as of 05:30, 9 April 2007

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

Note: Globulation 2 does not compile with mingw gcc versions 3.2.3, 2.95.3-8 and 3.4.2. But don't worry, gcc version 3.3.1 works and is included in glob2_required_libs_mingw.tar.bz2.

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)
  • 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 like this :
tar jxf glob2_required_libs_mingw.tar.bz2 -C /
  • Download boost c++ precompiled libraries :
wget http://viral.media.mit.edu/releases/boost-1.33.1-mingw-bin.tar.gz
  • Manually install boost c++ with the following commands:
tar zxf boost-1.33.1-mingw-bin.tar.gz
mv boost/include/boost-1_33_1/boost /usr/include && mv boost/lib/* /usr/lib
  • To allow the important command "make" to run, use the following command:
mv /usr/bin/mingw32-make.exe /usr/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.19 glob2_release
  • Download Globulation 2 from cvs (as anonymous for example):
export CVS_RSH="ssh" && cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/glob2 co glob2
mv glob2 glob2_cvs
  • In order for compiling to work properly, run the following commands:
cd glob2_release
(note there is a . at the end of this 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 .
cp ../glob2_cvs/bootstrap .
  • 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 -lwsock32 /lib/libvorbisfile.a /lib/libvorbis.a /lib/libogg.a"
  • 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 CVS

  • Download Globulation 2 from cvs (as anonymous for example):
export CVS_RSH="ssh" && cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/glob2 co glob2
  • Before compiling glob2, run these commands:
cd glob2
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 .
  • Open 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 -lwsock32 /lib/libvorbisfile.a /lib/libvorbis.a /lib/libogg.a"
  • 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 file AUTHORS 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