CompilingWesnoth/CrossCompiling
From Wesnoth
Compiling Wesnoth
- on Linux or Unix
- on Linux PDA
- on Mac OS X
- on MS Windows
- on SuSE
- cross-compiling
Tools
Cross-compiling with mingw and scons
Here's another attempt at cross-compiling linux->windows using scons, by Allefant.
To use this, you need scons and mingw and of course a checkout from the wesnoth svn repository. You also need the source for SDL, as well as header files (SDL_net.h, SDL_image.h and SDL_mixer.h from the source packages) and DLLs (the -win32 packages) for the following packages: SDL_image, SDL_net, SDL_mixer.
- http://www.libsdl.org/download-1.2.php
- http://www.libsdl.org/projects/SDL_image/
- http://www.libsdl.org/projects/SDL_mixer/
- http://www.libsdl.org/projects/SDL_net/
And you need the developer files (-lib packages) for freetype, libintl, libpng, jpeg, libiconv.
You need to adjust the path from include/freetype2/freetype/.. to include/freetype after unpacking
- http://gnuwin32.sourceforge.net/packages/libpng.htm
- http://gnuwin32.sourceforge.net/packages/libintl.htm
- http://gnuwin32.sourceforge.net/packages/libiconv.htm
- http://gnuwin32.sourceforge.net/packages/jpeg.htm
Last, you will need the Python headers and Python .DLL (both are included e.g. in the windows installer on python.org). If you don't have wine to extract files from the installer, the headers can also be obtained from the Python sources package, and the .dll I found with google:
- http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2
- http://www.dll-files.com/dllindex/dll-files.shtml?python24
Put them into a sub-directory "win-deps" inside the wesnoth root dir, so it looks like:
wesnoth/win-deps/include/SDL.h wesnoth/win-deps/include/freetype/... ... wesnoth/win-deps/lib/libSDL.a wesnoth/win-deps/lib/libfreetype.a ...
Put the files in the Include folder inside the python .tar.bz2 into a subfolder called python24, and also drop PC/pyconfig.h from the .tar.bz2 into that folder.
Put all DLLs into the win-deps/lib dir.
Then inside your wesnoth folder, do this:
cd utils scons
You may want to adjust some of the settings, like the exact name of the mingw tools. Next, type scons.
It should compile, and create wesnoth.exe.
For running wesnoth you need also the binaries (-bin packages) of freetype, libintl, libpng, jpeg, libiconv. Copy the DLL files (also the SDL and Python ones from above) into the wesnoth root directory. Now, send the whole folder to the windows machine, and there the windows users can double-click wesnoth.exe and play the latest SVN version.
At the time of writing this is the list of files I needed to download (Python is not listed, you need that as well though):
- SDL-1.2.10-win32.zip
- SDL-devel-1.2.10-mingw32.tar.gz
- SDL_image-1.2.5-win32.zip
- SDL_image-1.2.5.tar.gz
- SDL_mixer-1.2.6-win32.zip
- SDL_mixer-1.2.6.tar.gz
- SDL_net-1.2.5-win32.zip
- SDL_net-1.2.5.tar.gz
- freetype-2.1.10-lib.zip
- jpeg-6b-4-bin.zip
- jpeg-6b-4-lib.zip
- libiconv-1.9.2-1-bin.zip
- libiconv-1.9.2-1-lib.zip
- libintl-0.14.4-bin.zip
- libintl-0.14.4-lib.zip
- libpng-1.2.8-bin.zip
- libpng-1.2.8-lib.zip
- http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2
- http://www.dll-files.com/dllindex/dll-files.shtml?python24
Cross-compiling 1.5.3+svn with mingw and scons
Since 1.5.2 pango dependency is added. The simplest way to get pango is to download a windows SDK like this one:
http://www.gtk.org/download-windows.html
Unpack windows SDK in same directory as other deps. Support for using windows SDKs was added after tagging 1.5.3 so using svn trunk is required until 1.5.4
Also, boost is now required. The only way of getting boost I know of is to compile it natively on windows with bjam. Possible partial solution can be found from http://goodliffe.blogspot.com/2008/05/cross-compiling-boost.html (only static compilation works with that)
Run scons from working copy root like this:
scons host=mingw32 prefix=win-deps gtkdir=win-deps boostdir=win-deps/include/boost-1_35 boostlibdir=win-deps/lib boost_suffix=-mgw34-mt-1_35
