/omniajit

Standalone LuaJIT programs.

Primary LanguageCOtherNOASSERTION

ARCHIVED: Checkout LadyLua for your standalone Lua programs.

omniajit

Compile Lua 5.1 and LuaJIT source code into standalone executables. This makes it easy to use them for general purpose scripting.

Requires: GNU Make, a compiler and binutils (or equivalent). Installing development tools e.g. the package build-essential should have everything you need. Does not require autotools.
Note: Linux 3.17+ (5 Oct 2014) and glibc 2.25+ only for getrandom().

Getting started

  1. Edit the following space delimited variables in the top-level Makefile
    MAIN: The "main" script in the bin/ directory
    SRC: Modules that are specific to your application. Copy these to src/lua.
    SRC_DIR: Directories containing modules that are specific to your application. Copy these to src/lua.
    VENDOR: 3rd party modules
    VENDOR_DIR: directories containing 3rd party modules

  2. Copy the main source file into the bin/ directory.

  3. Copy modules into src/lua/ or vendor/lua/.

The SRC, VENDOR split is just for organization. Underneath they are using the same Make routines.

  1. Run make
  2. The executable will be located under the bin/ directory

Adding plain Lua modules. (NOTE: VENDOR and SRC are interchangeable.)

Adding plain modules is trivial. $(NAME) is the name of the module passed to VENDOR.

  1. Copy the module to vendor/lua/$(NAME).lua
    example: cp ~/Downloads/dkjson.lua vendor/lua
  2. Add $(NAME) to VENDOR
    example: VENDOR= re dkjson

For modules that are split into multile files, such as Penlight:

  1. Copy the directory of the Lua to vendor/lua/$(NAME)
    example: cp -R ~/Download/Penlight-1.3.1/lua/pl vendor/lua
  2. Add $(NAME) to VENDOR_DIR
    example: VENDOR_DIR= pl

For modules with multiple levels of directories you will have to pass each directory. Example:
VENDOR_DIR= ldoc ldoc/builtin ldoc/html

Lua does not have facilities to traverse directories and I'd like to avoid shell out functions.

Included projects

Project Version License
LuaJIT v2.1-20201012-2 MIT
luastatic 0.0.12 CC0

Available modules (Feel free to open a Github issue if you want help with adding a new Lua module.)

Module Version License
LPegLJ[1] 1.0.0 MIT
luafilesystem 0.3 MIT
u-test 113259f MIT
argparse 20c1445 MIT
moonscript 29d8ccc MIT
lunajson 1dcf3fa MIT
base64 769e16d APL2
sqlite3[3] d742002 MIT
luassert[2] 36fc3af MIT
list 7f8ee88 MIT
yaml d280b04 MIT

[1] Renamed to lpeg. require"lpeg" to require it.
[2] Incomplete import. Some files, utility type code only.
[3] Patched.