lua-users home
lua-l archive

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

On Sun, Feb 01, 2015 at 09:18:52PM +0100, Enrico Colombini wrote:
> What about the libraries, for example lfs or luasocket? They are
> version-dependent too.
> Do you think of compiling each version with different built-in default for
> LUA_PATH/LUA_CPATH, or to launch a script that sets them accordingly? It
> would be great if different distributions used the same mechanism.
> Or do you plan to rely on LuaRocks? (does it handle multiple versions?) It
> would be an extra step for non-technical users, too, especially if they do
> not have the gcc toolchain installed. Or LuaDist?

That is a very interesting, somewhat orthogonal, discussion that would
take an entire FOSDEM track day to answer ;-) We should really try to
book a room next year.

I can briefly tell you what I do for Debian (that is what percolates to
more user friendly distros like Ubuntu).  But, luckily, most of the
standardization was done inside Lua.  Dunno if our Brazilian friends
realized it but they did set a policy this time :-P  And it is a good one.

If you take Lua 5.1 and compile if from the sources and print
package.path and package.cpath you get

  .. /usr/local/share/lua/5.1/?.lua ...
  .. usr/local/lib/lua/5.1/?.so ..
OK, Lua libraries distributed as Debian packages are not in /usr/local/
but in /usr/, but the schema can stay the same.  So if you install
lua-expat on Debian you get 2 shared object files (one for 5.1 and one
for 5.2) in the corresponding directories.  Then the lua5.1 interpreter
that is distributed in Debian has package.path correctly set to look up
in the right places.

So the path for libraries is already versioned, hence multiple Lua
versions can coexists.  Unfortunately the lua and luac binaries are not
versioned (in their name), hence the packager has to make an arbitrary

This choice is what should be standardized.
lua5.1 or lua-5.1 or lua51 or ... A stupid separator character
may make your script fail to run on a system that uses a different

Enrico Tassi