[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: smartlua
- From: Sean Conner <sean@...>
- Date: Wed, 6 Mar 2013 16:11:53 -0500
It was thus said that the Great mchalkley@mail.com once stated:
>
> Anyway, all that having been said, the concept of SmartLua really
> appeals to me, especially if it made dependency checking, bundling of
> modules, etc. easier, leaner and meaner. What I'd really love to see
> is a way of creating a package that would contain only the modules
> needed in a zipped file, along with the scripts involved, and,
> separately, the necessary parts of the Lua interpreter. On Windows, I
> could just create a shortcut to lua.exe (or luajit.exe) that passed it
> the name of the script that I wanted executed and it would pull
> everything it needed from the zip file. And that's it - two files, no
> matter how many programs I deployed to that machine, not counting a
> shortcut for each program, of course... Ideally, I'd also like it to
> support some form of encryption of the zip file, not because I think
> my code is so special, but to prevent it from being monkeyed with
> without my knowledge. Does any of this make any sense, or am I just
> out of my mind?
No. I got tired of that at work, so I ended up building what I call
"Kitchen Sink Lua"---a single executable that contains Lua and *all* the
modules required to run the scripts I need to run. And by executable, I
mean that---it's a program, not a zip file nor a tar file. Yes, the
executable is a bit on the large size [5]:
-rwxr-xr-x 1 spc spc 3384517 Feb 27 16:18 kslua # 32 bit Linux
-rwxr-xr-x 1 spc spc 4002868 2013-03-06 15:46 kslua # 64 bit Linux
-rwxr-xr-x 1 spc spc 5034576 Mar 5 12:26 kslua # 64 bit Sparc
(42 modules, excluding the ones built into Lua).
Yes, it's nice being able to copy one file (per platform) around intead of
having to worry about installing Lua and LuaRocks [1][2] everywhere.
But it wasn't an automatic process---no, I have this monster 1,239 line
Makefile that builds the darned thing [4]. I'm not even sure how to to
automate such a build, considering I have seven third-party
modules/libraries compiled in (largest of these is libcurl---our Solaris
boxes don't have that installed---sigh).
-spc
[1] While I have root access on the platforms I current test on, that
isn't true for other systems I may have to use in the future. Also,
one of the systems I used was recently re-installed from scratch and
we lot a ton of useful stuff (it's a Solaris box---it needs a ton of
help to be useful [3])
[2] I attempted to install LuaRocks on our Solaris system. Oh, what a
comical time I had. No gcc. No GNU tools. In short, it failed
pretty badly. I don't blame LuaRocks though---it's not like many
people are using Solaris these days.
[3] In my opinion. I'm not a fan of Solaris.
[4] That tracks *all* the depenencies, which is what bulks the Makefile
out. In fact, it's a lot of:
obj/tp/Lua-cURL-getinfo.o : $(LUACURL)/Lua-cURL-getinfo.c \
$(LUACURL)/Lua-cURL.h \
$(LUACURL)/Lua-utility.h \
$(LUA)/lua.h \
$(LUA)/lauxlib.h
$(CC) $(CFLAGS) -I$(LUA) -I$(CURL)/include -c -o $@ $<
type stuff. Yes, all done by hand. But my God is "make -j"
fast!
[5] Okay, one module requires nearly 2M of pure data to run, so that's
also statically compiled into the executable.