I recently installed luarocks in my home directory on an Ubuntu
machine. I share this home directory across x86 and x86_64 machines. I
found it quite tricky to get luarocks to work like this, and it took
me quite a while reading the documentation and code to get things to
work cleanly. I finally came up with the following recipe, which I
hope can be added to the documentation.
1. Install luarocks in home directory with: ./configure --prefix=$HOME/local
2. Set the following variables in .bashrc or similar:
LUA_LIBDIR=$HOME/local/`uname -m`/lib/lua/5.1
LUA_BINDIR=$HOME/local/`uname -m`/bin
LUAROCKS_CONFIG=$HOME/local/etc/luarocks/config_`uname -m`.lua
LUAROCKS_UNAME_M=`uname -m` "$@"
3. For each architecture, create a file to
$HOME/local/etc/luarocks/config_`uname -m`.lua of this form:
rocks_servers = {
[[http://luarocks.org/repositories/rocks]]
}
rocks_trees = {
home..[[/local/x86_64]] -- set arch as appropriate
}
I found all of these steps necessary. Some things it would be nice to fix:
1. Step 3 above (the per-arch config.lua) should be unnecessary: it
should be possible to set LUAROCKS_ROCKS_TREE in the environment. (In
general it is not clear from the docs which variables are read from
the environment and which are not; they should all be.)
2. It is not obvious from the documentation that LUAROCKS_CONFIG
cannot be set on the command line (this is too late); it MUST be set
in the environment. Is this a bug?
3. See this code from cfg.lua:
-- A proper installation of LuaRocks will hardcode the system
-- and proc values with config.LUAROCKS_UNAME_S and config.LUAROCKS_UNAME_M,
-- so that this detection does not run every time. When it is
-- performed, we use the Unix way to identify the system,
-- even on Windows (assuming UnxUtils or Cygwin).
system = config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l")
proc = config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l")
This is misguided, as it forces the user to set LUAROCKS_UNAME_M in
their .bashrc. Instead, LUAROCKS_UNAME_M should only be put in
config.lua on systems that lack the uname command. (The other obvious
solution would be to install luarocks under lib/ rather than share/ so
that it can be installed for multiple architectures, but that is
overkill just for a single per-arch value.)
If you agree with my suggested changes, I'd be happy to make patches
for any or all of them.
--
http://rrt.sc3d.org
_______________________________________________
Luarocks-developers mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/luarocks-developers