Hi!

Am 25.09.2013 05:23 schröbte p...@pjb.com.au:
> Hi.  On debian stable but with 5.2 in /usr/local/bin, I did:
>    luarocks install lgdbm GDBM_LIBDIR=/usr/lib/i386-linux-gnu/
> and it ended up in  /usr/local/lib/lua/5.2/gdbm.so
> But, trying to use it reveals:
>    undefined symbol: luaL_register
> which means it's Lua5.1 code.  So I emailed Luiz Henrique who said:
>> This seems to be the gdbm library for Lua 5.1 compiled in 5.2.
>> Apparently luarocks does not contain a rock for the 5.2 version.
>> Please let the luarocks people know about this problem.
>> There is a gdbm library for Lua 5.2 at
>>     http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lgdbm.
>> whose date is Jul 2013.
>
> That URL features separate tarballs for separate Lua version;
> The lua5.2 tarball is:
>    http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/lgdbm.tar.gz
> There's no    #if LUA_VERSION_NUM >= 502  test in the C code.
>
> Can a rockspec adjust its tarball URL according to which
> Lua version it's running ?  Is it something low-tech like
>    if _VERSION == 'Lua 5.2' then
>       source = {
> ? From the naive user's point of view, it would be nice if
>    luarocks install lgdbm
> picked the right version (ideally also the right GDBM_LIBDIR)...

Here is what you can do:
*   Download the old rockspec[1] from the LuaRocks site[2], and open it 
in an editor.
*   Pick a new version number (in this case the current date)
*   Change source.url to the 5.2 version given by lhf.
*   You also need to change the source.md5 to match the new archive at 
the given url (this should be 2b209b3f21e1e6cb87b1d623ada8e3cb in this 
case).
*   Change the string in the `dependencies` table from "lua >= 5.1" to 
"lua ~> 5.2".
*   Close and rename the rockspec to reflect the new version number, and 
run `luarocks install lgdbm-20130925-1.rockspec 
GDBM_LIBDIR=/usr/lib/i386-linux-gnu` to test the new rockspec locally 
(maybe you have to adapt the version number/date here).

And if that worked you can send the modified rockspec to this list for 
Hisham to include it in the repository.

   [1]: http://luarocks.org/repositories/rocks/lgdbm-20130702-1.rockspec
   [2]: http://luarocks.org/repositories/rocks/

Regarding `if _VERSION == ...`: Rockspecs are loaded with an empty 
environment, so even `_VERSION` is not available. But luarocks can 
figure out, which of the available rockspecs the latest for a given Lua 
version is. "lua ~> 5.2" is only valid for Lua 5.2, so luarocks for Lua 
5.2 will choose this one, luarocks for Lua 5.1 will take the older 
version. The whole problem was caused by the overly optimistic "lua >= 
5.1" dependency specification, which broke the moment luarocks became 
compatible with Lua 5.2. "lua ~> 5.2" (or "lua ~> 5.1" in the original 
case) is a much safer value there.

Regarding `GDBM_LIBDIR`: This variable depends on your operating system. 
If luarocks can't find the necessary library automatically (because it 
doesn't scan the library paths used for Debian's/Ubuntu's multiarch 
feature), you have to tell it where the library is.

>
> If this works, I could put together a manual page, which would be
> useful to people eg. if it could go in the description['homepage']
> field.  Is this possible, in a module which isn't really mine ?

The `description.homepage` field is intended to give credit to the 
upstream module author(s), so you shouldn't change that from its current 
value. However there is a `description.maintainer` field you can use. 
Typically you would put your name and email address there, but I think 
you could use an url, too. Drawback is that this field isn't displayed 
in the rocks listing[2], so people will only see it if they read the 
rockspec itself ...

>
> Thanks, regards,  Peter Billam

HTH,
Philipp



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&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