unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44662: Lua search paths
@ 2020-11-15 18:24 raingloom
  2021-03-26  9:28 ` zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: raingloom @ 2020-11-15 18:24 UTC (permalink / raw)
  To: 44662

I have a very WIP branch adding search paths to Lua.
https://git.sr.ht/~raingloom/guix-source/tree/raingloom/lua

The problem is that Lua uses a different path format compared to most
packages. Instead of a list of directories, it is a list of path
patterns, each potentially containing a question mark ('?'), which gets
substituted for the module being searched.

For pure Lua modules, this basically means /lib/lua/5.3/?.lua and
/lib/lua/5.3/?/init.lua.
I am not aware of any practical use of paths that do not contain a '?',
so there is a relatively easy solution here:
use the string.gsub function to expand every path component that does
not contain a '?' into two components, the ?.lua and the ?/init.lua one.
This means externally defined components are not expanded, only the
ones defined by Guix.

For C modules, it's a bit trickier, because there is a special
component that looks into loadall.so, which I must admit I'm not
familiar with. As far as I know, popular modules all define their own
shared object file, never a loadall.so.

Also, the path is separated by semicolons, not colons, but I think Guix
can already handle that.

The approaches I see:
- patch loadlib.c in Lua to expand LUA_PATH and LUA_CPATH according to
  the above mentioned heuristics, or
- patch Guix to support paths of this format
- define something like GUIX_LUA_PATH that gets expanded on its own and
  only contains Lua modules defined in Guix, and then gets appended to
  package.path (and do the same for package.path)


Solving this would open up access to the huge variety of Lua modules
and make things like game development in LÖVE much better integrated.
Its users could even use `guix pack` to distribute their games.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#44662: Lua search paths
  2020-11-15 18:24 bug#44662: Lua search paths raingloom
@ 2021-03-26  9:28 ` zimoun
  2021-03-26 20:29   ` raingloom
  0 siblings, 1 reply; 3+ messages in thread
From: zimoun @ 2021-03-26  9:28 UTC (permalink / raw)
  To: raingloom; +Cc: 44662

Hi,

On Sun, 15 Nov 2020 at 19:24, raingloom <raingloom@riseup.net> wrote:
> I have a very WIP branch adding search paths to Lua.
> https://git.sr.ht/~raingloom/guix-source/tree/raingloom/lua
>
> The problem is that Lua uses a different path format compared to most
> packages. Instead of a list of directories, it is a list of path
> patterns, each potentially containing a question mark ('?'), which gets
> substituted for the module being searched.

From my understanding, it is a duplicate to
<<http://issues.guix.gnu.org/issue/25425>.  Does it make sense to merge
them?


All the best,
simon




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#44662: Lua search paths
  2021-03-26  9:28 ` zimoun
@ 2021-03-26 20:29   ` raingloom
  0 siblings, 0 replies; 3+ messages in thread
From: raingloom @ 2021-03-26 20:29 UTC (permalink / raw)
  To: 44662

On Fri, 26 Mar 2021 10:28:03 +0100
zimoun <zimon.toutoune@gmail.com> wrote:

> Hi,
> 
> On Sun, 15 Nov 2020 at 19:24, raingloom <raingloom@riseup.net> wrote:
> > I have a very WIP branch adding search paths to Lua.
> > https://git.sr.ht/~raingloom/guix-source/tree/raingloom/lua
> >
> > The problem is that Lua uses a different path format compared to
> > most packages. Instead of a list of directories, it is a list of
> > path patterns, each potentially containing a question mark ('?'),
> > which gets substituted for the module being searched.  
> 
> From my understanding, it is a duplicate to
> <<http://issues.guix.gnu.org/issue/25425>.  Does it make sense to
> merge them?
> 
> 
> All the best,
> simon

Yup, a merge seems to be in order.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-26 20:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 18:24 bug#44662: Lua search paths raingloom
2021-03-26  9:28 ` zimoun
2021-03-26 20:29   ` raingloom

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).