guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/5] gnu: Build lua-5.2 with dynamic library support.


From: Ludovic Courtès
Subject: Re: [PATCH 2/5] gnu: Build lua-5.2 with dynamic library support.
Date: Wed, 11 Nov 2015 22:28:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Leo Famulari <address@hidden> skribis:

> On Sun, Nov 8, 2015, at 16:08, Ludovic Courtès wrote:
>> Leo Famulari <address@hidden> skribis:

[...]

>> How can I test whether this works as expected?  I tried this, but I’m
>> unsure whether it’s supposed to load OpenSSL’s libssl.so directly or
>> not:
>
> There is a Lua library named luasec that provides SSL. Luasec only
> supports lua-5.1 except in an alpha release (luasec-0.6). [1]

Okay.

> I am able to load luasec by telling Lua where to look. I have lua-5.1
> and luasec in my profile:
>
> $ LUA_PATH=~/.guix-profile/share/lua/5.1/\?.lua
> LUA_CPATH=~/.guix-profile/lib/lua/5.1/\?.so lua -lssl
> Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
>> 
> ^ That is the Lua prompt, indicating that the Lua interpreter has
> successfully imported the SSL libraries. The '?' character is replaced
> by the component that Lua is currently searching for. So, if you invoke
> `lua -ssl`,  the "?.so" in LUA_CPATH is replaced by ssl.so.

OK.  So in LUA_PATH you need to list the actual .lua files (not just
their dirname), and in LUA_CPATH the .so files (not just their dirname),
right?

>> Besides, it would be nice to get rid of these hard-coded /usr/local in a
>> subsequent patch.
>
> This is related to my next step and I need some advice.
>
> We need to set LUA_PATH and LUA_CPATH properly in order for programs to
> load external Lua libraries. I have been installing Lua libraries into
> ${out}/lib/lua/${LUA_VERSION} and ${out}/share/lua/${LUA_VERSION}, so
> that they end up at, for example, ~/.guix-profile/lib/lua/5.1/ssl.so [2]

It seems we need a ‘native-search-paths’ thingie here, along these
lines:

  (search-path-specification
    (variable "LUA_PATH")
    (files '("share/lua/5.1"))
    (file-pattern "\\.lua$")
    (file-type 'regular))

See the ‘libxml2’ package for an example of how this works.

Something similar is needed for ‘LUA_CPATH’.  And then we need to make
sure to replace “5.1” with the actual version number.

That way, when Lua and luasec are in the same profile, ‘guix package
--search-paths’ will suggest the right environment variable settings
(and likewise within build environments.)

> Nixpkgs makes it all work by setting the paths in wrappers around
> programs that need to find Lua libraries. I don't fully understand how
> they generate the paths but I get the idea. Some examples:
> https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/xmpp/prosody/default.nix
> https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/video/quvi/tool.nix
>
> What do you think?

That sounds like the right thing.  In Guix this is achieved with
‘wrap-program’; there are several examples of packages doing that.

HTH!

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]