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

Mingw cross compilation

From Globulation2

Revision as of 20:24, 26 January 2006 by Ion bidon (talk | contribs)
Jump to: navigation, search

This page explains how to build and test globulation2 for windows on a Debian GNU/Linux operating system.

For any problems or suggestions, don't hesitate to contact me. Ion bidon

Remark: if you use another mingw compiler than the one requested to download in this page, compilation might fail.

Cross compiled wine test.png

Compile globulation2 for windows on Debian using mingw

  1. install mingw :
    apt-get install mingw32 mingw32-binutils mingw32-runtime
  2. install wine from the wine repository :
    Change the file /etc/apt/sources.list and add
    deb binary/
    apt-get update && apt-get install wine && ln -s /usr/bin/wine /usr/bin/wine-auto
  3. create the following directory :
    mkdir libs
  4. download glob2_required_libs_mingw.tar.bz2 :
  5. untar the libraries like this :
    tar jxf glob2_required_libs_mingw.tar.bz2 -C ./libs
  6. download boost c++ precompiled libraries :
  7. 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 ./libs/include
    mv boost/lib/* ./libs/lib
  8. Download a mingw compiler that works :
  9. As root, unpack the compiler (it will create a mingw directory in /usr/local) :
    tar jxf mingw-gcc3.3.1-linux-crosscompiler.tar.bz2 -C /
  10. From the directory containing the libs directory, type the following :
    export CC="i586-mingw32msvc-gcc"
    export CXX="i586-mingw32msvc-g++"
    export CFLAGS="-I$PWD/libs/include $CFLAGS"
    export CXXFLAGS="-I$PWD/libs/include -I$PWD/libs/include/freetype2 $CXXFLAGS"
    export LDFLAGS="-L$PWD/libs/lib $LDFLAGS"
    export PATH=/usr/local/mingw/bin:/usr/i586-mingw32msvc/bin:$PWD/libs/bin:$PATH
    rm ./libs/bin/auto*
    change the third line of ./libs/bin/sdl-config from prefix=/usr to point to the libs directory (hard path) or from the directory containing the libs directory, type:

perl -e '$pwd=%ENV->{PWD};$tmp="";while(<>){chomp;if(s/prefix=\/usr/prefix=/g){$_="prefix=".$pwd."/libs"}$tmp.= $_."\n"}open(FI,"+< ./libs/bin/sdl-config");print FI $tmp;' ./libs/bin/sdl-config

  1. download glob2 cvs (as anonymous for example) :
    export CVS_RSH="ssh"
    cvs -z3 co glob2
    cd glob2
    cp ../libs/bin/SDL.dll ../libs/bin/libvorbis-0.dll ../libs/bin/libogg-0.dll ../libs/bin/libvorbisenc-2.dll ../libs/bin/libfreetype-6.dll .
    change in :
    LDFLAGS="$LDFLAGS `sdl-config --libs` -lSDL_ttf"
  2. compiling glob2 :
    ./configure --host=i586-mingw32msvc
  3. To make the executable smaller :
    strip ./src/glob2.exe

Test globulation2 for windows on Debian

  1. download glob2_windows_runtime.tar.bz2
  2. extract it with :
    tar jxf glob2_windows_runtime.tar.bz2
  3. go in the glob2 directory where you have compiled glob2 and type
  4. copy the content of glob2/data/ to glob2_runtime/data/
  5. copy the content of glob2/maps/ to glob2_runtime/maps/
  6. copy glob2.exe which is in the src directory (glob2/src/) to glob2_runtime/
  7. run wine glob2.exe from the glob2_runtime directory and play :)