Friday 8th November, 2013
Getting RPCEmu 0.8.11 to run under OpenBSD: possibly the intersection of the set of people who get nostalgic for RISC OS and the set of people who use OpenBSD on a daily basis is quite small. However, here's a patch to the RPCEmu 0.8.11 source code.

To use:

$ tar xzf rpcemu-0.8.11.tar.gz
$ cd rpcemu-0.8.11
$ patch -p 1 < /path/to/rpcemu-0.8.11-openbsd.patch

Then build RPCEmu as usual. It requires the allegro game library, but you can get this out of packages or ports, and the packages version (as of 5.4-release) will work fine.

So, what is this patch actually doing?

I'm glad you asked. All it changes is a few preprocessor bits:

  1. The type off_t in OpenBSD is always 64 bits wide. Other OSes have different sets of functions for 64-bit offsets. There's already support for aliasing the explicitly 64-bit names to the "normal" names for __MACH__ in rpcemu.h. The patch adds __OpenBSD__ to that, so that that aliasing will happen under OpenBSD as well.
  2. The hostfs.c file uses utime.h. If __unix or __MACH__ are not defined, it tries to include it as sys/utime.h. On OpenBSD, it isn't in sys/, and __unix isn't set in gcc. So the patch adds __OpenBSD__ to this line, too.
  3. The rpcemu.h file uses the existence of _BIG_ENDIAN to check for the host being big-endian. Unfortunately, on OpenBSD this is always in existence as is _LITTLE_ENDIAN and the _BYTE_ORDER macro switches between them. So this patch replaces the compile-time check for big-endianness in rpcemu.h to check _BYTE_ORDER.

Hopefully this stuff won't be necessary by the next release!

posted by Rob Mitchelmore, 22:11 (anchor)