summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2013-10-30 06:18:09 +0000
committerdholland <dholland@pkgsrc.org>2013-10-30 06:18:09 +0000
commit75737aab7c1d8a7dfa60377ba3a2b441c7291eed (patch)
treea9c8d91a9a039b3bcdf7db23e51528c61b9b5c79 /lang
parent21eabb41879df6aca034c4dd4916cb9faaf345fd (diff)
downloadpkgsrc-75737aab7c1d8a7dfa60377ba3a2b441c7291eed.tar.gz
Reimport lang/lua as lang/lua52, and bring back the previous Lua 5.1
package as lang/lua51. I've adjusted the depends and switched the PKGNAMEs but these packages are otherwise unchanged. This means that you can't install both at once. There are preliminary patches for that (see tech-pkg) but they aren't quite ready yet. This also doesn't include agc's builtin.mk, although it should be possible to drop it into the lua51 package with only very minor modifications. I don't think the builtin packages will allow having one builtin.mk for both lua51 and lua52, but I'd be happy to be shown wrong about that. Add infrastructure support for Lua module packages (including multiversion support), application packages written in Lua, and a redirecting bl3.mk file for packages that just link Lua in. This is based on the Python infrastructure. The new variable LUA_VERSION_DEFAULT picks which Lua package you get by default; it is set to 52 so as to maintain the status quo. Packages can set LUA_VERSIONS_ACCEPTED and/or LUA_VERSIONS_INCOMPATIBLE. I have found (I think) most or all the packages that don't work with lua51 and will be marking those; I have not tracked down most of the ones that don't work with lua52 yet as I was originally intending to roll back to 5.1 as the default.
Diffstat (limited to 'lang')
-rw-r--r--lang/lua/application.mk21
-rw-r--r--lang/lua/buildlink3.mk27
-rw-r--r--lang/lua/luaversion.mk130
-rw-r--r--lang/lua/module.mk18
-rw-r--r--lang/lua51/DESCR (renamed from lang/lua/DESCR)0
-rw-r--r--lang/lua51/Makefile81
-rw-r--r--lang/lua51/PLIST49
-rw-r--r--lang/lua51/buildlink3.mk15
-rw-r--r--lang/lua51/distinfo8
-rw-r--r--lang/lua51/patches/patch-aa53
-rw-r--r--lang/lua51/patches/patch-ab80
-rw-r--r--lang/lua51/patches/patch-ac26
-rw-r--r--lang/lua51/version.mk6
-rw-r--r--lang/lua52/DESCR21
-rw-r--r--lang/lua52/Makefile (renamed from lang/lua/Makefile)6
-rw-r--r--lang/lua52/PLIST (renamed from lang/lua/PLIST)2
-rw-r--r--lang/lua52/buildlink3.mk15
-rw-r--r--lang/lua52/distinfo (renamed from lang/lua/distinfo)2
-rw-r--r--lang/lua52/files/lua.pc.in (renamed from lang/lua/files/lua.pc.in)2
-rw-r--r--lang/lua52/patches/patch-aa (renamed from lang/lua/patches/patch-aa)2
-rw-r--r--lang/lua52/patches/patch-ab (renamed from lang/lua/patches/patch-ab)2
-rw-r--r--lang/lua52/patches/patch-ac (renamed from lang/lua/patches/patch-ac)2
-rw-r--r--lang/lua52/version.mk (renamed from lang/lua/version.mk)2
23 files changed, 535 insertions, 35 deletions
diff --git a/lang/lua/application.mk b/lang/lua/application.mk
new file mode 100644
index 00000000000..c77044f996a
--- /dev/null
+++ b/lang/lua/application.mk
@@ -0,0 +1,21 @@
+# $NetBSD: application.mk,v 1.1 2013/10/30 06:18:09 dholland Exp $
+#
+# This makefile fragment is intended to be included by packages that
+# install Lua scripts.
+#
+# Package-settable variables:
+#
+# REPLACE_LUA
+# A list of Lua scripts ot be installed, relative to ${WRKSRC}.
+#
+# Keywords: Lua
+#
+
+.include "../../lang/lua/luaversion.mk"
+
+.if defined(REPLACE_LUA)
+REPLACE_INTERPRETER+= lua
+REPLACE.lua.old= .*lua
+REPLACE.lua.new= ${PREFIX}/bin/lua
+REPLACE_FILES.lua= ${REPLACE_LUA}
+.endif
diff --git a/lang/lua/buildlink3.mk b/lang/lua/buildlink3.mk
index 9dc17fc48a6..2271eedd08b 100644
--- a/lang/lua/buildlink3.mk
+++ b/lang/lua/buildlink3.mk
@@ -1,15 +1,12 @@
-# $NetBSD: buildlink3.mk,v 1.16 2013/07/15 02:02:23 ryoon Exp $
-
-BUILDLINK_TREE+= lua
-
-.if !defined(LUA_BUILDLINK3_MK)
-LUA_BUILDLINK3_MK:=
-
-BUILDLINK_API_DEPENDS.lua+= lua>=5.2.0
-BUILDLINK_ABI_DEPENDS.lua+= lua>=5.2.0
-BUILDLINK_PKGSRCDIR.lua?= ../../lang/lua
-
-.include "../../mk/readline.buildlink3.mk"
-.endif # LUA_BUILDLINK3_MK
-
-BUILDLINK_TREE+= -lua
+# $NetBSD: buildlink3.mk,v 1.17 2013/10/30 06:18:09 dholland Exp $
+#
+# This is a fake buildlink3.mk file. It figures out the Lua version
+# and then includes the real buildlink3.mk file for that Lua version.
+#
+# It is intended to be included by packages that embed the Lua
+# interpreter and therefore link against Lua.
+
+.include "../../lang/lua/luaversion.mk"
+.include "${LUA_PKGSRCDIR}/buildlink3.mk"
+
+BUILDLINK_PREFIX.lua= ${BUILDLINK_PREFIX.${LUA_PACKAGE}}
diff --git a/lang/lua/luaversion.mk b/lang/lua/luaversion.mk
new file mode 100644
index 00000000000..6b03a744571
--- /dev/null
+++ b/lang/lua/luaversion.mk
@@ -0,0 +1,130 @@
+# $NetBSD: luaversion.mk,v 1.1 2013/10/30 06:18:09 dholland Exp $
+
+# This file determins which Lua version is used as a dependency for
+# a package.
+#
+# === User-settable variables ===
+#
+# LUA_VERSION_DEFAULT
+# The preferred lua version to use.
+#
+# Possible values: 51 52
+# Default: 52
+#
+# === Infrastructure variables ===
+#
+# LUA_VERSION_REQD
+# Lua version to use. This variable should not be set by
+# packages; it is ordinarily set by multiversion builds.
+#
+# Possible values: ${LUA_VERSIONS_ACCEPTED}
+# Default: ${LUA_VERSION_DEFAULT}
+#
+# === Package-settable variables ===
+#
+# LUA_VERSIONS_ACCEPTED
+# The Lua versions that the package can build against. Order
+# is significant; those listed earlier are preferred over those
+# listed later.
+#
+# Possible values: 51 52
+# Default: 52 51
+#
+# LUA_VERSIONS_INCOMPATIBLE
+# The Lua versions that the package *cannot* build against.
+#
+# Possible values: 51 52
+# Default: <empty>
+#
+# LUA_SELF_CONFLICT
+# If set to "yes", CONFLICTS entries are added among the various
+# per-Lua-version variants of a multiversion package.
+#
+# === Defined variables ===
+#
+# LUA_PKGPREFIX
+# The prefix to use in PKGNAME for multiversion packages.
+#
+# Example: lua51
+#
+# Keywords: Lua
+#
+
+.if !defined (LUA_LUAVERSION_MK)
+LUA_LUAVERSION_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+BUILD_DEFS+= LUA_VERSION_DEFAULT
+BUILD_DEFS_EFFECTS+= LUAPACKAGE
+
+LUA_VERSION_DEFAULT?= 52
+LUA_VERSIONS_ACCEPTED?= 52 51
+LUA_VERSIONS_INCOMPATIBLE?=# empty
+
+#
+# Resolve LUA_VERSIONS_INCOMPATBLE and generate the _OK vars.
+#
+.for v in ${LUA_VERSIONS_ACCEPTED}
+.if empty(LUA_VERSIONS_INCOMPATIBLE:M${v})
+_LUA_VERSION_${v}_OK= yes
+_LUA_VERSIONS_ACCEPTED+= ${v}
+.endif
+.endfor
+
+# Pick a version
+.if defined(LUA_VERSION_REQD)
+. if defined(_LUA_VERSION_${LUA_VERSION_REQD}_OK)
+_LUA_VERSION= ${LUA_VERSION_REQD}
+. endif
+.else
+. if defined(_LUA_VERSION_${LUA_VERSION_DEFAULT}_OK)
+_LUA_VERSION?= ${LUA_VERSION_DEFAULT}
+. endif
+. for v in ${_LUA_VERSIONS_ACCEPTED}
+. if defined(_LUA_VERSION_${v}_OK)
+_LUA_VERSION?= ${v}
+. endif
+. endfor
+.endif
+
+#
+# Enable multiversion builds.
+#
+MULTI+= LUA_VERSION_REQD=${_LUA_VERSION}
+
+# In case nothing matched
+_LUA_VERSION?= none
+
+#
+# Handle self-conflicts
+#
+.if !empty(LUA_SELF_CONFLICT:M[Yy][Ee][Ss])
+.for v in ${_LUA_VERSIONS_ACCEPTED:N${_LUA_VERSION}}
+CONFLICTS+= ${PKGNAME:S/lua${_LUA_VERSION}/lua${v}/:C/-[0-9].*$/-[0-9]*/}
+.endfor
+.endif
+
+.if ${_LUA_VERSION} == "52"
+LUA_PACKAGE= lua52
+LUA_PKGSRCDIR= ../../lang/lua52
+LUA_PKGPREFIX= lua52
+LUA_BASEDEPENDS= lua52>=5.2<5.3${LUA_PKGSRCDIR}
+
+.elif ${_LUA_VERSION} == "51"
+LUA_PACKAGE= lua51
+LUA_PKGSRCDIR= ../../lang/lua51
+LUA_PKGPREFIX= lua51
+LUA_BASEDEPENDS= lua51>=5.1<5.2:${LUA_PKGSRCDIR}
+
+.else
+PKG_FAIL_REASION+= "No valid Lua version found"
+
+.endif
+
+#LUA_DEPENDS= ${BUILDLINK_API_DEPENDS.${LUA_PACKAGE}}:${LUA_PKGSRCDIR}
+
+.include "${LUA_PKGSRCDIR}/version.mk"
+_LUA_DOT_VERSION= ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+
+.endif # LUA_LUAVERSION_MK
diff --git a/lang/lua/module.mk b/lang/lua/module.mk
index d29d36fe90f..83128cb68d4 100644
--- a/lang/lua/module.mk
+++ b/lang/lua/module.mk
@@ -1,4 +1,4 @@
-# $NetBSD: module.mk,v 1.4 2013/09/17 12:03:09 joerg Exp $
+# $NetBSD: module.mk,v 1.5 2013/10/30 06:18:09 dholland Exp $
#
# This Makefile fragment is intended to be included by packages that
# install Lua packages.
@@ -6,18 +6,16 @@
.if !defined(LUA_MODULE_MK)
LUA_MODULE_MK= # defined
-.include "../../lang/lua/version.mk"
+.include "../../lang/lua/luaversion.mk"
-_LUA_VERSION= ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
-
-LUA_PKGPREFIX= lua
-LUA_LDIR= share/lua/${_LUA_VERSION}
+LUA_LDIR= share/lua/${_LUA_DOT_VERSION}
PLIST_SUBST+= LUA_LDIR=${LUA_LDIR}
.if defined(NO_BUILD) && empty(NO_BUILD:M[Nn][Oo])
-DEPENDS+= lua-${_LUA_VERSION}.*:../../lang/lua
+DEPENDS+= ${LUA_BASEDEPENDS}
+
.else
-LUA_CDIR= lib/lua/${_LUA_VERSION}
+LUA_CDIR= lib/lua/${_LUA_DOT_VERSION}
PLIST_SUBST+= LUA_CDIR=${LUA_CDIR}
PRINT_PLIST_AWK+= /^${LUA_LDIR:S|/|\\/|g}/ \
@@ -25,9 +23,7 @@ PRINT_PLIST_AWK+= /^${LUA_LDIR:S|/|\\/|g}/ \
PRINT_PLIST_AWK+= /^${LUA_CDIR:S|/|\\/|g}/ \
{ gsub(/${LUA_CDIR:S|/|\\/|g}/, "$${LUA_CDIR}") }
-BUILDLINK_API_DEPENDS.lua+= lua-${_LUA_VERSION}.*
-
-.include "../../lang/lua/buildlink3.mk"
+.include "${LUA_PKGSRCDIR}/buildlink3.mk"
.endif
.endif # LUA_MODULE_MK
diff --git a/lang/lua/DESCR b/lang/lua51/DESCR
index b3e57a165fe..b3e57a165fe 100644
--- a/lang/lua/DESCR
+++ b/lang/lua51/DESCR
diff --git a/lang/lua51/Makefile b/lang/lua51/Makefile
new file mode 100644
index 00000000000..1c5ef8e47f2
--- /dev/null
+++ b/lang/lua51/Makefile
@@ -0,0 +1,81 @@
+# $NetBSD: Makefile,v 1.1 2013/10/30 06:18:09 dholland Exp $
+
+DISTNAME= lua-${LUA_VERSION}
+PKGNAME= lua51-${LUA_VERSION}
+CATEGORIES= lang
+MASTER_SITES= http://www.lua.org/ftp/ \
+ http://www.tecgraf.puc-rio.br/lua/ftp/
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://www.lua.org/
+COMMENT= Powerful light-weight language for extending applications
+LICENSE= mit
+
+.include "../../lang/lua51/version.mk"
+
+PKG_INSTALLATION_TYPES= overwrite pkgviews
+CONFLICTS+= lua-[0-9]*
+
+.include "../../mk/bsd.prefs.mk"
+
+USE_LIBTOOL= yes
+USE_TOOLS+= gmake
+MAKE_ENV+= DLLIB=${BUILDLINK_LDADD.dl:Q}
+MAKE_ENV+= INSTALL_DATA=${INSTALL_DATA:Q}
+CFLAGS+= -DLUA_ROOT=\"${PREFIX}/\"
+
+MAKE_FLAGS+= CC=cc
+
+DOCDIR= ${PREFIX}/share/doc/lua
+EGDIR= ${PREFIX}/share/examples/lua
+
+.if ${OPSYS} == "FreeBSD"
+BUILD_TARGET= freebsd
+.elif !empty(OPSYS:M*BSD*) || ${OPSYS} == "DragonFly"
+BUILD_TARGET= bsd
+.elif ${OPSYS} == "Linux"
+BUILD_TARGET= linux
+.elif ${OPSYS} == "Darwin"
+BUILD_TARGET= macosx
+.elif ${OPSYS} == "SunOS"
+BUILD_TARGET= solaris
+.elif ${OPSYS} == "AIX"
+BUILD_TARGET= aix
+.else
+BUILD_TARGET= generic
+.endif
+
+PKGCONFIG_OVERRIDE= ${WRKSRC}/etc/lua.pc
+
+INSTALLATION_DIRS+= lib/pkgconfig
+
+SUBST_CLASSES+= pc-prefix
+SUBST_FILES.pc-prefix+= ${WRKSRC}/etc/lua.pc
+SUBST_SED.pc-prefix+= -e "s,/usr/local,${PREFIX},"
+SUBST_STAGE.pc-prefix= post-build
+
+post-install:
+ ${INSTALL_DATA_DIR} ${DESTDIR}${DOCDIR}
+ set -e; \
+ cd ${WRKSRC}; for f in README COPYRIGHT HISTORY; do \
+ ${INSTALL_DATA} "$$f" ${DESTDIR}${DOCDIR}; \
+ done
+ set -e; \
+ cd ${WRKSRC}/doc; for f in *.html *.gif; do \
+ ${INSTALL_DATA} "$$f" ${DESTDIR}${DOCDIR}; \
+ done
+ ${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR}
+ set -e; \
+ cd ${WRKSRC}/test; for f in README *.lua; do \
+ ${INSTALL_DATA} "$$f" ${DESTDIR}${EGDIR}; \
+ done
+ ${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR}/etc
+ set -e; \
+ cd ${WRKSRC}/etc; for f in README *.c *.ico *.lua; do \
+ ${INSTALL_DATA} "$$f" ${DESTDIR}${EGDIR}/etc; \
+ done
+ ${INSTALL_DATA} ${WRKSRC}/etc/lua.pc ${DESTDIR}${PREFIX}/lib/pkgconfig
+
+.include "../../devel/readline/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/lua51/PLIST b/lang/lua51/PLIST
new file mode 100644
index 00000000000..94f42a2b4ed
--- /dev/null
+++ b/lang/lua51/PLIST
@@ -0,0 +1,49 @@
+@comment $NetBSD: PLIST,v 1.1 2013/10/30 06:18:09 dholland Exp $
+bin/lua
+bin/luac
+include/lauxlib.h
+include/lua.h
+include/lua.hpp
+include/luaconf.h
+include/lualib.h
+lib/liblua.la
+lib/pkgconfig/lua.pc
+man/man1/lua.1
+man/man1/luac.1
+share/doc/lua/COPYRIGHT
+share/doc/lua/HISTORY
+share/doc/lua/README
+share/doc/lua/contents.html
+share/doc/lua/logo.gif
+share/doc/lua/lua.html
+share/doc/lua/luac.html
+share/doc/lua/manual.html
+share/doc/lua/readme.html
+share/examples/lua/README
+share/examples/lua/bisect.lua
+share/examples/lua/cf.lua
+share/examples/lua/echo.lua
+share/examples/lua/env.lua
+share/examples/lua/etc/README
+share/examples/lua/etc/all.c
+share/examples/lua/etc/lua.ico
+share/examples/lua/etc/min.c
+share/examples/lua/etc/noparser.c
+share/examples/lua/etc/strict.lua
+share/examples/lua/factorial.lua
+share/examples/lua/fib.lua
+share/examples/lua/fibfor.lua
+share/examples/lua/globals.lua
+share/examples/lua/hello.lua
+share/examples/lua/life.lua
+share/examples/lua/luac.lua
+share/examples/lua/printf.lua
+share/examples/lua/readonly.lua
+share/examples/lua/sieve.lua
+share/examples/lua/sort.lua
+share/examples/lua/table.lua
+share/examples/lua/trace-calls.lua
+share/examples/lua/trace-globals.lua
+share/examples/lua/xd.lua
+@pkgdir share/lua/5.1
+@pkgdir lib/lua/5.1
diff --git a/lang/lua51/buildlink3.mk b/lang/lua51/buildlink3.mk
new file mode 100644
index 00000000000..404d620ce63
--- /dev/null
+++ b/lang/lua51/buildlink3.mk
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.1 2013/10/30 06:18:09 dholland Exp $
+
+BUILDLINK_TREE+= lua51
+
+.if !defined(LUA51_BUILDLINK3_MK)
+LUA51_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.lua51+= lua51>=5.1.1<5.2
+BUILDLINK_ABI_DEPENDS.lua51+= lua51>=5.1.4nb1<5.2
+BUILDLINK_PKGSRCDIR.lua51?= ../../lang/lua51
+
+.include "../../devel/readline/buildlink3.mk"
+.endif # LUA51_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -lua51
diff --git a/lang/lua51/distinfo b/lang/lua51/distinfo
new file mode 100644
index 00000000000..c658de241f0
--- /dev/null
+++ b/lang/lua51/distinfo
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1 2013/10/30 06:18:09 dholland Exp $
+
+SHA1 (lua-5.1.5.tar.gz) = b3882111ad02ecc6b972f8c1241647905cb2e3fc
+RMD160 (lua-5.1.5.tar.gz) = b0c2234675335a8bf158a125b6778cf800c754a0
+Size (lua-5.1.5.tar.gz) = 221213 bytes
+SHA1 (patch-aa) = 25bcd22d3fc319c51356b7f976d0215eb04900db
+SHA1 (patch-ab) = 6f0964957112afbbc77648c86ae2a6ddd20c3389
+SHA1 (patch-ac) = bd2348dcb273de09ddc09da906c93de6cc209c5c
diff --git a/lang/lua51/patches/patch-aa b/lang/lua51/patches/patch-aa
new file mode 100644
index 00000000000..240e51a7662
--- /dev/null
+++ b/lang/lua51/patches/patch-aa
@@ -0,0 +1,53 @@
+$NetBSD: patch-aa,v 1.1 2013/10/30 06:18:10 dholland Exp $
+
+--- Makefile.orig 2008-08-12 01:40:48.000000000 +0100
++++ Makefile 2009-12-17 16:36:32.000000000 +0000
+@@ -9,11 +9,11 @@ PLAT= none
+
+ # Where to install. The installation starts in the src and doc directories,
+ # so take care if INSTALL_TOP is not an absolute path.
+-INSTALL_TOP= /usr/local
++INSTALL_TOP= ${PREFIX}
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+ INSTALL_INC= $(INSTALL_TOP)/include
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+-INSTALL_MAN= $(INSTALL_TOP)/man/man1
++INSTALL_MAN= $(INSTALL_TOP)/${PKGMANDIR}/man1
+ #
+ # You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
+@@ -24,7 +24,7 @@ INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+ # may have to run ranlib on the installed liblua.a (do "make ranlib").
+ INSTALL= install -p
+ INSTALL_EXEC= $(INSTALL) -m 0755
+-INSTALL_DATA= $(INSTALL) -m 0644
++#INSTALL_DATA= $(INSTALL) -m 0644
+ #
+ # If you don't have install you can use cp instead.
+ # INSTALL= cp -p
+@@ -43,7 +43,7 @@ PLATS= aix ansi bsd freebsd generic linu
+ # What to install.
+ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.la
+ TO_MAN= lua.1 luac.1
+
+ # Lua version and release.
+@@ -59,11 +59,11 @@ test: dummy
+ src/lua test/hello.lua
+
+ install: dummy
+- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+- cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
+- cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+- cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
++ cd src && $(MKDIR) $(DESTDIR)$(INSTALL_BIN) $(DESTDIR)$(INSTALL_INC) $(DESTDIR)$(INSTALL_LIB) $(DESTDIR)$(INSTALL_MAN) $(DESTDIR)$(INSTALL_LMOD) $(DESTDIR)$(INSTALL_CMOD)
++ cd src && $(LIBTOOL) --tag=CC --mode=install $(BSD_INSTALL_PROGRAM) $(TO_BIN) $(DESTDIR)$(INSTALL_BIN)
++ cd src && $(INSTALL_DATA) $(TO_INC) $(DESTDIR)$(INSTALL_INC)
++ cd src && $(LIBTOOL) --tag=CC --mode=install $(BSD_INSTALL_LIB) $(TO_LIB) $(DESTDIR)$(INSTALL_LIB)
++ cd doc && $(INSTALL_DATA) $(TO_MAN) $(DESTDIR)$(INSTALL_MAN)
+
+ ranlib:
+ cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
diff --git a/lang/lua51/patches/patch-ab b/lang/lua51/patches/patch-ab
new file mode 100644
index 00000000000..320d7e6b283
--- /dev/null
+++ b/lang/lua51/patches/patch-ab
@@ -0,0 +1,80 @@
+$NetBSD: patch-ab,v 1.1 2013/10/30 06:18:10 dholland Exp $
+
+--- src/Makefile.orig 2012-02-13 20:41:22.000000000 +0000
++++ src/Makefile
+@@ -7,8 +7,8 @@
+ # Your platform. See PLATS for possible values.
+ PLAT= none
+
+-CC= gcc
+-CFLAGS= -O2 -Wall $(MYCFLAGS)
++CC?= gcc
++CFLAGS+= -Wall $(MYCFLAGS)
+ AR= ar rcu
+ RANLIB= ranlib
+ RM= rm -f
+@@ -18,22 +18,32 @@ MYCFLAGS=
+ MYLDFLAGS=
+ MYLIBS=
+
++.SUFFIXES: .lo
++.c.lo:
++ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) -c $<
++LV= 5:1
++
+ # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
+
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+
+-LUA_A= liblua.a
+-CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
++LUA_XA= liblua.a
++LUA_A= liblua.la
++XCORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
+ lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
+ lundump.o lvm.o lzio.o
+-LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
++XLIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
+ lstrlib.o loadlib.o linit.o
++CORE_O= $(XCORE_O:.o=.lo)
++LIB_O= $(XLIB_O:.o=.lo)
+
+ LUA_T= lua
+-LUA_O= lua.o
++LUA_XO= lua.o
++LUA_O= $(LUA_XO:.o=.lo)
+
+ LUAC_T= luac
+-LUAC_O= luac.o print.o
++LUAC_XO= luac.o print.o
++LUAC_O= $(LUAC_XO:.o=.lo)
+
+ ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
+ ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+@@ -48,14 +58,13 @@ o: $(ALL_O)
+ a: $(ALL_A)
+
+ $(LUA_A): $(CORE_O) $(LIB_O)
+- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
+- $(RANLIB) $@
++ ${LIBTOOL} --tag=CC --mode=link ${CC} ${LDFLAGS} -o $@ ${CORE_O} ${LIB_O} -rpath ${PREFIX}/lib -version-info ${LV} ${LIBS}
+
+ $(LUA_T): $(LUA_O) $(LUA_A)
+- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
++ ${LIBTOOL} --tag=CC --mode=link $(CC) -o $@ ${LDFLAGS} $(LUA_O) $(LUA_A) $(LIBS)
+
+ $(LUAC_T): $(LUAC_O) $(LUA_A)
+- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
++ ${LIBTOOL} --tag=CC --mode=link $(CC) -static -o $@ ${LDFLAGS} $(LUAC_O) $(LUA_A) $(LIBS)
+
+ clean:
+ $(RM) $(ALL_T) $(ALL_O)
+@@ -87,7 +96,7 @@ ansi:
+ $(MAKE) all MYCFLAGS=-DLUA_ANSI
+
+ bsd:
+- $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
++ $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE" MYLIBS="-Wl,-E -lreadline -lhistory"
+
+ freebsd:
+ $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline"
diff --git a/lang/lua51/patches/patch-ac b/lang/lua51/patches/patch-ac
new file mode 100644
index 00000000000..ac51e09a473
--- /dev/null
+++ b/lang/lua51/patches/patch-ac
@@ -0,0 +1,26 @@
+$NetBSD: patch-ac,v 1.1 2013/10/30 06:18:10 dholland Exp $
+
+- allow LUA_ROOT to be set by the pkgsrc makefile
+- solaris fix for PR 43350
+
+--- src/luaconf.h.orig 2008-02-11 16:25:08.000000000 +0000
++++ src/luaconf.h
+@@ -94,7 +94,9 @@
+ ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
+
+ #else
++#ifndef LUA_ROOT
+ #define LUA_ROOT "/usr/local/"
++#endif
+ #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
+ #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
+ #define LUA_PATH_DEFAULT \
+@@ -183,7 +185,7 @@
+ #define LUAI_DATA /* empty */
+
+ #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
+- defined(__ELF__)
++ defined(__ELF__) && !defined(__sun)
+ #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
+ #define LUAI_DATA LUAI_FUNC
+
diff --git a/lang/lua51/version.mk b/lang/lua51/version.mk
new file mode 100644
index 00000000000..a7b44a95770
--- /dev/null
+++ b/lang/lua51/version.mk
@@ -0,0 +1,6 @@
+# $NetBSD: version.mk,v 1.1 2013/10/30 06:18:09 dholland Exp $
+
+LUA_VERSION= 5.1.5
+
+LUA_VERSION_MAJOR= ${LUA_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/}
+LUA_VERSION_MINOR= ${LUA_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/}
diff --git a/lang/lua52/DESCR b/lang/lua52/DESCR
new file mode 100644
index 00000000000..b3e57a165fe
--- /dev/null
+++ b/lang/lua52/DESCR
@@ -0,0 +1,21 @@
+Lua is a powerful, light-weight programming language designed for
+extending applications. Lua is also frequently used as a
+general-purpose, stand-alone language.
+
+Lua combines simple procedural syntax (similar to Pascal) with
+powerful data description constructs based on associative arrays and
+extensible semantics. Lua is dynamically typed, interpreted from
+bytecodes, and has automatic memory management, making it ideal for
+configuration, scripting, and rapid prototyping.
+
+Lua is a language engine that you can embed into your application.
+This means that, besides syntax and semantics, Lua has an API that
+allows the application to exchange data with Lua programs and also to
+extend Lua with C functions. In this sense, Lua can be regarded as a
+language framework for building domain-specific languages.
+
+Lua is implemented as a small library of C functions, written in ANSI
+C, and compiles unmodified in all known platforms. The implementation
+goals are simplicity, efficiency, portability, and low embedding cost.
+The result is a fast language engine with small footprint, making it
+ideal in embedded systems too.
diff --git a/lang/lua/Makefile b/lang/lua52/Makefile
index 3ecf16a2e28..387eb791e2f 100644
--- a/lang/lua/Makefile
+++ b/lang/lua52/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.51 2013/07/15 02:02:23 ryoon Exp $
+# $NetBSD: Makefile,v 1.1 2013/10/30 06:18:10 dholland Exp $
DISTNAME= lua-${LUA_VERSION}
+PKGNAME= lua52-${LUA_VERSION}
CATEGORIES= lang
MASTER_SITES= http://www.lua.org/ftp/ \
http://www.tecgraf.puc-rio.br/lua/ftp/
@@ -10,9 +11,10 @@ HOMEPAGE= http://www.lua.org/
COMMENT= Powerful light-weight language for extending applications
LICENSE= mit
-.include "../../lang/lua/version.mk"
+.include "../../lang/lua52/version.mk"
PKG_INSTALLATION_TYPES= overwrite pkgviews
+CONFLICTS+= lua-[0-9]*
.include "../../mk/bsd.prefs.mk"
diff --git a/lang/lua/PLIST b/lang/lua52/PLIST
index 3a062702eb0..6a5e8ad82a7 100644
--- a/lang/lua/PLIST
+++ b/lang/lua52/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.14 2013/07/04 18:04:42 adam Exp $
+@comment $NetBSD: PLIST,v 1.1 2013/10/30 06:18:10 dholland Exp $
bin/lua
bin/luac
include/lauxlib.h
diff --git a/lang/lua52/buildlink3.mk b/lang/lua52/buildlink3.mk
new file mode 100644
index 00000000000..26c629a8cf5
--- /dev/null
+++ b/lang/lua52/buildlink3.mk
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.1 2013/10/30 06:18:10 dholland Exp $
+
+BUILDLINK_TREE+= lua52
+
+.if !defined(LUA52_BUILDLINK3_MK)
+LUA52_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.lua52+= lua52>=5.2.0
+BUILDLINK_ABI_DEPENDS.lua52+= lua52>=5.2.0
+BUILDLINK_PKGSRCDIR.lua52?= ../../lang/lua52
+
+.include "../../mk/readline.buildlink3.mk"
+.endif # LUA52_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -lua52
diff --git a/lang/lua/distinfo b/lang/lua52/distinfo
index 163b649a756..caf1b1a983a 100644
--- a/lang/lua/distinfo
+++ b/lang/lua52/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.29 2013/07/04 18:04:42 adam Exp $
+$NetBSD: distinfo,v 1.1 2013/10/30 06:18:10 dholland Exp $
SHA1 (lua-5.2.2.tar.gz) = 0857e41e5579726a4cb96732e80d7aa47165eaf5
RMD160 (lua-5.2.2.tar.gz) = d17967150017e9b25a26c1ad527647cd0b9e598f
diff --git a/lang/lua/files/lua.pc.in b/lang/lua52/files/lua.pc.in
index 92692eb3228..787d06f6d8d 100644
--- a/lang/lua/files/lua.pc.in
+++ b/lang/lua52/files/lua.pc.in
@@ -1,4 +1,4 @@
-# $NetBSD: lua.pc.in,v 1.1 2013/07/04 18:04:42 adam Exp $
+# $NetBSD: lua.pc.in,v 1.1 2013/10/30 06:18:10 dholland Exp $
# lua.pc is not any longer distributed, but is still required by other packages.
prefix= @PREFIX@
diff --git a/lang/lua/patches/patch-aa b/lang/lua52/patches/patch-aa
index 9d74ecab4ff..66315e4a442 100644
--- a/lang/lua/patches/patch-aa
+++ b/lang/lua52/patches/patch-aa
@@ -1,4 +1,4 @@
-$NetBSD: patch-aa,v 1.20 2013/07/04 18:04:42 adam Exp $
+$NetBSD: patch-aa,v 1.1 2013/10/30 06:18:10 dholland Exp $
--- Makefile.orig 2012-05-17 14:05:54.000000000 +0000
+++ Makefile
diff --git a/lang/lua/patches/patch-ab b/lang/lua52/patches/patch-ab
index 0bf21d99d5c..f07b7a55f87 100644
--- a/lang/lua/patches/patch-ab
+++ b/lang/lua52/patches/patch-ab
@@ -1,4 +1,4 @@
-$NetBSD: patch-ab,v 1.15 2013/07/04 18:04:42 adam Exp $
+$NetBSD: patch-ab,v 1.1 2013/10/30 06:18:10 dholland Exp $
--- src/Makefile.orig 2012-12-27 10:51:43.000000000 +0000
+++ src/Makefile
diff --git a/lang/lua/patches/patch-ac b/lang/lua52/patches/patch-ac
index 5171a4856ed..bd4b27e7e6a 100644
--- a/lang/lua/patches/patch-ac
+++ b/lang/lua52/patches/patch-ac
@@ -1,4 +1,4 @@
-$NetBSD: patch-ac,v 1.10 2013/07/04 18:04:42 adam Exp $
+$NetBSD: patch-ac,v 1.1 2013/10/30 06:18:10 dholland Exp $
--- src/luaconf.h.orig 2013-03-16 21:10:18.000000000 +0000
+++ src/luaconf.h
diff --git a/lang/lua/version.mk b/lang/lua52/version.mk
index 5d8b84d6538..91829e15b53 100644
--- a/lang/lua/version.mk
+++ b/lang/lua52/version.mk
@@ -1,4 +1,4 @@
-# $NetBSD: version.mk,v 1.3 2013/07/04 18:04:42 adam Exp $
+# $NetBSD: version.mk,v 1.1 2013/10/30 06:18:10 dholland Exp $
LUA_VERSION= 5.2.2