diff options
author | alnsn <alnsn@pkgsrc.org> | 2014-05-03 13:00:44 +0000 |
---|---|---|
committer | alnsn <alnsn@pkgsrc.org> | 2014-05-03 13:00:44 +0000 |
commit | 5518944c52c286f0875d4454c1a3481e648b5e41 (patch) | |
tree | c339de9879e29da7d839e2bc71a8658a92217e0b /lang/lua | |
parent | 9ba2e769108b296d5c7ef0ded1233535cac28f7c (diff) | |
download | pkgsrc-5518944c52c286f0875d4454c1a3481e648b5e41.tar.gz |
Multiversion support for Lua.
Diffstat (limited to 'lang/lua')
-rw-r--r-- | lang/lua/application.mk | 6 | ||||
-rw-r--r-- | lang/lua/luaversion.mk | 17 | ||||
-rw-r--r-- | lang/lua/module.mk | 35 | ||||
-rw-r--r-- | lang/lua/tool.mk | 38 |
4 files changed, 89 insertions, 7 deletions
diff --git a/lang/lua/application.mk b/lang/lua/application.mk index eace97b1b23..45e5a1d76e0 100644 --- a/lang/lua/application.mk +++ b/lang/lua/application.mk @@ -1,4 +1,4 @@ -# $NetBSD: application.mk,v 1.3 2013/10/30 09:09:59 obache Exp $ +# $NetBSD: application.mk,v 1.4 2014/05/03 13:00:44 alnsn Exp $ # # This makefile fragment is intended to be included by packages that # install Lua scripts. @@ -11,11 +11,13 @@ # Keywords: Lua # +.if !defined(LUA_LUAVERSION_MK) .include "../../lang/lua/luaversion.mk" +.endif .if defined(REPLACE_LUA) REPLACE_INTERPRETER+= lua REPLACE.lua.old= .*lua -REPLACE.lua.new= ${LOCALBASE}/bin/lua +REPLACE.lua.new= ${LUA_INTERPRETER} REPLACE_FILES.lua= ${REPLACE_LUA} .endif diff --git a/lang/lua/luaversion.mk b/lang/lua/luaversion.mk index 40b6de560f0..bb96f485529 100644 --- a/lang/lua/luaversion.mk +++ b/lang/lua/luaversion.mk @@ -1,4 +1,4 @@ -# $NetBSD: luaversion.mk,v 1.4 2013/11/05 11:26:44 obache Exp $ +# $NetBSD: luaversion.mk,v 1.5 2014/05/03 13:00:44 alnsn Exp $ # This file determins which Lua version is used as a dependency for # a package. @@ -47,6 +47,17 @@ # # Example: lua51 # +# LUA_INCDIR +# Relative path to include files. +# +# Example: include/lua-51 +# +# LUA_INTERPRETER +# Full path to Lua interpreter. +# +# LUA_COMPILER +# Full path to Lua bytecode compiler (luac). +# # Keywords: Lua # @@ -127,4 +138,8 @@ PKG_FAIL_REASION+= "No valid Lua version found" .include "${LUA_PKGSRCDIR}/version.mk" _LUA_DOT_VERSION= ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} +LUA_INCDIR= include/lua-${_LUA_DOT_VERSION} +LUA_INTERPRETER= ${LOCALBASE}/bin/lua${_LUA_DOT_VERSION} +LUA_COMPILER= ${LOCALBASE}/bin/luac${_LUA_DOT_VERSION} + .endif # LUA_LUAVERSION_MK diff --git a/lang/lua/module.mk b/lang/lua/module.mk index 83128cb68d4..62b05d17c77 100644 --- a/lang/lua/module.mk +++ b/lang/lua/module.mk @@ -1,16 +1,39 @@ -# $NetBSD: module.mk,v 1.5 2013/10/30 06:18:09 dholland Exp $ +# $NetBSD: module.mk,v 1.6 2014/05/03 13:00:44 alnsn Exp $ # # This Makefile fragment is intended to be included by packages that -# install Lua packages. +# install Lua modules. +# +# === Defined variables === +# +# LUA_LDIR +# Path where Lua modules are installed. +# +# LUA_CDIR +# Path where Lua C modules are installed. Not defined if +# NO_BUILD variable is set to "yes". +# +# LUA_DOCDIR +# Path where documentation files are installed. +# +# LUA_EXAMPLESDIR +# Path where example files are installed. +# +# Keywords: lua +# .if !defined(LUA_MODULE_MK) LUA_MODULE_MK= # defined +.if !defined(LUA_LUAVERSION_MK) .include "../../lang/lua/luaversion.mk" +.endif LUA_LDIR= share/lua/${_LUA_DOT_VERSION} PLIST_SUBST+= LUA_LDIR=${LUA_LDIR} +PRINT_PLIST_AWK+= /^${LUA_LDIR:S|/|\\/|g}/ \ + { gsub(/${LUA_LDIR:S|/|\\/|g}/, "$${LUA_LDIR}") } + .if defined(NO_BUILD) && empty(NO_BUILD:M[Nn][Oo]) DEPENDS+= ${LUA_BASEDEPENDS} @@ -18,12 +41,16 @@ DEPENDS+= ${LUA_BASEDEPENDS} LUA_CDIR= lib/lua/${_LUA_DOT_VERSION} PLIST_SUBST+= LUA_CDIR=${LUA_CDIR} -PRINT_PLIST_AWK+= /^${LUA_LDIR:S|/|\\/|g}/ \ - { gsub(/${LUA_LDIR:S|/|\\/|g}/, "$${LUA_LDIR}") } PRINT_PLIST_AWK+= /^${LUA_CDIR:S|/|\\/|g}/ \ { gsub(/${LUA_CDIR:S|/|\\/|g}/, "$${LUA_CDIR}") } .include "${LUA_PKGSRCDIR}/buildlink3.mk" .endif +LUA_DOCDIR= share/doc/${PKGBASE} +PLIST_SUBST+= LUA_DOCDIR=${LUA_DOCDIR} + +LUA_EXAMPLESDIR= share/examples/${PKGBASE} +PLIST_SUBST+= LUA_EXAMPLESDIR=${LUA_EXAMPLESDIR} + .endif # LUA_MODULE_MK diff --git a/lang/lua/tool.mk b/lang/lua/tool.mk new file mode 100644 index 00000000000..28f8e581191 --- /dev/null +++ b/lang/lua/tool.mk @@ -0,0 +1,38 @@ +# $NetBSD: tool.mk,v 1.1 2014/05/03 13:00:44 alnsn Exp $ +# +# Create `lua' interpreter wrapper for applicable Lua bin. +# +# This mk fragment can be included in all packages that uses `lua' +# as a tool without version suffix. +# +# Keywords: Lua +# + +.if !defined(LUA_TOOL_MK) +LUA_TOOL_MK= defined + +.if !defined(LUA_LUAVERSION_MK) +.include "../../lang/lua/luaversion.mk" +.endif + +BUILDLINK_TARGETS+= buildlink-bin-lua buildlink-bin-luac + +.PHONY: buildlink-bin-lua +buildlink-bin-lua: + ${RUN} \ + f="${LUA_INTERPRETER}"; \ + t="${BUILDLINK_DIR}/bin/lua"; \ + if ${TEST} -f $$f -a ! -f $$t ; then \ + ${LN} -sf $$f $$t; \ + fi + +.PHONY: buildlink-bin-luac +buildlink-bin-luac: + ${RUN} \ + f="${LUA_COMPILER}"; \ + t="${BUILDLINK_DIR}/bin/luac"; \ + if ${TEST} -f $$f -a ! -f $$t ; then \ + ${LN} -sf $$f $$t; \ + fi + +.endif # LUA_TOOL_MK |