[pkg-lua-devel] LuaJIT package.path?

Enrico Tassi gares at fettunta.org
Sat Oct 19 11:43:19 UTC 2013


On Thu, Oct 17, 2013 at 06:28:54PM -0400, Peter Colberg wrote:
> The point that there are already too many paths in package.path should
> be taken seriously; but installing modules to the lua/5.1 paths that
> don't work with lua5.1 seems wrong, too…
> 
> If co-installation of multiple LuaJIT versions is not an issue, then
> perhaps the following would be a solution without too much impact?
> 
>  * Arch-dependent LuaJIT modules (e.g. hdf5/C.lua) go into
> 
>    /usr/lib/<arch-triplet>/luajit/
>    /usr/share/luajit/

What you propose makes luajit modules not visible from lua5.1, but
requires a special path.

Mike's answer was suggesting to put them in the lua/5.1 directory.
It is ugly one could require these modules from a stock lua5.1, but
it would get an error like "module ffi not found".

One could also patch the various modules using ffi introducing a line
like this one:

  ffi = assert(require'ffi', 'This lua module works only with luajit')

That would make the "solution" proposed by Mike less ugly.

There is another thing to take in to account.
There is an almost complete implementation of ffi for stock lua.
BTW, have you tried it on your modules?

>  * The packages are named lua-<module> and lua-<module>-dev.
> 
>  * lua-<module> has Provides: luajit-<module>

Sure, this can be added automatically by dh_lua.
But I'm wondering, if we decide to go for the luajit private path, the
packages could be called luajit-foo directly.  All in all, if these
modules are not compatible with lua...  

>  * lua-<module> has Depends: luajit (>= 2.0)

I think it is better not to specify that.  lua-foo does not depend
on lua5.1 because having liblua5.1 linked is also fine or any embedded
copy of (a patched version of) lua5.1.  I think we can express in a
decent whay this kind of dependency, hence lua modules do not declare
dependency over any lua runtime (either the interpreter or
liblua5.1...).

> Given the history of LuaJIT, I would expect that modules written for
> LuaJIT 2.0 will continue to work flawlessly with LuaJIT 2.1 and LuaJIT
> 3.0. So the versioned dependency would be mainly for modules that
> depend on features of LuaJIT 2.1 or 3.0.

yep

Ciao
-- 
Enrico Tassi



More information about the pkg-lua-devel mailing list