How to build 1oom on Windows

This guide describes how to build 1oom on Windows.

1. Setting up the environment

Install MSYS2 following the instructions on http://www.msys2.org/.

2. Installing the tools

After doing all the updates as instructed, launch MSYS2 MSYS and install your toolchain (replace i686 with x86_64 if you want 64-bit EXEs):

pacman -S mingw-w64-i686-toolchain mingw-w64-i686-SDL mingw-w64-i686-SDL_mixer mingw-w64-i686-libsamplerate
If you want to build the SDL2 binaries too (again replacing i686 with x86_64 if you want 64-bit EXEs):
pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer
Install the build tools:
pacman -S git autoconf automake make

Close the shell and launch MSYS2 MinGW 32-bit (or 64-bit respectively) to set up the environment variables.

3. Grab the code

Use git to clone the source code to a local repository:

git clone https://gitlab.com/KilgoreTroutMaskReplicant/1oom.git
Now you have a copy of 1oom source code in a directory named "1oom". Let's go into it:
cd 1oom
Let's check where we are:
pwd
The rest of this document assumes the output from that command was /home/USERNAME/1oom.

4. Setting up the local repository

Let's set 1oom up for the first configure:

autoreconf -fi
This needs to be done only once, right after the git clone.

Let's create a build directory to keep the src directory clean.

mkdir build-native
cd build-native

5. Configuring

Next we configure the source code for the first compile:

../configure
You should see a bunch of text that ends with something like:
config.status: creating src/hw/sdl/Makefile
config.status: creating src/hw/sdl/1/Makefile
config.status: creating src/hw/sdl/2/Makefile
config.status: creating src/hw/alleg/Makefile
config.status: creating src/hw/alleg/4/Makefile
config.status: creating src/config.h
config.status: executing depfiles commands
If you instead get an error about SDL or SDL2 then be sure to send config.log along with complaints. The Allegro 4 warning can be safely ignored.

The configure step needs to be done (manually) only once. If you got this far, steps 1 to 5 can be forgotten.

6. Compiling

Compiling the code is simple:

make
If you have a multicore processor (and who doesn't these days) you can make it go faster:
make -j 3
You should see a bunch of text that ends with something like:
gcc  -g -O3 -Wall -Wno-inline -Wstrict-prototypes   -o 1oom_classic_sdl1 fmt_mus.o fmt_sfx.o ... -lSDLmain -lSDL  -lsamplerate
...
make[1]: Leaving directory '/home/USERNAME/1oom/build-native/src'
make[1]: Entering directory '/home/USERNAME/1oom/build-native'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/USERNAME/1oom/build-native'
The built binaries reside in /home/USERNAME/1oom/build-native/src.

7. Running

Try to run the freshly built 1oom_classic_sdl1.exe using the usual Windows method. It will complain about a missing DLL file. To fix that, copy the DLL file (for example SDL.dll) to the src directory (replace mingw32 with mingw64 if you chose to build 64-bit EXEs):

cp /mingw32/SDL.dll src/
Try to run again and copy the next missing DLL file (tip: press Up/Down to access previous commands).

Eventually 1oom will start and complain about missing LBX files. Copy those to /home/USERNAME/1oom/build-native/src.

Congratulations! You have made a working 1oom build. Enjoy software freedom!

8. Misc.

The freshly built executables are rather large due to included debugging data. To get rid of the fat:

strip src/1oom_*

If you have made a neat change that you wish to share, the quick and dirty way to make a patch file:

git diff > my_cool_feature.patch
To make a proper patch, please refer to git documentation. Please read HACKING if you want your patch to be included in 1oom.

9. Tomorrow

Start MSYS2 again and get back to the local repository:

cd 1oom
Update to the latest upstream code:
git pull
Overview on what changed (q to quit):
git log
What changed exactly:
git log -p
Build it again:
cd build-native
make -j 3