shuttle
shuttle is a cross-platform mechanism for packaging and launching Lua applications. It provides skeleton directory structures and compiled binaries for each supported Lua version, O/S and architecture. The intention is that you should be able to package your Lua application as a double-clickable runtime simply by copying your Lua source files, or source image, into the skeleton.
shuttle was inspired by the way ZeroBraneStudio launches itself.
Skeleton directory structure
The packaging structure is as follows:
.
|-- shuttle[.exe]
|-- liblua.so (or equivalent)
|-- src/
|-- <application source files>
|-- app.bin (application source archive)
|-- lua/
|-- <lua libraries>
|-- lib/
|-- <lua compiled libraries>
Bootstrapping process
The shuttle executable performs some basic bootstrapping before launching the Lua application. The process is as follows:
- set
package.pathto find files insrc/then inlua/ - set
package.cpathto find binaries inlib/, formatted correctly for the host system - implement a custom
package.loaderto findsrc/files withinapp.bin - override
dofile()andloadfile()to searchapp.binforsrc/files - executes
dofile('src/app.lua') - removes the bootstrapping and restores the environment
- calls
main(...)
Application source files
Sources files can be stored individually under src/ or packaged as an archive in app.bin. A tool mkrom is provided to generate the archive from a directory of files. Files found in src/ on disk will override those in app.bin.