Welcome to the Silverwing's Lair



Building SDL-INSTEAD for Windows 95 and Pentium CPU

There are a number of difficulties with this:

  1. VC Runtime 8.0 used in existing builds of some dependencies is not compatible with Windows 95(requires Windows 98 at least).
  2. Most of the components are built with i686 instruction set, which is only available starting with Pentium Pro.

This article may be updated later if I find ways to simplify/improve certain steps or for newer mingw-w64 versions. Please email me if you find any errors or have any suggestions.

1. Prepare standard library

As of mingw-w64 10.0 on Debian 12, CRT is built with i686 architecture. This means that we need a custom one. I put the information about that into a separate article: Using mingw-w64 with Custom CRT.

I will be using crt_prefix in this article as a substitute to your CRT installation prefix.

2. Compile dependencies

I only list dependencies that need to be rebuilt. You can download all the libraries from INSTEAD-9x package here: Download INSTEAD-9x.

You'll need these environment variables for all of below:

export CC="i686-w64-mingw32-gcc -static-libgcc"
export CXX="i686-w64-mingw32-g++ -static-libgcc"
export CFLAGS="-O2 -march=i486 -Bcrt_prefix/lib"
export CPPFLAGS="-O2 -march=i486 -Bcrt_prefix/lib"
export CXXFLAGS="${CPPFLAGS} -static-libstdc++"

If you omit -static-libgcc or -static-libstdc++ parameter, the build will require extra dlls to work.

2.1. SDL

You will need SDL 1.2.15. Download SDL-1.2.15.

Configure and make:

./configure --build=amd64-linux\
    --host=i686-w64-mingw32\
    --prefix=sdl_prefix
make
make install

Setting sdl_prefix and make install steps are required for building SDL_* libraries.

2.2. iconv

I used libiconv-1.18 with these commands:

./configure --host=i686-w64-mingw32\
    --prefix=iconv_prefix
make
make install

2.3. zlib

I used zlib 1.2.3. Should be possible to use the latest available version.

./configure --build=amd64-linux\
    --host=i686-w64-mingw32\
    --prefix=zlib_prefix
make

Library will be built in the same directory, and you can pass it to dependencies directly (Referenced as zlib_path further)

2.3. libpng

I used libpng 15. Should be possible to use the latest available version. This one requires some extra steps.

  1. Copy scripts/makefile.linux to makefile.linux.

  2. Edit the file. You'll need to set some variables to other values. Replace existing declarations for following variables with provided ones:
    LIBSO=$(LIBNAME).dll
    LIBSOMAJ=$(LIBNAME)-$(PNGMAJ).dll
    OLDSO=libpng.dll
    # These will be a bit lower in the file
    AR_RC=i686-w64-mingw32-ar rc
    CC=i686-w64-mingw32-gcc -static-libgcc
    RANLIB=i686-w64-mingw32-ranlib
    ZLIBLIB=zlib_path
    ZLIBINC=zlib_path
    
  3. Replace all occurences of -lz with -lzdll.

  4. make the library.

Library will be built in the same directory, and you can pass it to dependencies directly (Referenced as png_path further).

2.4. freetype

I used freetype 2.6.5. You can safely use later versions, but 2.13.3 has issues with loading raster windows fonts, so I decided to use the version I know is working.

I decided to disable some of dependencies, since they are only needed for special cases.

./configure --build=amd64-linux\
    --host=i686-w64-mingw32 \
    --with-harfbuzz=no\
    --with-zlib=yes\
    --with-bzip2=no\
    --with-png=yes \
    --prefix=freetype_prefix \
    ZLIB_CFLAGS="-Izlib_path" \
    ZLIB_LIBS="-Lzlib_path -lzdll" \
    LIBPNG_CFLAGS="-Ipng_path" \
    LIBPNG_LIBS="-Lpng_path -lpng15-15"
make
make install

Don't forget to correct png library name if you have used a different version.

2.5. libjpeg

I used jpeg-8d.

./configure --host=i686-w64-mingw32\
    --prefix=libjpeg_prefix
make
make install

2.6. libtiff

I used tiff-4.7.0. Later versions should work as well.

./configure --host=i686-w64-mingw32\
    --prefix=libtiff_prefix
make
make install

2.7. libwebp

I used libwebp-1.5.0. Later versions should work as well.

Threading will have to be disabled, since it uses some modern APIs, not supported on classic Windows versions.

export CFLAGS="${CFLAGS} -Izlib_path"
export CXXFLAGS="${CFLAGS} -static-libstdc++"
export INCLUDE_PATH="zlib_path:$INCLUDE_PATH"
./configure --build=amd64-linux\
    --host=i686-w64-mingw32\
    --prefix=libwebp_prefix\
    --disable-threading
make

2.8. SDL_image

SDL_image-1.2.12 is used.

You'll need to specify all of the image format libraries, as well as zlib paths for SDL_image to build properly.

export CFLAGS="${CFLAGS} -Izlib_path"
export CPPFLAGS="-Ipng_path -Ilibjpeg_prefix/include -Ilibtiff_prefix/include -Ilibwebp_prefix/include -Izlib_path ${CLAGS}"
export CXXFLAGS="${CFLAGS} -static-libstdc++"
export INCLUDE_PATH="zlib_path:$INCLUDE_PATH"
export LDFLAGS="-Lpng_path -Llibjpeg_prefix/lib -Llibtiff_prefix/lib -Llibwebp_prefix/lib -Lzlib_path"
./configure --build=amd64-linux\
    --host=i686-w64-mingw32\
    --prefix=sdl_image_prefix\
    --with-sdl-prefix=sdl_prefix
make

2.9. SDL_ttf

SDL_ttf-2.0.11 is used.

You'll need to specify freetype, zlib and iconv2.

export CFLAGS="${CFLAGS} -Izlib_path"
export CPPFLAGS="-Iiconv_prefix/include -Isdl_prefix ${CLAGS}"
export CXXFLAGS="${CFLAGS} -static-libstdc++"
export INCLUDE_PATH="zlib_path:$INCLUDE_PATH"
export LDFLAGS="-Lsdl_prefix/lib -Liconv_prefix -liconv2 -with-freetype-prefix=freetype_prefix"
./configure --build=amd64-linux\
    --host=i686-w64-mingw32\
    --prefix=sdl_ttf_prefix\
    --with-sdl-prefix=sdl_prefix
make

2.10. Other libraries

I did not rebuild any of the audio libraries, since they seem to work fine. You should be able to recompile them in a similar way.

3. Compiling INSTEAD

There are no plans of merging SDL1 support into mainline INSTEAD. You can get the source code here: INSTEAD-9x Source Code.

  1. Copy or symlink Rules.mingw.sdl1 to Rules.make
  2. Build the executable by running CFLAGS="-O2 -Bcrt_prefix/lib -march=i486" make -f Makefile.mingw.sdl1 all. In CFLAGS you need to specify architecture and custom CRT if you need i486/Pentium support.