technique/script to bundle many Lua modules into one source?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

technique/script to bundle many Lua modules into one source?

Norman Ramsey
I've been asked to simplify distribution of some of my software, which
relies on a library of a couple of hundred Lua modules.  I'm hoping to
distribute code by bundling each key script into a single Lua file,
which will include the source code for every module that would
otherwise be (transitively) loaded by `require`.  I got the idea from
the `ilump` program written in 1994 by Gregg Townsend and distributed
with the Icon programming language:

  #     ilump copies one or more Icon source files, incorporating recursively
  #  the source code for files named by "link" directives.  This produces a
  #  standalone source program in one file, which is useful with certain
  #  profiling and visualization tools.

I'm preparing to write something similar for Lua, but I'd rather not
reinvent any wheels.  Is there code out there that I should be using?


Norman Ramsey

Reply | Threaded
Open this post in threaded view
|

Re: technique/script to bundle many Lua modules into one source?

Luiz Henrique de Figueiredo
> I've been asked to simplify distribution of some of my software, which
> relies on a library of a couple of hundred Lua modules.  I'm hoping to
> distribute code by bundling each key script into a single Lua file,
> which will include the source code for every module that would
> otherwise be (transitively) loaded by `require`.

See http://lua-users.org/lists/lua-l/2014-02/msg00025.html and the
messages in that thread
Reply | Threaded
Open this post in threaded view
|

Re: technique/script to bundle many Lua modules into one source?

Pierre Chapuis
On Mon, Jan 11, 2021, at 21:30, Luiz Henrique de Figueiredo wrote:

> See http://lua-users.org/lists/lua-l/2014-02/msg00025.html and the
> messages in that thread

Personally I use yet another tool not mentioned in this thread:
https://github.com/mihacooper/luacc
Reply | Threaded
Open this post in threaded view
|

Re: technique/script to bundle many Lua modules into one source?

aryajur
In reply to this post by Norman Ramsey
I have this script [1] that I use first to bundle all the linked Lua and C modules together in one directory. This helps consolidate all the dependencies in a single place. It does it automatically by looking in the code at all the requires and any additional modules that you want included/excluded and finds them using the same way require searches for the module and copies them over.
    Once everything is in one place I use srlua [2] to make an executable. The end result is a directory with 1 executable that contains all the Lua code embedded in it and all the relevant DLLs packaged in 1 directory with these 2 commands.


On Mon, Jan 11, 2021 at 12:13 PM Norman Ramsey <[hidden email]> wrote:
I've been asked to simplify distribution of some of my software, which
relies on a library of a couple of hundred Lua modules.  I'm hoping to
distribute code by bundling each key script into a single Lua file,
which will include the source code for every module that would
otherwise be (transitively) loaded by `require`.  I got the idea from
the `ilump` program written in 1994 by Gregg Townsend and distributed
with the Icon programming language:

  #     ilump copies one or more Icon source files, incorporating recursively
  #  the source code for files named by "link" directives.  This produces a
  #  standalone source program in one file, which is useful with certain
  #  profiling and visualization tools.

I'm preparing to write something similar for Lua, but I'd rather not
reinvent any wheels.  Is there code out there that I should be using?


Norman Ramsey