lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Nov 19, 2013 at 9:59 PM, Ulrich Schmidt <u.sch.zw@gmx.de> wrote:
> As i understood lake+luabuild, its goal is to create those files and to
> create stand alone lua apps. May be i am wrong in this point.

You are not wrong, that's exactly the point.

The file that customizes luabuild is default.config, which is a Lua
specification of how to build Lua and what modules to include. If
STATIC is true, it will bundle all those modules into the final
executable.

As for standalone executables, the section "Gluing Things Together" in
the readme explains the procedure.  If you have a single script and
know it's dependencies, then a simple line like this will take Lake (a
single monster Lua script) and pack it as a standalone executable with
its dependency luafilesystem:

$ srlua -m lfs lake -o bin/lake

(assuming that /path/to/luabuild/bin is on the path)

The other case is you have a complex Lua application and wish to
analyze its dependencies and pack it into a single script. Here ldoc
is packaged as an executable; by default soar (thanks, Jay!) uses
dynamic analysis so it actually runs ldoc.

    D:\dev\lua\LDoc>soar52 -o ldoc ldoc.lua .
    soar ---------- running ldoc.lua --------------
    reading configuration from config.ld
    output written to d:\dev\lua\ldoc\out
    soar ---------- analysis over -------------
    ldoc.prettify   D:\dev\lua\LDoc\ldoc\prettify.lua
    pl.tablex       C:\Program Files\Lua\5.1\lua\pl\tablex.lua
    ...
    ---- binary dependencies ---
    lfs     *BINARY*
    batch file written to: ldoc.bat
    output written to: ldoc-all.lua

At this point, ldoc-all.lua contains all the Lua needed in a single
file. You can then 'glue' it to a suitable Lua stub exe:

    D:\dev\lua\LDoc> srlua -o ldoc ldoc-all.lua
    d:\dev\lua\luabuild\bin\glue.exe
d:\dev\lua\luabuild\bin\srlua\lua-lfs.exe ldoc-all.lua ldoc.exe

steve d.