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

Difference between revisions of "Mingw cross compilation"

From Globulation2

Jump to: navigation, search
Line 1: Line 1:
This developers article has been moved to http://globulation2.devjavu.com/
This page explains how to build and test globulation2 for windows on a Debian GNU/Linux operating system.


Please go there to find in. Thank you.
For any problems or suggestions, don't hesitate to contact me. [[User:Ion bidon|Ion bidon]]


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

[[Image:Cross_compiled_wine_test.png|thumb]]

===Compile globulation2 for windows on Debian using mingw===

#install mingw :
#:<pre>apt-get install mingw32 mingw32-binutils mingw32-runtime</pre>
#install wine from the wine repository :
#:Change the file /etc/apt/sources.list and add <pre>deb http://wine.sourceforge.net/apt/ binary/</pre>
#:<pre>apt-get update && apt-get install wine && ln -s /usr/bin/wine /usr/bin/wine-auto</pre>
#create the following directory :
#:<pre>mkdir libs</pre>
#download glob2_required_libs_mingw.tar.bz2 :
#:<pre>wget http://globulation2.org/dev/glob2_required_libs_mingw.tar.bz2</pre>
#untar the libraries like this :
#:<pre>tar jxf glob2_required_libs_mingw.tar.bz2 -C ./libs</pre>
#download boost c++ precompiled libraries :
#:<pre>wget http://viral.media.mit.edu/releases/boost-1.33.1-mingw-bin.tar.gz</pre>
#manually install boost c++ with the following commands :
#:<pre>tar zxf boost-1.33.1-mingw-bin.tar.gz</pre>
#:<pre>mv boost/include/boost-1_33_1/boost ./libs/include</pre>
#:<pre>mv boost/lib/* ./libs/lib</pre>
#Download a mingw compiler that works :
#:<pre>wget http://mirrors.ircam.fr/pub/videolan/testing/win32/mingw-gcc3.3.1-linux-crosscompiler.tar.bz2</pre>
#As root, unpack the compiler (it will create a mingw directory in /usr/local) :
#:<pre>tar jxf mingw-gcc3.3.1-linux-crosscompiler.tar.bz2 -C /</pre>
#From the directory containing the libs directory, type the following :
#:<pre>export CC="i586-mingw32msvc-gcc"</pre>
#:<pre>export CXX="i586-mingw32msvc-g++"</pre>
#:<pre>export CFLAGS="-I$PWD/libs/include $CFLAGS"</pre>
#:<pre>export CXXFLAGS="-I$PWD/libs/include -I$PWD/libs/include/freetype2 $CXXFLAGS"</pre>
#:<pre>export LDFLAGS="-L$PWD/libs/lib $LDFLAGS"</pre>
#:<pre>export PATH=/usr/local/mingw/bin:/usr/i586-mingw32msvc/bin:$PWD/libs/bin:$PATH</pre>
#:<pre>rm ./libs/bin/auto*</pre>
#: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:<br />
#: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
#download glob2 cvs (as anonymous for example) :
#:<pre>export CVS_RSH="ssh"</pre>
#:<pre>cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/glob2 co glob2</pre>
#:<pre>cd glob2</pre>
#:<pre>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 .</pre>
#:<pre>cp ../libs/lib/libvorbisfile.a ../libs/lib/libvorbis.a ../libs/lib/libogg.a .</pre>
#:Open the configure.in file, 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 ../libvorbisfile.a ../libvorbis.a ../libogg.a"</td></tr></table>
#compiling glob2 :
#:<pre>./bootstrap</pre>
#:<pre>./configure --host=i586-mingw32msvc</pre>
#:<pre>make</pre>
#To make the executable smaller :
#:<pre>strip ./src/glob2.exe</pre>

===Test globulation2 for windows on Debian ===

#download glob2_windows_runtime.tar.bz2
#:<pre>wget http://globulation2.org/dev/glob2_windows_runtime.tar.bz2</pre>
#extract it with :
#:<pre>tar jxf glob2_windows_runtime.tar.bz2</pre>
#go in the glob2 directory where you have compiled glob2 and type
#:<pre>./syncdata</pre>
#:<pre>./syncmaps</pre>
#copy the content of glob2/data/ to glob2_runtime/data/
#copy the content of glob2/maps/ to glob2_runtime/maps/
#copy glob2.exe which is in the src directory (glob2/src/) to glob2_runtime/
#run wine glob2.exe from the glob2_runtime directory and play :)

[[Category:Developer Resources]]

Revision as of 07:22, 8 April 2007

This developers article has been moved to http://globulation2.devjavu.com/

Please go there to find in. Thank you.

Misc