17 June 2004
============

This readme is for individuals who wish to build SDL based games, in
particular Tux Paint, using MS Visual C/C++ 6.0 SP4+ on Windows, using the 
source tree under this file.

All release libraries/DLLs are built to use MSVCRT.DLL
All debug   libraries/DLLs are built to use MSVCRTD.DLL
[Multithreaded DLL]

If you get problems with warnings like:

LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other
libs; use /NODEFAULTLIB:library

then your application and/or the libraries you are linking to are built as
a mixture of release/debug/single-threaded/multi-threaded.

I found "Dependency Walker" (http://www.dependencywalker.com/) to be 
invaluable for getting to the bottom of these kinds of problems.

Building the libraries
======================

With luck you will be able to build all the libraries by sparking up a shell,
changing into 'oss-libs-win32\' and running 'build-all.bat'.

It assumes that you have already run 'Vcvars32.bat'. This a batch-file
that comes with MSVC and sets up lots of environment variables. Open up a 
DOS-box, command-prompt, shell, whatever and type 'set'. You should see 
something like this:

...
MSDEVDIR=C:\PROGRA~1\MICROS~2\COMMON\msdev98
MSVCDIR=C:\PROGRA~1\MICROS~2\VC98
INCLUDE=C:\PROGRA~1\MICROS~2\VC98\ATL\INCLUDE.........
LIB=C:\PROGRA~1\MICROS~2\VC98\LIB;C:\PROGRA~1.........
...

If not, you need to find 'Vcvars32.bat' usually somewhere like this:

C:\Program Files\Microsoft Visual Studio\VC98\Bin\

and run it. On Win98, I have it in my "autoexec.bat" file like this:

call C:\Progra~1\Micros~2\VC98\Bin\Vcvars32.bat


Building library by library - manually (try above procedure first)
==================================================================

libiconv-1.7-w32 (http://gettext.sourceforge.net/)
==================================================
[I've tinkered with the makefiles, and fixed a bug]
This is the black-sheep of the family, and *needs* building from the command
line. 

cd into 'libiconv-1.7-w32\' and run the batch file 'msvc-build.bat' to build 
the release and debug versions. It executes these commands:

nmake -f Makefile.msvc DEBUG=0 DLL=1 MFLAGS=-MD
nmake -f Makefile.msvc distclean
nmake -f Makefile.msvc DEBUG=1 DLL=1 MFLAGS=-MD

Don't worry about errors from the 'distclean' step.

You should find that the following files have been created:

    libiconv-1.7-w32\include\iconv.h   (4170)      - header file
    libiconv-1.7-w32\lib\iconv.dll     (897,272)   - release DLL
    libiconv-1.7-w32\lib\iconv.lib     (2650)      - release .lib file
    libiconv-1.7-w32\libd\iconv.dll    (1,087,612) - debug DLL
    libiconv-1.7-w32\libd\iconv.lib    (2650)      - debug .lib file

This pattern of output directories will be repeated for the other libs.


gettext-0.10.40 (http://gettext.sourceforge.net/)
=================================================
[Added export g_win32_getlocale() so that the current locale can be obtained]

The Visual C/C++ 6.0 project file is 'gettext-0.10.40\VisualC\libintl.dsw'.
Open it with Visual Studio and make sure that 'msgfmt' is set as the active 
project. Select "Batch Build..." from the "Build" menu, check all the boxes,
and hit the "Rebuild All" button.

You should find that the following files have been created:

    gettext-0.10.40\include\libintl.h   (4,397)    - header file
    gettext-0.10.40\lib\libintl.dll     (32,768)   - release DLL
    gettext-0.10.40\lib\libintl.lib     (9,822)    - release .lib file
    gettext-0.10.40\lib\msgfmt.exe      (36,864)   - release utility
    gettext-0.10.40\libd\libintl.dll    (57,429)   - debug DLL
    gettext-0.10.40\libd\libintl.lib    (9,822)    - debug .lib file
    gettext-0.10.40\libd\msgfmt.exe     (94,299)   - debug utility


freetype-2.1.4 (http://www.freetype.org/)
=========================================
The Visual C/C++ 6.0 project file is 
'freetype-2.1.4\builds\win32\visualc\freetype.dsw'. Open it with Visual Studio.
Select "Batch Build..." from the "Build" menu, check the boxes:
"freetype - win32 Debug Multithreaded", 
"freetype - win32 Release Multithreaded" and 
"Selection Only" and hit the "Rebuild All" button.

You should find that the following files have been created:

    freetype-2.1.4\include\ft2build.h and the others
    freetype-2.1.4\lib\freetype.lib     (722,436)  - release .lib file
    freetype-2.1.4\libd\freetype.lib    (1,755,272)- debug .lib file

zlib-1.1.4 (http://www.gzip.org/zlib/)
======================================
The Visual C/C++ 6.0 project file is "zlib\visualc\zlib.dsw". Open it with
Visual Studio. Select "Batch Build..." and check the boxes 
"zlib - Win32 Release",
"zlib - Win32 Debug" and
"Selection Only" and hit the "Rebuild All" button.

You should find that the following files have been created:

    zlib\include\zlib.h and the others
    zlib\lib\zlib.dll                   (53,248)   - release DLL
    zlib\lib\zlib.lib                   (8,868)    - release .lib
    zlib\libd\zlib.dll                  (168,007)  - debug DLL
    zlib\libd\zlib.lib                  (8,868)    - debug .lib

jpeg-6b (http://www.ijg.org/)
=============================
The Visual C/C++ 6.0 project file is "jpeg-6b\visualc\jpeg.dsw". Open it with
Visual Studio. Select "Batch Build..." and check the boxes 
"jpeg - Win32 Release",
"jpeg - Win32 Debug" and
"Selection Only" and hit the "Rebuild All" button.

You should find that the following files have been created:

    jpeg-6b\include\jpeglib.h and the others
    jpeg-6b\lib\jpeg.dll                (110,592)  - release DLL
    jpeg-6b\lib\jpeg.lib                (23,996)   - release .lib
    jpeg-6b\libd\jpeg.dll               (294,986)  - debug DLL
    jpeg-6b\libd\jpeg.lib               (23,996)   - debug .lib

libpng-1.0 (http://www.libpng.org/pub/png/libpng.html)
======================================================
The Visual C/C++ 6.0 project file is "libpng-1.0\visualc\libpng1.dsw". Open it 
with Visual Studio. Select "Batch Build..." and check the boxes 
"libpng1 - Win32 Release",
"libpng1 - Win32 Debug" and hit the "Build" button.

You should find that the following files have been created:

    libpng-1.0\include\png.h and the others
    libpng-1.0\lib\png.dll              (98,304)   - release DLL
    libpng-1.0\lib\png.lib              (39,206)   - release .lib
    libpng-1.0\libd\png.dll             (299,088)  - debug DLL
    libpng-1.0\libd\png.lib             (39,206)   - debug .lib

GNU-getopt ()
=============
The Visual C/C++ 6.0 project file is "GNU-getopt\getopt.dsw". Open it 
with Visual Studio. Select "Batch Build..." and check the boxes 
"getopt - Win32 Release",
"getopt - Win32 Debug" and hit the "Build" button.

You should find that the following files have been created:

    GNU-getopt\getopt.h
    GNU-getopt\Release\getopt.lib       (8,440)
    GNU-getopt\Debug\getopt.lib         (10,958)

Ogg-Vorbis (http://www.vorbis.com/download.psp)
===============================================
The Visual C/C++ 6.0 project file is "xiph\ogg\win32\ogg_static.dsw". Open it 
with Visual Studio. Select "Batch Build..." and check the boxes 
"ogg_static - Win32 Release",
"ogg_static - Win32 Debug" and hit the "Build" button.

The Visual C/C++ 6.0 project file is "xiph\vorbis\win32\vorbis_static.dsw". 
Open it with Visual Studio. Select "Batch Build..." and check the boxes 
"vorbis_static - Win32 Release",
"vorbis_static - Win32 Debug" and hit the "Build" button.

The Visual C/C++ 6.0 project file is "xiph\vorbis\win32\vorbisfile_static.dsw".
Open it with Visual Studio. Select "Batch Build..." and check the boxes 
"vorbisfile_static - Win32 Release",
"vorbisfile_static - Win32 Debug" and hit the "Build" button.

You should find that the following files have been created:

    xiph\include\ogg\ogg.h
    xiph\include\ogg\os_types.h
    xiph\include\vorbis\codec.h
    xiph\include\vorbis\vorbisenc.h
    xiph\include\vorbis\vorbisfile.h
    xiph\lib\ogg_static.lib             (20,468)
    xiph\lib\vorbis_static.lib          (205,430)
    xiph\lib\vorbisfile_static.lib      (22,884)
    xiph\libd\ogg_static_d.lib          (45,650)
    xiph\libd\vorbis_static_d.lib       (445,896)
    xiph\libd\vorbisfile_static_d.lib   (53,176)

SDL-1.2.7 (http://www.libsdl.org/)
==================================
The Visual C/C++ 6.0 project file is "sdl-1.2\VisualC\sdl.dsw". Open it 
with Visual Studio. Select "Batch Build..." and check the boxes 
"SDL - Win32 Release",
"SDL - Win32 Debug",
"SDLmain - Win32 Release",
"SDLmain - Win32 Debug" and hit the "Build" button.

You should find that the following files have been created:

    sdl-1.2\include\lots-of-header-files
    sdl-1.2\lib\SDL.dll                 (196,608)
    sdl-1.2\lib\SDL.lib                 (37,260)
    sdl-1.2\lib\SDLmain.lib             (6,348)
    sdl-1.2\libd\SDL.dll                (602,189)
    sdl-1.2\libd\SDL.lib                (37,260)
    sdl-1.2\libd\SDLmain.lib            (20,226)

SDL_image (http://www.libsdl.org/)
==================================
The Visual C/C++ 6.0 project file is "sdl_image-1.2\VisualC\sdl_image.dsw".
Open it with Visual Studio. Select "Batch Build..." and check the boxes 
"sdl_image - Win32 Release",
"sdl_image - Win32 Debug",

You should find that the following files have been created:

    sdl_image-1.2\include\sdl_image.h
    sdl_image-1.2\lib\sdl_image.dll     (32,768)
    sdl_image-1.2\lib\sdl_image.lib     (6,792)
    sdl_image-1.2\libd\sdl_image.dll    (118,869)
    sdl_image-1.2\libd\sdl_image.lib    (6,792)

SMPEG-0.4 (http://icculus.org/smpeg/)
=====================================
The Visual C/C++ 6.0 project file is "smpeg-0.4\VisualC\smpeg.dsw".
Open it with Visual Studio. Select "Batch Build..." and check the boxes 
"smpeg - Win32 Release",
"smpeg - Win32 Debug",

You should find that the following files have been created:

    smpeg-0.4\include\smpeg.h
    smpeg-0.4\include\MPEGfilter.h
    smpeg-0.4\lib\smpeg.dll             (184,320)
    smpeg-0.4\lib\smpeg.lib             (8,292)
    smpeg-0.4\libd\smpeg.dll            (381,005)
    smpeg-0.4\libd\smpeg.lib            (8,292)

SDL_mixer (http://www.libsdl.org/)
==================================
The Visual C/C++ 6.0 project file is "sdl_mixer-1.2\VisualC\sdl_mixer.dsw".
Open it with Visual Studio. Select "Batch Build..." and check the boxes 
"sdl_mixer - Win32 Release",
"sdl_mixer - Win32 Debug",

You should find that the following files have been created:

    sdl_mixer-1.2\include\SDL_mixer.h
    sdl_mixer-1.2\lib\SDL_mixer.dll     (245,760)
    sdl_mixer-1.2\lib\SDL_mixer.lib     (14,860)
    sdl_mixer-1.2\libd\SDL_mixer.dll    (663,637)
    sdl_mixer-1.2\libd\SDL_mixer.lib    (14,860)

SDL_ttf (http://www.libsdl.org/)
================================
The Visual C/C++ 6.0 project file is "sdl_ttf-2.0.7\VisualC\sdl_ttf.dsw".
Open it with Visual Studio. Select "Batch Build..." and check the boxes 
"sdl_ttf - Win32 Release",
"sdl_ttf - Win32 Debug",

You should find that the following files have been created:

    sdl_ttf-2.0.7\include\SDL_ttf.h
    sdl_ttf-2.0.7\lib\SDL_ttf.dll       (217,088)
    sdl_ttf-2.0.7\lib\SDL_ttf.lib       (9,610)
    sdl_ttf-2.0.7\lib\SDL_ttf.dll       (520,275)
    sdl_ttf-2.0.7\lib\SDL_ttf.lib       (9,610)

Finishing Off
=============
I then manually moved all of the above mentioned output files into a simple 
folder heirarchy like this:

    include\    -   all header files
    lib\        -   DLLs that use MSVCRT.DLL, and LIB files
    libd\       -   DLLs that use MSVCRTD.DLL, and LIB files

An SDL project e.g. Tux Paint, can now just refer to these folders for all
of its header/DLL/LIB file needs.

Good Luck!

John Popplewell
john@johnnypops.demon.co.uk

