Compiling

From OHRRPGCE-Wiki
(Redirected from Compile)
Jump to navigation Jump to search

The OHRRPGCE is written primarily in FreeBASIC with a lot of C and C++ and uses SCons for its build system written in Python. HSpeak is written in Euphoria.

After you have installed the requirements for your OS (see below), you run scons to compile programs or run test cases.

  • scons without arguments compiles debug builds of Game and Custom
  • scons release=1 compiles smaller, faster release builds of Game and Custom
  • scons tests compiles and run all test cases (including compiling Game and Custom).
  • scons unlump relump produces the utilities for packing and unpacking the Lump Format used by .rpg files.
  • scons reload compiles several useful RELOAD utilities such as reload2xml
  • scons hspeak compiles HSpeak
  • scons . compiles everything -- there are numerous other utilities and test programs.

Type scons --help for information about the various compile options and compiling the other utilities.

Compiling requirements[edit]

Basically, you need FreeBasic, GCC or Clang C/C++ compilers (MinGW or MinGW-w64 on Windows), Python, and SCons. Clang can only create release builds, not debug builds, so GCC is strongly recommended for development. HSpeak additionally requires Euphoria.

Windows[edit]

On Windows see Windows compiling requirements#Quickstart.

Linux[edit]

On Linux, you will need the Linux library requirements (which you probably all already have) as well as FreeBASIC, GCC, and SCons.

Or you could use Docker to automatically install a build environment. See Compiling with Docker.

Mac OS X[edit]

Compiling for Mac has some complications. A full article on the subject is here: Compiling in Mac OS X

Android[edit]

The Android port uses a fork of FreeBASIC. See Compiling for Android.

FreeBSD[edit]

The OHRRPGCE on FreeBSD is not well tested, but seems to work, and is the same as compiling on Linux (including library requirements: ncurses, SDL2, SDL2_mixer, and instrument patches for MIDI, e.g. freepats.)

Versions Gorgonzola and earlier required gcc to compile, but the hróðvitnir release and later can be compiled with clang. gcc is used instead of clang if it is installed. Run scons compiler=clang to prefer clang.

HSpeak on FreeBSD is untested. 32-bit hspeak could probably be compiled because a package is available (see below), while 64-bit compiles will probably require cross compiling. Also, GNU make (gmake) is likely needed for compiling release builds of HSpeak using scons, but you can easily create a slower debug build instead (simply with scons hspeak) or compile it without gmake or scons by running euc hspeak.exw once you have installed Euphoria... however it probably requires gcc.

DOS[edit]

DOS has not been supported since Hasta-la-qb, but here are instructions for ancient versions: Compiling the DOS version.

hspeak[edit]

Run scons hspeak to create a slow debug build HSpeak or scons release=1 hspeak to compile a fast build. Compiling requires Euphoria 4.0+ from http://openeuphoria.org/ (4.0.3 is the oldest version known to work.)

For 64-bit Linux, and for modern distros (since circa 2024) you must use Euphoria 4.1.0+ (likely with a 64-bit copy of Euphoria). OpenEuphoria 4.1.0 can be downloaded from https://openeuphoria.org/wiki/view/DownloadEuphoria.wc We also keep our own mirror of a few Euphoria builds here: http://mirror.motherhamster.org/dependencies/

You also have the option to compile an OpenEuphoria 4.2.0 dev build yourself; 4.2.0 fixes various build and compatibility problems in particular for 64-bit systems. (It is not officially released yet.) You will need to install OpenEuphoria 4.1.0 before you can compile a 4.2.0 dev build. https://openeuphoria.org/wiki/view/DownloadEuphoria.wc#buildingfromsource.

(Warning, the 4.0.5 source download for FreeBSD is corrupt, and there are no later versions available. So for 32-bit FreeBSD, you could download Euphoria 4.0.4 and compile it.) (FIXME: Can someone with FreeBSD check if 4.2.0-dev works for them?)

If you want to install Euphoria on a Raspberry Pi, you should try looking at the instructions [1]

gfx_directx[edit]

gfx_directx.dll is provided precompiled in the svn/git respository, but it is not updated every time that the source is.

To compile, you will need Visual C++ and the DirectX SDK, see Windows compiling requirements for details.

After that, run scons gfx_directx.dll. This will overwrite the precompiled dll.

If you want to compile from within the IDE instead of using scons, read gfx_directx/readme.txt (in that case you'll probably need to add the DirectX SDK header directory to the include path.)

Via either method, the resultant .dll does not have any nonstandard dependencies.

Cross-compiling[edit]

You can crosscompile too. Linux-to-android and linux-to-win32 are tested. See Cross-compiling.

Docker[edit]

We provide Dockerfiles and wrapper scripts for running an OHRRPGCE build environment for a few platforms inside a docker container. Look in the `docker` subfolder after checking out a copy of the source from git or svn.

See Compiling with Docker.

See Also[edit]

Back to Source...