Am 09.06.2015 um 17:22 schröbte Dimitris Papavasiliou:
> Hi,

Hi!

>
> I'm trying to package a REPL through LuaRocks which is available, both
> as a loadable module and as an executable script, which used said module
> to provide a standalone enhanced Lua prompt.
>
> Thanks to some input from the list (and elsewhere) I've figured out how
> to package the module, but I'm still having a problem with the script.
> Since it's installed in $(PREFIX)/bin/, it's not possible to have
> multiple versions, say one for Lua 5.1 and one for 5.2 installed
> side-by-side.  Whatever's installed last just writes over what has been
> previously installed.
>
> I could handle this by appending the version to the name of the
> installed file but I can't find a way to access the Lua version inside
> the rock.  Of course, even this would to be less than ideal, because
> you'd then have to type luap-5.2 instead of just luap (this being the
> name of the script) to run the interpreter, but I guess one can make a
> link manually easily enough.  Of course a post-install hook where one
> could take care of such things automatically, as is done in most package
> systems like apt, would be even better.
>
> Is there any way I can tackle this in LuaRocks?

You don't have access to the Lua version in rockspecs. But since the 
number of Lua versions is manageable, you could provide multiple 
different rockspecs. This is what I have done for my Testy[1] project, 
and it works great so far.

I use `-51`, `-52`, and `-53` as the rockspec revision. In the 
dependencies table, I make sure that the rockspec is valid only for the 
intended Lua version (e.g. `lua ~> 5.1`), and in the `build.install` 
table I copy the versioned script (`testy-5.1` and additionally an 
unversioned script (`testy.lua`). The unversioned one may be overwritten 
by later installs for different Lua versions, the versioned one should stay.

>
> D.
>

HTH,
Philipp

   [1]: https://github.com/siffiejoe/lua-testy/tree/master/rockspecs



------------------------------------------------------------------------------
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to