tech-pkg archive

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

Re: Support for Lua modules.



 >> I'm packaging a few Lua (lang/lua) modules in WIP, e.g.
 >> wip/lua-{stdlib,lrexlib-{onig,pcre,posix}}.
 >>
 >> Current Lua version is 5.1 and modules should be installed
 >> to lib/lua/5.1 directory, but it's not clear for me how
 >> to detect this directory properly from modules' Makefile.
 >>
 >> Probably lang/lua/module.mk should be created for this.
 >> Has anybody any idea? Or maybe somebody can implement this.
 >>
 >> lang/lua is assigned to pkgsrc-users@, so I'm asking here.

> The big question is if lua will be like perl, with only one version at
> once, or like python.  It seems lua is stable enough that the
> one-version approach works, but I don't really know.

> I would suggest looking at lang/perl5/module.mk, which is probably too
> complicated, but doesn't have the PYVERSION complexity.

As was requested by Greg, I'm moving this discussion to tech-pkg@.

What do you think about C + D as a first version of Lua
modules support? With such version.mk and modules.mk Lua modules
will look like A + B.

Description. LUA_LMOD_{REL,}DIR and LUA_CMOD_{REL,}DIR
contain paths to .lua (written in Lua) and .so modules respectively.
I tried to make module's Makefile immune to future
changes in lang/lua/*.mk. It is possible
the situation (who knows) that several Lua interpreters (or forks)
will be a part of pkgsrc sometimes.
This is why I've introduced LUA_PKGNAME_PREFIX.

lang/lua/version.mk may also be included from lang/lua/Makefile.

The rest is trivial I think.

Any ideas?

#######################      A      ##################################
category/pkg/Makefile:
PKGNAME=        ${LUA_PKGNAME_PREFIX}${DISTNAME}
DISTNAME=       module-0.4.0
...
.include "../../lang/lua/modules.mk"
.include "../../mk/bsd.pkg.mk"

#######################      B      ##################################
category/pkg/PLIST:
@comment $NetBSD$
${LUA_LMOD_DIR}/module.lua

#######################      C      ##################################
lang/lua/version.mk:
# $NetBSD$

_LUA_VERSION=   5.1

#######################      D      ##################################
lang/lua/modules.mk:
# $NetBSD$

.if !defined(LUA_MOD_MK)
LUA_MOD_MK=     # defined

.include "../../lang/lua/version.mk"

LUA_PKGNAME_PREFIX=     lua-

LUA_LMOD_RELDIR=        share/lua/${_LUA_VERSION}
LUA_CMOD_RELDIR=        lib/lua/${_LUA_VERSION}

LUA_LMOD_DIR=   ${PREFIX}/${LUA_LMOD_RELDIR}
LUA_CMOD_DIR=   ${PREFIX}/${LUA_CMOD_RELDIR}

DEPENDS=        lua>=${_LUA_VERSION}.0<${_LUA_VERSION}.9999:../../lang/lua

PLIST_SUBST+=   LUA_LMOD_DIR=${LUA_LMOD_RELDIR}
PLIST_SUBST+=   LUA_CMOD_DIR=${LUA_CMOD_RELDIR}

.endif

######################################################################

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index