Add build instructions for Win9x

This commit is contained in:
Xavier Del Campo Romero 2022-02-07 02:15:21 +01:00
parent 410ad52640
commit 91f80f9a2f
1 changed files with 106 additions and 0 deletions

106
doc/BUILD-win9x.md Normal file
View File

@ -0,0 +1,106 @@
# Cross-compilation for Win9x
Creating a toolchain targetting `i386-mingw32` is not usually possible
with the distribution-provided packages. This documentation describes
which versions are known to work so far, as well as detailed
configuration scripts.
The following documentation assumes the installation prefix
`$HOME/i386-mingw32` for the GNU toolchain. However, feel free to
change this value, if required.
Some specific library versions might be hard to find, so download links
are provided.
## Environment variables
Since it is desirable to avoid messing with system-level libraries,
when building for Win9x, `rts` will look for dependencies by inspecting
the following environment variables:
- `SDL_PATH`
- `SDL_TTF_PATH`
- `FREETYPE_PATH`
- `SDL_MIXER_PATH`
Also, the directory containing the GNU toolchain binaries (which
should be located at `$HOME/i386-mingw32/bin` by default) must be added
to the `PATH` variable.
## gcc
From own experience, modern versions of `gcc` cannot be used to compile
a cross-compiler for Win9x. Instead, a *much* older version is required.
So far, `gcc-3.4.5` is the latest known version to work.
### Known issues
- Take into account only C99 is supported by `gcc-3.4.5`.
- `gcc-3.4.5` complains about the use of `-ffunction-sections` and
`-fdata-sections`.
```sh
../gcc-3.4.5-20060117-2/configure --disable-nls --disable-rpath \
--disable-win32-registry --enable-languages=c --enable-sjlj-exceptions \
--enable-threads=win32 --prefix=$HOME/i386-mingw32 \
--program-prefix=i386-mingw32- --target=i386 -mingw32 --with-gnu-as \
--with-gnu-ld
```
[gcc-core-3.4.5-20060117-2-src.tar.gz](https://sourceforge.net/proejcts/mingw/files/MinGW/Base/gcc/Version3/Previous%20Release_%20gcc-3.45-20060117-2/gcc-core-3.4.5-20060117-2-src.tar.gz)
## binutils
GNU binutils is usually not so problematic, so any version should do.
Only `binutils-2.35` has been tested.
```sh
../binutils-2.35/configure --prefix=$HOME/i386-mingw32 --target=i386-mingw32
```
## mingwrt and w32api
So far, only versions `mingwrt-3.15.2-mingw32` and `w32api-3.13-mingw32`
have been tested.
### Known issues
- Some hacks have to be done in order to compile these libraries. These
are described on the script below.
```sh
../w32api-3.13-mingw32/configure --prefix=$HOME/i386-mingw32 --host=i386-mingw32
# Hack at line below
cd mingwrt-3.15.2-mingw32/ && cp -r include/* ~/i386-mingw32/include/
../mingwrt-3.15.2-mingw32/configure --prefix=$HOME/i386-mingw32 --target=i386-mingw32
../sdl-1.2.15-src/configure --host=i386-mingw32 --prefix=/home/xavier/sdl-1.2.15 \
--enable-shared=no CC=i386-mingw32-gcc
```
[mingw-runtime-3.15.2](https://sourceforge.net/projects/mingw/files/OldFiles/mingwrt-3.15.2/mingwrt-3.15.2-mingw32-src.tar.gz)
[mingw-w32api-3.13](https://sourceforge.net/projects/mingw/files/OldFiles/w32api-3.13/w32api-3.13-mingw32-src.tar.gz)
## freetype (not required)
Only `freetype-2.4.8` is known to work so far.
### Known issues
- Apparently, out of source builds are not possible.
```sh
cd freetype-2.4.8-src/ && ./configure --prefix=$HOME/freetype-2.4.8 \
--host=i386-mingw32 --enable-shared=no CC=i386-mingw32-gcc
```
## SDL
`sdl-1.2.15` is the latest version supported version for the Win9x family
of operating systems. In order to keep things easy, the script below
configures SDL as a static library.
```sh
../sdl-1.2.15-src/configure --host=i386-mingw32 --prefix=$HOME/sdl-1.2.15 \
--enable-shared=no CC=i386-mingw32-gcc
```
## SDL_mixer
Only `SDL_mixer-1.2.12` is known to work so far. Since `rts` only uses
WAVE files, support for other audio formats is not required.
```sh
../SDL_mixer-1.2.12-src/configure --host=i386-mingw32 --enable-shared=no \
--prefix=$HOME/SDL_mixer-1.2.12 --disable-music-cmd --disable-music-mod \
--disable-music-ogg --disable-music-mp3 --disable-music-midi \
--disable-music-flac CC=i386-mingw32-gcc --with-sdl-prefix=$HOME/sdl-1.2.15
```