lua-users home
lua-l archive

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

>> I've now a basic extension to srlua running which allows you to
>> combine multiple (lua-) files in one zip file and than start it as a
>> standalone executable.
> Great idea (if the amount the Lua code -- and you can precompile it,
> of 
> course, to save space -- compresses is larger than the size of the
> decompressor...).
> Another way to do this on Windows would be to embed the "glued" codes
> as resource entries (so they are inside the EXE proper) and then to
> UPX the whole file. (UPX is a run-time in-memory unpackaging system.
> Highly  
> recommended to impress your friends when showing them how small your
> Lua run-time is compared to their Perl or Python distro. The UPX
> decompressor is very small.) 
> Has anyone tried using UPX for this (and is there an analogous way to
> embed binary data into ELF binaries so that the original executable is
> unaffected but the embedded data in technically "inside" as far as
> exectuable packers are concerned)?

Not tried it, but as long as Windows resources are concerned UPX can
pack them:

# upx -h
Options for win32/pe & rtm32/pe:
  --compress-exports=0    do not compress the export section
  --compress-exports=1    compress the export section [default]
  --compress-icons=0      do not compress any icons
  --compress-icons=1      compress all but the first icon
  --compress-icons=2      compress all but the first icon directory
  --compress-resources=0  do not compress any resources at all
  --strip-relocs=0        do not strip relocations
  --strip-relocs=1        strip relocations [default]

I made a library some time ago called luareader
( that can read
from FILE pointers, file descriptors and from memory. It allows
on-the-fly decompression of the streams using zlib or bzip2. In fact, it
has a reader that can decide if the underlying stream where data is
located is uncompressed, compressed with zlib or compressed with bzip2
and act accordingly.

It already has a reader that makes some substitutions to Lua source code
to make OOP in Lua easier, translating sequences of @id (field access),
@id(...) (method call) and @@id(...) (inherited method call) to
user-defined Lua code. But take care, this reader is a hack.

I have a unfinished 2.0 version of luareader that can process files
inside a tar file. The tar file can reside in the file system, in memory
or even inside another tar file.

Andre de Leiradella