lua-users home
lua-l archive

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


On Mon, Jun 15, 2015 at 5:21 PM, Dimitris Papavasiliou <dpapavas@gmail.com> wrote:
I've looked into fixing most of these.  The implementation is ready but I haven't pushed anything yet.

On 06/15/2015 08:38 PM, Brigham Toskin wrote:
On Sun, Jun 14, 2015 at 9:05 PM, Daurnimator <quae@daurnimator.com
<mailto:quae@daurnimator.com>> wrote:

       - How is it recommended to install luaprompt for different lua
    versions side by side?
         i.e. How can I switch between 5.1 and 5.3?

I had to build luarocks from source for the different versions of lua on
my system, using the configure options, e.g.:

     ./configure  --lua-version=5.1 --versioned-rocks-dir

will configure the build for lua 5.1 (and luajit), and will sequester
the rocks config files under a 5.1 subdirectories. That second one is
necessary because when you also do 5.2 and/or 5.3, you don't want the
different versions clobbering each other's data. Then you make and
install as usual according to the instructions.

The problem here is that the all versions will install the standalone interpreter under /usr/local/bin/luap, or whatever the configured prefix is, each one overwriting the previous.

There's no graceful way to handle this with LuaRocks as far as I can tell.  One solution is to have a separate rockfile for each version (I implemented and submitted a patch for version-specific overrides similar to platform overrides, but it won't make it into LuaRocks until the next major version, if then, due to compatibility concerns).  Each rockfile can then install two versions of the standalone script, one under the name luap-5.2, say, and one under luap.  The plain luap file will be overwritten, but the versioned file will still be available.

In addition to the rockfile duplication, which is no major issue, this has the effect that the same file will be installed multiple times, instead of the usual practice of using symlinks.  I dislike that, but I can't think of another way.

I got around this by installing it with each version of luarocks, renaming the file e.g. to luap5.1, and then moving onto the next version. I then made a copy of luap5.1, manually edited it to exec luajit, and named that version luapjit.

It ain't pretty, and it'll break as soon as I update luaprompt, but it works for now as a workaround.
 
--
Brigham Toskin