Compiling
Getting GCC

If you do not have the GCC compiler you can download it from

http://www.riscos.info/index.php/GCC

or get it as a package using Packman. For the list of packages see

http://www.riscos.info/packages/ABCIndex.html

You will also need from the above URL the packages:

  • Make
  • SharedUnixLibrary
  • SharedLibs
  • SharedLibs-C2
You should end up with an application !GCC. Before compilation you need to increase the Next wimpslot to something big (click Select on the taskmanager icon) and see that !GCC has been filer_booted (just click Select on its icon).
Makefile

In the src directory of your Lua sources create a directory called o for object files. I also add a TaskObey file called Go! containing

  dir <Obey$dir>
  make
to be double-clicked to fire off the compiler. But before you do that you need to edit src.makefile and make an adjustment to the file src.h.luaconf to override its Unix configuration values with RISC OS ones.

In src.Makefile change the following lines:

  • PLAT= none        -->     PLAT= generic
  • SYSLIBS=          -->     SYSLIBS= -ldl
  • MYCFLAGS=         -->     MYCFLAGS= -DRISCOS
and if you have an ARMv7 platform and want floating point in hardware then change
  • SYSCFLAGS=        -->     SYSCFLAGS= -mfpu=vfp
The end result of compilation is two ELF files lua and luac, the interpreter and the separate compiler-to-bytecode. If you want to call these something different you may want to change the lines
  • LUA_T= lua
  • LUAC_T= luac
These changes are all you need for src.Makefile. Next we look at the minimal changes to the source files needed for compiling under RISC OS.