Building Frotz

Frotz is a Z-machine adventure game ("interactive fiction") interpreter, allowing you to play almost any Z-code game (such as nearly everything from Infocom, for example).

I wanted to start with the code which can interpret game files and turn it into something else, so the first step was obtaining the source code and compiling it normally, before starting to fiddle about with it.

For the avoidance of doubt, all this was done on a Devuan 4 Chimaera machine.

I fetched the current version (2.54 at the time of writing) from the IF archive, unpacked it and ran make.

This, not surprisingly, didn't get very far until I had installed the build-essential package, but even after I'd done that, a few other things were needed:

ncurses-dev
libao-dev
libsndfile1-dev
libsamplerate0-dev
libmodplug-dev

Once the above development files were installed, the build went remarkably quickly (compared to the sorts of things I normally have to deal with building, such as Asterisk or FreeSwitch):

root@Zmachine:~/frotz-2.54# time make
** Generating src/common/defs.h
** Generating src/common/hash.h
make -C src/common
make[1]: Entering directory '/root/frotz-2.54/src/common'
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o buffer.o -c buffer.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o err.o -c err.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o fastmem.o -c fastmem.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o files.o -c files.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o getopt.o -c getopt.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o hotkey.o -c hotkey.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o input.o -c input.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o main.o -c main.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o math.o -c math.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o missing.o -c missing.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o object.o -c object.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o process.o -c process.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o quetzal.o -c quetzal.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o random.o -c random.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o redirect.o -c redirect.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o screen.o -c screen.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o sound.o -c sound.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o stream.o -c stream.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o table.o -c table.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o text.o -c text.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -fPIC -fpic -o variable.o -c variable.c
ar rc frotz_common.a buffer.o err.o fastmem.o files.o getopt.o hotkey.o input.o main.o math.o missing.o object.o process.o quetzal.o random.o redirect.o screen.o sound.o stream.o table.o text.o variable.o
/usr/bin/ranlib frotz_common.a
** Done with Frotz core.
make[1]: Leaving directory '/root/frotz-2.54/src/common'
** Generating src/curses/ux_defines.h
make -C src/curses
make[1]: Entering directory '/root/frotz-2.54/src/curses'
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_audio.o -c ux_audio.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_audio_none.o -c ux_audio_none.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_audio_oss.o -c ux_audio_oss.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_blorb.o -c ux_blorb.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_init.o -c ux_init.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_input.o -c ux_input.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_pic.o -c ux_pic.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_screen.o -c ux_screen.c
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED  -fPIC -fpic -o ux_text.o -c ux_text.c
ar rc frotz_curses.a ux_audio.o ux_audio_none.o ux_audio_oss.o ux_blorb.o ux_init.o ux_input.o ux_pic.o ux_screen.o ux_text.o
/usr/bin/ranlib frotz_curses.a
** Done with curses interface.
make[1]: Leaving directory '/root/frotz-2.54/src/curses'
make -C src/blorb
make[1]: Entering directory '/root/frotz-2.54/src/blorb'
cc -Wall -std=c99 -O3  -g -D_POSIX_C_SOURCE=200809L -I../common -fPIC -fpic -o blorblib.o -c blorblib.c
ar rc blorblib.a blorblib.o
/usr/bin/ranlib blorblib.a
** Done with Blorb library.
make[1]: Leaving directory '/root/frotz-2.54/src/blorb'
cc src/common/frotz_common.a src/curses/frotz_curses.a src/blorb/blorblib.a src/common/frotz_common.a -o frotz  -lncursesw -ltinfo -lao -lpthread -lm -lsndfile -lvorbisfile -lmodplug -lsamplerate
** Done building Frotz with curses interface
** Audio support enabled (type ao)
** Blorb support enabled

real    0m4.828s
user    0m4.306s
sys     0m0.509s

I could then run the resulting binary (although it didn't like being run as root).

The binary generated from the compilation was 632400 bytes in size (compared to 139072 bytes for the 2.53 version I had installed from the standard Devuan package). stripping the binary I'd just built brought it down to 152216 bytes.

Since the purpose for which I'm doing this does not require a fancy user interface, I also tried make dumb to build the version which is "for dumb terminals and wrapper scripts". This turned out to be 549200 bytes in size before stripping, and 137184 bytes afterwards.

Notes on the source code


Go up
Return to main index.