Am 26.11.2013 00:51 schröbte Reuben Thomas:
> Hi,

Hi!

>
> I just upgraded from luarocks 2.1.0 to 2.1.1. I see it supports multiarch
> in some way. I searched a bit and found something about
> external_deps_subdirs and runtime_external_deps_subdirs on the page
> http://luarocks.org/en/Config_file_format
>
> But it doesn't really explain how to use it.

There is `external_deps_dirs` which is `{ "/usr", "/usr/local" }` by 
default on unixes. To create the actual search paths for header files, 
libraries and binaries, it is combined with `external_deps_subdirs`, 
which is `{ include = "include", lib = "lib", bin = "bin" }` by default.

So the default search paths are:
* `/usr/include` and `/usr/local/include` for header files,
* `/usr/bin` and `/usr/local/bin` for binaries, and
* `/usr/lib` and `/usr/local/lib` for libraries.

On multiarch systems the configure script and makefile set up a 
`site_config.lua` file that overrides `external_deps_subdirs` to include 
the multiarch library directory. On my system that is:

     LUAROCKS_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", 
[[lib/x86_64-linux-gnu]] }, include="include" }

So the search paths for libraries are `/usr/lib`, 
`/usr/lib/x86_64-linux-gnu`, `/usr/local/lib`, and 
`/usr/local/lib/x86_64-linux-gnu`.

This is all there is to it, in particular it doesn't change the paths 
where compiled extension modules are installed which is what you seem to 
do. Do you mount your home directory on machines with different 
architectures? I never thought of that use-case ...

>
> Currently, I compute LUAROCKS_CONFIG according to my architecture when I
> log in, for example:
>
> LUAROCKS_CONFIG=/home/rrt/local/etc/luarocks/config_x86_64-linux-gnu.lua

Btw., what do you use to detect the host triplet? Anything other than 
`gcc -print-multiarch` or `dpkg-architecture -qDEB_HOST_MULTIARCH`?

>
> where this file contains:
>
> local arch = "x86_64-linux-gnu"
>
> external_deps_patterns = {
>    bin = {"?.exe", "?.bat"},
>    lib = {"lib?.a", "lib?.so", arch.."/lib?.a", arch.."/lib?.so"},

Well, the last two should be redundant now, if you use the modified 
`external_deps_subdirs` variable, because the arch part is handled there 
already, but if you mount your home on machines with different 
architectures you need to set `external_deps_subdirs` (and 
`runtime_external_deps_subdirs`) in your `config.lua` as well, because 
`site_config.lua` will be wrong in all but one cases ...

>    include = {"?.h"},
> }
>
> rocks_trees = {
>    {
>      root = home.."/local",
>      rocks_dir = home.."/local/lib/luarocks/"..lua_version.."/rocks",
>      lib_dir = home.."/local/lib/"..arch.."/lua/"..lua_version,
>      bin_dir = home.."/local/bin/"..arch,

... and this isn't handled at all at the moment. So you probably better 
stick to your current solution for now.

>    }
> }
>
> I presume that with the new multiarch support I can get rid of this
> mechanism and just have a single config-5.2.lua, but can someone explain
> how I achieve this?

Nah, the multiarch support was more about finding external dependencies 
in the multiarch library directories than about storing extension 
modules in arch-specific locations. Sorry.

Philipp



------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to