Development Environment:
Libraries:
SDL: SDL_image: SDL_mixer: SDL_ttf: |
Gettext:
FLTK:
libSVG-Cairo: SDL_net: |
MinGW/MSYS
Provides a Unix-like development environment on Windows.
These instructions were last updated: 16th March 2007
I rebuilt from scratch using the latest current version of MinGW/MSYS:
MSYS-1.0.10.exe (2808061) MinGW-5.1.3.exe (138705) binutils-2.16.91-20060119-1.tar.gz (7114497) directx-devel.tar.gz (65187) gcc-core-3.4.2-20040916-1.tar.gz (3515620) gcc-g++-3.4.2-20040916-1.tar.gz (4831138) mingw-runtime-3.11.tar.gz (426259) mingw32-make-3.81-1.tar.gz (243236) msysDTK-1.0.1.exe (10299560) nasm.exe (237568) opengl-devel.tar.gz (17803) w32api-3.8.tar.gz (1623353)with these manual updates:
gcc-core-3.4.5-20060117-1.tar.gz (3464344) gcc-g++-3.4.5-20060117-1.tar.gz (4710429) msys-autoconf-2.59.tar.bz2 (404192) msys-automake-1.8.2.tar.bz2 (311288) msys-libtool-1.5.tar.bz2 (421205)
To make the MSYS shell slightly easier to use, customise the file '/msys/1.0/msys.bat' to make the window bigger (120 x 60):
... start rxvt -backspacekey ... -geometry 120x60 -e /bin/sh --login -i ...create a directory 'C:\home' into which you should put this '.profile' file:
# points builds at their dependencies export set LIBRARY_PATH=/usr/local/bin:/usr/local/lib export set CPATH=/usr/local/include # change working directory to where the source lives cd "/d/ossdev"and this '.inputrc' file which makes the <HOME>, <END> and <DEL> keys work properly:
set completion-query-items 100 set completion-ignore-case on set show-all-if-ambiguous off set input-meta on set output-meta on set convert-meta off set bell-style none "\e[2~": paste-from-clipboard "\e[3~": delete-char "\e[5~": beginning-of-history "\e[6~": end-of-history "\e[7~": beginning-of-line "\e[8~": end-of-line
Set a Windows environment variable HOME to 'C:\home' using the System Properties, Advanced, Environment Variables panel.
SDL
Use these instructions to install and setup-up the MSYS/MinGW environment on your Win2K or WinXP machine. Make sure you setup OpenGL, DirectX and NASM support as explained.
Build it with:
$ ./configure $ make
Install it with:
$ make install
For convienience when running test programs build another version of libSDLmain by editing 'src/main/win32/SDL_win32_main.c' and adding:
#define NO_STDIO_REDIRECT
just before the first occurance of:
#ifndef NO_STDIO_REDIRECT
at about line 41. Run make again and then run:
cp build/libSDLmain.a /usr/local/lib/libSDLmain_console.a
Then copy the existing sdl-config file:
cp /usr/local/bin/sdl-config /usr/local/bin/sdl-config-console
and edit it to look like this:
... --libs) echo -L${exec_prefix}/lib -lmingw32 -lSDLmain_console -lSDL -lcomdlg32 -lgdi32 -mconsole ;; --static-libs) # --libs|--static-libs) echo -L${exec_prefix}/lib -lmingw32 -lSDLmain_console -lSDL -lcomdlg32 -lgdi32 -mconsole ;; ...
Test it with:
$ cd test $ SDL_CONFIG=/usr/local/bin/sdl-config-console ./configure
Build the tests with:
$ make
When run in the MSYS shell there is a problem with stdio flushing (I guess), so the text usually shows up at the end. It works fine in a 'Command Prompt' though, if you put a copy of 'SDL.dll' into the test directory.
The backend can be switched between GDI and DirectX using one of the following:
$ set SDL_VIDEODRIVER=windib $ set SDL_VIDEODRIVER=directx
The 'testvidinfo.exe' program is useful (although not very exciting!) when experimenting:
C:>set SDL_VIDEODRIVER=windib C:>testvidinfo Video driver: windib Current display: 1280x1024, 32 bits-per-pixel Red Mask = 0x00ff0000 Green Mask = 0x0000ff00 Blue Mask = 0x000000ff Fullscreen video modes: 1920x1440x32 1920x1200x32 1920x1080x32 1856x1392x32 1800x1440x32 1792x1344x32 1600x1200x32 1280x1024x32 1280x960x32 1280x768x32 1152x864x32 1024x768x32 800x600x32 640x480x32 640x400x32 512x384x32 400x300x32 320x240x32 320x200x32 A window manager is available C:>set SDL_VIDEODRIVER=directx C:>testvidinfo Video driver: directx Current display: 1280x1024, 32 bits-per-pixel Red Mask = 0x00ff0000 Green Mask = 0x0000ff00 Blue Mask = 0x000000ff Fullscreen video modes: 1920x1440x32 1920x1200x32 1920x1080x32 1856x1392x32 1800x1440x32 1792x1344x32 1600x1200x32 1280x1024x32 1280x960x32 1280x768x32 1152x864x32 1024x768x32 800x600x32 640x480x32 640x400x32 512x384x32 400x300x32 320x240x32 320x200x32 A window manager is available Hardware surfaces are available (256892K video memory) Copy blits between hardware surfaces are accelerated Colorkey blits between hardware surfaces are accelerated Copy blits from software surfaces to hardware surfaces are accelerated Colorkey blits from software surfaces to hardware surfaces are accelerated Color fills on hardware surfaces are accelerated
zlib
The provided 'win32/Makefile.gcc' doesn't work on MinGW, so use this Makefile.mingw.zlib. Make sure that you save it in the main directory, and rename it 'Makefile'. It is based on the supplied one, but the install part works correctly. I also tweaked the 'win32/zlib1.rc' file so that the version is consistent: zlib1.rc.
Build it with:
$ make
Test it with:
$ example zlib version 1.2.3 = 0x1230, compile flags = 0x55 uncompress(): hello, hello! gzread(): hello, hello! gzgets() after gzseek: hello! inflate(): hello, hello! large_inflate(): OK after inflateSync(): hello, hello! inflate with dictionary: hello, hello!
Install it with:
$ make install
libpng
The provided 'scripts/makefile.mingw' doesn't work properly. It doesn't use the shared 'zlib1.dll', doesn't use the 'scripts/pngw32.rc' resource file and the install step doesn't work. Use this modified version Makefile.mingw.libpng. Copy it into the main directory, renaming it as 'Makefile'.
Build it with:
$ make
Test it with:
$ pngtest Testing libpng version 1.2.16 with zlib version 1.2.3 libpng version 1.2.16 - January 31, 2007 Copyright (c) 1998-2007 Glenn Randers-Pehrson Copyright (c) 1996-1997 Andreas Dilger Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. library (10216): libpng version 1.2.16 - January 31, 2007 (header) pngtest (10216): libpng version 1.2.16 - January 31, 2007 (header) png_sizeof(png_struct)=616, png_sizeof(png_info)=288 Testing pngtest.png: Pass 0: rwrwrwrwrwrwrwrwrw Pass 1: rwrwrwrwrwrwrwrwrw Pass 2: rwrwrwrwrwrwrwrw Pass 3: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw Pass 4: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw Pass 5: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw rwrwrwrw Pass 6: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw rwrwrwrwrw PASS (9782 zero samples) Filter 0 was used 21 times Filter 1 was used 15 times Filter 2 was used 52 times Filter 3 was used 10 times Filter 4 was used 33 times tIME = 7 Jun 1996 17:58:08 +0000 libpng passes test
Install it with:
$ make install
libjpeg
The 'configure' script won't build the shared (.dll) version of the library because the 'ltconfig' and 'ltmain.sh' scripts are outdated. Use these replacements ltconfig.mingw.jpeg6b and ltmain.sh.mingw.jpeg6b from 'SDL_net-1.2.5'. Copy them into the main directory making sure that you rename them. Also, in order for the .dll to export the correct functions, a change to the 'jmorecfg.h' header file is required. Use this one: jmorecfg.h.mingw.jpeg6b. Copy this into the main directory making sure that you rename it. The built-in tests and the install process don't work properly either, I bodged the makefile template makefile.cfg.mingw.jpeg6b (Update!) to make these work. Copy this into the main directory making sure that you rename it, and then run configure:
$ ./configure --prefix=/usr/local --enable-shared --enable-static
Copy and rename this updated libtool file (from SDL) into the main directory (Update!). Then build using this:
$ make CFLAGS="-O2 -DBUILDING_JPEG_DLL"
Test it with:
$ make check rm -f testout* .libs/djpeg -dct int -ppm -outfile testout.ppm ./testorig.jpg .libs/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ./testorig.jpg .libs/cjpeg -dct int -outfile testout.jpg ./testimg.ppm .libs/djpeg -dct int -ppm -outfile testoutp.ppm ./testprog.jpg .libs/cjpeg -dct int -progressive -opt -outfile testoutp.jpg ./testimg.ppm .libs/jpegtran -outfile testoutt.jpg ./testprog.jpg cmp ./testimg.ppm testout.ppm cmp ./testimg.bmp testout.bmp cmp ./testimg.jpg testout.jpg cmp ./testimg.ppm testoutp.ppm cmp ./testimgp.jpg testoutp.jpg cmp ./testorig.jpg testoutt.jpg
Install it with:
$ mkdir /usr/local/man/man1 # missing 'man1' directory - maybe install should create it $ make install
libtiff
More or less straight-forward, but in order to get libtiff to use the shared 'zlib1.dll' use this libtiff-configure.patch on 'configure' like this:
$ cd tiff-3.8.2/ $ patch -p0 configure < ../libtiff-configure.patchand then build and install it:
$ ./configure --prefix=/usr/local $ make $ make install
To get the tests to work do this:
$ make checkwhich (eventually) says that the tests failed, followed by:
$ cd test $ cp .libs/*.exe . $ cd .. $ make check ... make[1]: Entering directory `/c/HOME/tiff-3.8.2/test' PASS: ascii_tag.exe PASS: long_tag.exe PASS: short_tag.exe PASS: strip_rw.exe ================== All 4 tests passed ================== make[1]: Leaving directory `/c/HOME/tiff-3.8.2/test' ...
SDL_image
To make the dynamic loading of libpng and libtiff images work (jpeg works by default), edit 'configure' and make the following changes:
*-*-cygwin* | *-*-mingw32*) # png_lib='libpng13.dll' png_lib='libpng12.dll' ;;
and
*-*-cygwin* | *-*-mingw32*) # tif_lib='libtiff.dll' tif_lib='libtiff-3.dll' ;;
Then configure it with:
$ SDL_CONFIG=/usr/local/bin/sdl-config-console ./configure
Near the end you should see something like this:
-- dynamic libtiff -> libtiff-3.dll -- dynamic libjpeg -> jpeg.dll -- dynamic libpng -> libpng12.dll
confirming that it will look for DLLs with the correct name. Build it with:
$ make
Test it in MSYS with:
$ showimage ../jpeg-6b/testimg.bmp $ showimage ../jpeg-6b/testimg.jpg $ showimage ../jpeg-6b/testimg.ppm $ showimage ../libpng-1.2.16/pngbar.png $ showimage ../libpng-1.2.16/pngnow.png $ showimage ../libpng-1.2.16/pngtest.png
I found some other image types like '.tga' and '.gif' lurking on my machine, but I downloaded these test tif images to check libtiff.
In a command prompt, try this:
$ cd .libs $ showimage
But you'll need to copy 'SDL.dll' into '.libs/', and if you want jpeg, png and tiff loading to work you'll also need to copy 'jpeg.dll', 'libpng12.dll', 'libtiff-3.dll' and 'zlib1.dll' in there as well.
Don't forget to install it:
$ make install
libogg
Build using:
$ ./configure $ make
Test it with:
$ cd src $ test_bitwise.exe Small preclipped packing (LSb): ok. Null bit call (LSb): ok. Large preclipped packing (LSb): ok. 32 bit preclipped packing (LSb): ok. Small unclipped packing (LSb): ok. Large unclipped packing (LSb): ok. Single bit unclipped packing (LSb): ok. Testing read past end (LSb): ok. Small preclipped packing (MSb): ok. Null bit call (MSb): ok. Large preclipped packing (MSb): ok. 32 bit preclipped packing (MSb): ok. Small unclipped packing (MSb): ok. Large unclipped packing (MSb): ok. Single bit unclipped packing (MSb): ok. Testing read past end (MSb): ok. $ test_framing.exe testing single page encoding... 0, (0), granule:0 ok. testing basic page encoding... 0, (0), granule:0 1, (1), granule:6151 ok. testing basic nil packets... 0, (0), granule:0 1, (1), granule:10247 ok. testing initial-packet lacing > 4k... 0, (0), granule:0 1, (1), granule:2055 ok. testing single packet page span... 0, (0), granule:0 1, (1), 2, (2), granule:3079 ok. testing max packet segments... 0, (0), granule:0 1, (1), granule:261127 2, (2), granule:262151 ok. testing very large packets... 0, (0), granule:0 1, (1), granule:1031 2, (2), 3, (3), granule:4103 ok. testing continuation resync in very large packets... 0, 1, 2, (2), 3, (3), granule:4103 ok. testing zero data page (1 nil packet)... 0, (0), granule:0 1, (1), granule:1031 2, (2), granule:2055 ok. Testing loss of pages... ok. Testing loss of pages (rollback required)... ok. Testing sync on partial inputs... ok. Testing sync on 1+partial inputs... ok. Testing search for capture... ok. Testing recapture... ok. $ cd ..
Install it with:
$ make install
libvorbis
Slight bug in 'lib/Makefile.am' involving linking to libogg:
... libvorbisfile_la_LIBADD = libvorbis.la @OGG_LIBS@ ... libvorbisenc_la_LIBADD = libvorbis.la @OGG_LIBS@
Then run automake in the main directory to update 'lib/Makefile.in':
$ automakeUnfortunately, I got these errors:
configure.in:14: error: Autoconf version 2.58 or higher is required aclocal.m4:6362: AM_INIT_AUTOMAKE is expanded from... configure.in:14: the top level autom4te: /bin/m4 failed with exit status: 1 configure.in: `AM_INIT_AUTOMAKE' must be used automake: your implementation of AM_INIT_AUTOMAKE comes from an automake: old Automake version. You should recreate aclocal.m4 automake: with aclocal and run automake again. configure.in: required file `./mkinstalldirs' not found automake: no `Makefile.am' found or specifiedand checked my autotool versions:
$ autoconf --version autoconf (GNU Autoconf) 2.56 Written by David J. MacKenzie and Akim Demaille. ... $ $ automake --version automake (GNU automake) 1.7.1 Written by Tom Tromey <tromey@redhat.com>. ... $ $ libtool --version ltmain.sh (GNU libtool) 1.4e (1.1162 2002/11/22 22:36:25) ...At this point, I downloaded and installed these autotool updates: used the above commands to make sure that the update had worked, and then tried again:
$ aclocal && automake
This time it worked. Build and install using:
$ ./configure $ make $ make install
smpeg
Checkout the current version from cvs using the instructions on the above page. I use a Windows native version of cvs in a command-prompt.
Configure it with:
$ ./autogen.sh $ SDL_CONFIG=/usr/local/bin/sdl-config-console ./configure --disable-opengl-player
Edit the Makefile to persuade it to build the DLL:
... CXXLD = $(CXX) -no-undefined ...
Build it with:
$ make
Test it with:
$ plaympeg ../Media/butterfly.mpg $ plaympeg ../Media/lake.mpg $ plaympeg ../Media/MIX2.2.mpg $ plaympeg --novideo ../Media/piano.mp3 $ plaympeg --novideo ../Media/roadhouse_blues.mp3
Install it with:
$ make install
SDL_mixer
There is a quirk in this particular 'configure' that causes it to fail right near the beginning, if you have MSVC-related environment variables set:
$ ./configure ... checking for C compiler default output file name... configure: error: C compiler cannot create executables See `config.log' for more details.It is possible to work-round it by setting INCLUDE either globally or just for that command:
$ export INCLUDE="" or $ INCLUDE="" ./configure
To make the dynamic linking with 'libvorbisfile-3.dll' work, edit the 'ogg_lib' entry in 'configure':
*-*-cygwin* | *-*-mingw32*) # ogg_lib='vorbisfile.dll' ogg_lib='libvorbisfile-3.dll' ;; *)
Then configure and build using:
$ INCLUDE="" SDL_CONFIG=/usr/local/bin/sdl-config-console ./configure $ make
Test it with:
$ cd build $ playmus ../../Media/wonrace1-jt.it $ playmus ../../Media/gtrsolo2.mid $ playmus ../../Media/Chipgene.mod $ playmus ../../Media/track1.mp3 $ playmus ../../Media/keepgoin.ogg $ playmus ../../Media/bizzarre-funfair.s3m $ playmus ../../Media/wahoo.wav $ cd ..
Install it with:
$ make install
freetype
Freetype-2.2.1 has a bug when solid-rendering strings with spaces in. I'm still using freetype-2.1.10. To build a DLL you'll need to use one of these patches freetype-2.1.x-make-dll.patch or freetype-2.2.x-make-dll.patch applied like this:
$ patch -p1 < ../freetype-2.1.x-make-dll.patch or $ patch -p1 < ../freetype-2.2.x-make-dll.patch
Build and install with:
$ ./configure && make $ make install
SDL_ttf
Needs patching when used with freetype-2.2.x:
$ patch -p0 SDL_ttf.c < ../SDL_ttf-2.0.7-noftinternals.patch patching file `SDL_ttf.c' Hunk #2 succeeded at 271 (offset 3 lines).
Build it with:
$ SDL_CONFIG=/usr/local/bin/sdl-config-console ./configure $ make
Test it with:
$ showfont c:/windows/fonts/arial.ttf 32 "Hello world." $ showfont -solid c:/windows/fonts/arial.ttf 32 "Hello world." $ glfont c:/windows/fonts/arial.ttf 32 "Hello world."
Install it with:
$ make install
libiconv
If gettext isn't already installed (it isn't if you start from scratch) you need to compile/install libiconv twice, the second time after compiling/installing gettext (which uses libiconv).
To build a DLL containing version information, use this patch, and apply like this:
$ patch -p0 < ../libiconv-use-rc.patch
Build and install it with:
$ ./configure $ make $ make install
Test it with:
$ make check
which takes a while to run.
gettext
There are some symbol clashes with various #defines in "winnt.h". Use this patch to work round them and apply it like this:
$ patch -p0 < ../gettext-symbol-clash.patch
Build and install it with:
$ ./configure $ make $ make install
This particular library takes a long time to build and install especially under MinGW/MSYS.
Now that that's done it's time to rebuild libiconv.
$ cd libiconv-1.11 $ make clean && make distclean $ ./configure $ make $ make install
fltk
Build and install it with:
$ ./configure $ make $ make install
The gcc-3.4.2 compiler was responsile for a horrible crash when running "fluid.exe" to process the '.fl' files when building the tests. Upgrading to gcc-3.4.5 fixed this.
SVG Support
I used instructions and patches by Toyama Shin-ichi from here to get started with the SVG support. These are my (similar) instructions.
xmllib2
To make it use zlib.dll use this patch and apply it like this:
$ patch -p0 < ../libxml2-use-zdll.patch $ autoconf
Build with:
$ ./configure $ makeIt takes quite a while to build, there are several warnings about missing aclocal-1.9 and it may well run configure again.
Test with:
$ make testsI got huge amounts of output from this, and it takes quite a while to run, especially the API regression tests. Eventually the "Relax-NG regression tests" caused segfaults in "sh.exe" and at that point I abandoned the tests.
Install with:
$ make install
libsvg
libsvg Home Page [Broken Link]
cvs -d :pserver:anoncvs@cvs.cairographics.org:/cvs/cairo login cvs -d :pserver:anoncvs@cvs.cairographics.org:/cvs/cairo co libsvgI use a Windows native version of cvs in a command-prompt.
Needs patching for MinGW/MSYS:
$ patch -p1 < libsvg-mingw.patch
Configure with:
$ ./autogen.sh
Copy 'libtool' from the 'SDL-1.2.11' directory into the 'libsvg' directory (this was the only way I could find to get a DLL built) and then build and install with:
$ make $ make install
cairo
Needs patching for MinGW/MSYS:
$ patch -p0 < ../cairo-1.4.2-zlib-png-dll.patch $ autoconf
Configure, build and install with:
$ ./configure $ make $ make install
libsvg-cairo
I got the following instructions for checking out the current version from cvs using the above page, but the link now seems to be broken. Press enter when asked for a password:cvs -d :pserver:anoncvs@cvs.cairographics.org:/cvs/cairo login cvs -d :pserver:anoncvs@cvs.cairographics.org:/cvs/cairo co libsvg-cairoI use a Windows native version of cvs in a command-prompt.
Needs patching for MinGW/MSYS:
$ patch -p1 < ../libsvg-cairo-mingw.patch $ ./autogen.sh --disable-pango
Copy 'libtool' from the 'SDL-1.2.11' directory into the 'libsvg-cairo' directory (this was the only way I could find to get a DLL built) and then build and install with:
$ make $ make install
Tux Paint (finally!)
With all of the above libraries built and installed, building Tux Paint is straight-forward. There are two versions (or targets) that can be built, one runs inside the MSYS environment and isn't suitable for redistribution or bundling into an installer, whilst the other creates a directory "tuxpaint/visualc/bdist" containing everything needed.
The current cvs version of Tux Paint needs a number of changes to the Makefile for it to work cleanly - I'll make a patch later.
MSYS-only target (useful for development/testing):
$ make win32 $ make install-win32 $ tuxpaint
Redistributable binary target:
$ make bdist-win32
Unfortunately, there was a problem using these libraries with Tux Paint which caused the program to fail to start. I eventually traced this, using a small test program, to a problem with libjpeg of all things! I've updated the libjpeg instructions to fix this problem.
Additional Libraries (not required for Tux Paint)
GUIlib
Needs patching to compile with MinGW/MSYS. Use this patch
$ patch -p1 < ../GUIlib-mingw.patch
Then there's a problem with the 'missing' file being to old. Run these commands:
$ aclocal $ touch NEWS README AUTHORS ChangeLog $ rm missing $ automake --add-missing $ ./configureBuild with:
$ makeTest it with:
$ ./hello $ ./hello_C $ ./keyboard $ ./okay "Hello GUILib" [Click on the yellow box twice to exit the 'hello' test programs]Install with:
$ make install
SDL_net
Needs patching to compile with MinGW/MSYS. Use this patch
$ patch -p1 < ../SDL_net-mingw.patch
Configure, build and install with:
$ ./configure $ make $ make install