en fr

es pl

sv de
direct download download direct download

howto/en/compile under mingw

From Wormux

Rationale for some command-lines operations: as the packages are for Visual Studio, files (mostly .lib files) are located in inproper folders.

A solution to do a pseudo-package:

touch /mingw/f
make install
cd /mingw
find . -cnewer f -type f | sed 's|\./||g' > list
tar -cvjf package.tar.bz2 -T t

Contents

Base system

Known discrepancies

Because the win32 maintainer tries to reduce the shipped dependencies and stick to some software toolkit versions, there might be some things different for you than for him. Some are explained below, but here is a list of some of them: - libxml2, libjpeg and libpng(12) are coming from the GTK+ SDK, so they may or may not be compatible with some versions (most notably, libjpeg may define a boolean type that doesn't resolve to the same base type (either char or int) depending on the OS - SDL_image was rebuilt so as to link to those dlls, and forcing the boolean type used by the struct - NLS support comes from gettext 14.5; the MSVC binary distribution (found in the GTK+ SDK) doesn't have some of the symbols the M4 scripts expect

msys

  • Get http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download
  • Install it in a folder without space (so not "Program Files"). Remove "1.0" from the install path. From now on, MSYS will design this folder.
  • Say no to post install
  • To change shell colors, set windows env. variables MINGW32BGCOLOR and MINGW32FGCOLOR to proper colors
  • If you want your .bash_profile to be executed, add this line at the end of /etc/profile:
 if [ -f "$HOME/.bash_profile" ]; then source "$HOME/.bash_profile"; fi

msys DTK

mingw

Mingw utilities

Autotools

 ACLOCAL_PATH=/target/share/aclocal:/mingw/share/aclocal:/usr/share/aclocal
 PATH=/target/bin:$PATH
 CPATH=/usr/include:/mingw/include:$CPATH
 LD_LIBRARY_PATH=/target/lib:/usr/lib:$LD_LIBRARY_PATH
 LD_RUN_PATH=$LD_LIBRARY_PATH
 PKG_CONFIG_PATH=/target/lib/pkgconfig:/mingw/lib/pkgconfig
 export LD_LIBRARY_PATH LD_RUN_PATH PATH CPATH PKG_CONFIG_PATH
 export ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I /target/share/aclocal -I /mingw/share/aclocal/"

Libs and tools required

Most things to compile can be downloaded to MSYS/home/<user>, which from now on is refered to as HOME.

libxml2 and friends

This subsection historically tried to describe compilation of many packages. Nowadays, SDK packages are quite well done, and as we can't but base many things (including installer script) on the location and names of dlls, the parts related to (nowadays unnecessary) compilation were removed. One can get SDK for gtk+ at [1] that contains the following packages of interest to us:

  • libxml2 (2.6.32)
  • libjpeg
  • libpng

SDL and friends

SDL itself

  • Get SDL-devel-1.2.12-mingw32.tar.gz; the VC8 can't be used because it does not have all the files needed.
  • Unpack it to MSYS/mingw (only bin, lib, include and share folders are important)
  • Edit /mingw/bin/sdl-config and change prefix so that it points to /mingw
prefix=/mingw
  • The new version seems to have a spelling error in MSYS/mingw/include/SDL/SDL_stdinc.h. So, edit it, search for a line (579 maybe) '#ifdef HAVE_ICONV' and add _H at the end of this line.

Some of the libraries used afterwards are built with Visual Studio 2005, which means that the user has to install Microsoft's runtime OR the installer has to do it for him. This dependency was chosen because Visual Studio is also able to compile Wormux, so this step factorized work.

SDL_mixer

From 1.2.8 on, this library loads at runtime the dll rather than at link time. Fortunately, the package provides those dlls.

  • Get SDL_mixer-devel-1.2.8-VC8.zip
  • DONT unpack it to MSYS/mingw, rather:
    • Extract lib/*.dll into MSYS/mingw/bin
    • Extract include/SDL_mixer.h into MSYS/mingw/include/SDL
    • Extract lib/SDL_mixer.lib into MSYS/mingw/lib

SDL_image

The very problematic part about this dll is that it often hardcodes the names of the dll it plans to use. Because it depends on dlls built by Visual Studio 2005, and that in particular jpeg.dll is NOT the same as the one provided by the GTKmm SDK, the normal road was chosen.

  • Get SDL_image-devel-1.2.6-VC8.zip.
  • DON'T unpack it to MSYS/mingw but rather:
    • Extract lib/*.dll into MSYS/mingw/bin
    • Extract include/SDL_ttf.h into MSYS/mingw/include/SDL
    • Extract SDL_image.lib into MSYS/mingw/lib

I would however recommend to modify the name of the dlls loaded so as to avoid duplicated dlls. This might require to fix the jpeg loader code, as the jpeg dll might have been compiled with the boolean type as either an integer or a char. A solution is to add such code:

#define HAVE_BOOLEAN /* Avoid libjpeg headers to define their own boolean type */
#define boolean unsigned char /* Change according to the dll you have */

SDL_ttf

  • Get SDL_ttf-devel-2.0.9-VC8.zip.
  • DON'T unpack it to MSYS/mingw but rather:
    • Extract lib/*.dll into MSYS/mingw/bin
    • Extract include/SDL_ttf.h into MSYS/mingw/include/SDL
    • Extract SDL_ttf.lib into MSYS/mingw/lib

SDL_net

  • Get SDL_net-devel-1.2.7-VC8.zip
  • DON'T unpack it to MSYS/mingw but rather:
    • Extract lib/SDL_ttf.dll into MSYS/mingw/bin
    • Extract include/SDL_ttf.h into MSYS/mingw/include/SDL
    • Extract SDL_net.lib into MSYS/mingw/lib

SDL_gfx

  • Get it from the author's page
  • Unpack it to HOME and go to the folder where it was unpacked
  • The build system is unable to build a shared lib, so it must be deactivated. Therefore, run this command (notice the --disable-shared):
./configure --prefix=/mingw --with-pic --with-gnu-ld --disable-shared \
--enable-static --disable-rpath --enable-nls --disable-debug
  • Edit all headers and replace the blurb about DLLINTERFACE (there should be 5 out of 6 headers to modify) from the macro by this single line:
#define DLLINTERFACE
  • Finally run :
make && make install

CURL

mv /mingw/bin/libcurl-4.dll /mingw/bin/
  • Edit /mingw/bin/curl-config and change prefix so that it points to /mingw
prefix=/mingw

Wormux (at last)

Fixing NLS

The m4 scripts are hardcoded to expect some symbols under win32 (_nl_expand_alias, _nl_msg_cat_cntr and stuff).Those were not present in gettext 0.13.1 libraries, as packaged with the SDK. gettext 0.14.5 provided on win32 gtk/gimp maintainer site don't have that problem (but have others). You have 2 possibilities:

  • Hack away such references (there are 3 test programs featuring them) in the configure script. To redo each time...
  • Edit /usr/share/aclocal/gettext.m4, and comment part of the test:
 return * gettext ("")$gt_expression_test_code /*+ _nl_msg_cat_cntr + *_nl_expand_alias ("")*/],

Configuration and compilation

  • Get the source (tarball, SVN, ...)
  • Unpack it to HOME
  • Run these commands:
./configure --enable-nls --disable-debug
make
  • Get some more help to compile Wormux source.
  • You can choose to either manually package files (beware not to strip Visual Studio dlls such as the SDL/iconv/intl/zlib ones) or run the following command:
make install

After a while, a NSIS exe installer will be produced in tools/win32_setup. You may have to modify tools/win32_setup/create_setup.sh to include the proper dlls.

  • To get the gmo files, needed for NSIS, change to "po" directory and run:
make update-gmo
  • Leave in the oven for 20 minutes untill the juice gets brownish

Enjoy

  • Launch the game to check it runs
  • Play a bit
  • Go back coding

CODE DAMN IT!