summaryrefslogtreecommitdiffstats
path: root/main/lua-augeas
diff options
context:
space:
mode:
Diffstat (limited to 'main/lua-augeas')
-rw-r--r--main/lua-augeas/0001-support-for-Lua-5.2.patch93
-rw-r--r--main/lua-augeas/APKBUILD67
2 files changed, 146 insertions, 14 deletions
diff --git a/main/lua-augeas/0001-support-for-Lua-5.2.patch b/main/lua-augeas/0001-support-for-Lua-5.2.patch
new file mode 100644
index 000000000..257dbb821
--- /dev/null
+++ b/main/lua-augeas/0001-support-for-Lua-5.2.patch
@@ -0,0 +1,93 @@
+From a6eace5116d1a711218a7c9086a4e3c4db88ee57 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 19 Jun 2013 14:52:00 +0200
+Subject: [PATCH] support for Lua 5.2
+
+---
+ Makefile | 2 +-
+ laugeas.c | 21 +++++++++++++++++----
+ 2 files changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index e79a48c..22dca18 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,7 +10,7 @@ else
+ FULL_VERSION := $(VERSION)
+ endif
+
+-LUAPC := $(shell for pc in lua lua5.1; do \
++LUAPC := $(shell for pc in lua lua5.2 lua5.1; do \
+ $(PKGCONFIG) --exists $$pc && echo $$pc && break; \
+ done)
+
+diff --git a/laugeas.c b/laugeas.c
+index 05b99c3..11a8736 100644
+--- a/laugeas.c
++++ b/laugeas.c
+@@ -4,6 +4,7 @@
+ -- In general, the functions map straight to the C library. See the
+ -- descriptions below for details.
+ */
++#include <assert.h>
+ #include <stdlib.h>
+
+ #include <lua.h>
+@@ -21,6 +22,18 @@
+
+ #define LUA_FILEHANDLE "FILE*"
+
++#if LUA_VERSION_NUM < 502
++# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l))
++# define luaL_setfuncs(L,l,n) (assert(n==0), luaL_register(L,NULL,l))
++#else
++static int luaL_typerror (lua_State *L, int narg, const char *tname)
++{
++ const char *msg = lua_pushfstring(L, "%s expected, got %s",
++ tname, luaL_typename(L, narg));
++ return luaL_argerror(L, narg, msg);
++}
++#endif
++
+ struct aug_flagmap {
+ const char *name;
+ int value;
+@@ -286,7 +299,7 @@ static int Paug_error_details(lua_State *L)
+ return 1;
+ }
+
+-static const luaL_reg Paug_methods[] = {
++static const luaL_Reg Paug_methods[] = {
+ /*
+ --- Initializes the library.
+ --
+@@ -363,7 +376,7 @@ function print(augobj, path, file_handle)
+ {NULL, NULL}
+ };
+
+-static const luaL_reg Luag_meta_methods[] = {
++static const luaL_Reg Laug_meta_methods[] = {
+ {"__gc", Paug_close},
+ {NULL, NULL}
+ };
+@@ -372,7 +385,7 @@ static const luaL_reg Luag_meta_methods[] = {
+ LUALIB_API int luaopen_augeas(lua_State *L)
+ {
+ struct aug_flagmap *f = Taug_flagmap;
+- luaL_register(L, LIBNAME, Paug_methods);
++ luaL_newlib(L, Paug_methods);
+ lua_pushliteral(L, "version");
+ lua_pushliteral(L, VERSION);
+ lua_settable(L, -3);
+@@ -385,7 +398,7 @@ LUALIB_API int luaopen_augeas(lua_State *L)
+ }
+
+ luaL_newmetatable(L, PAUG_META);
+- luaL_register(L, NULL, Luag_meta_methods);
++ luaL_setfuncs(L, Laug_meta_methods, 0);
+ lua_pushliteral(L, "__index");
+ lua_pushvalue(L, -3);
+ lua_rawset(L, -3);
+--
+1.8.3.1
+
diff --git a/main/lua-augeas/APKBUILD b/main/lua-augeas/APKBUILD
index d2b0d32c0..53ea3db85 100644
--- a/main/lua-augeas/APKBUILD
+++ b/main/lua-augeas/APKBUILD
@@ -1,32 +1,71 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+
+_luaversions="5.1 5.2"
+_defaultlua="5.1"
+
pkgname=lua-augeas
pkgver=0.1.2
-pkgrel=0
+pkgrel=1
pkgdesc="Lua bindings for Augeas"
url="http://git.alpinelinux.org/cgit/lua-augeas/"
arch="all"
license="LGPL"
-depends=
-makedepends="lua-dev pkgconfig augeas-dev"
+depends="lua$_defaultlua-augeas"
install=
-subpackages=
-source="http://git.alpinelinux.org/cgit/lua-augeas.git/snapshot/lua-augeas-$pkgver.tar.bz2"
+makedepends="augeas-dev"
+subpackages=""
+for _i in $_luaversions; do
+ makedepends="$makedepends lua$_i-dev"
+ subpackages="$subpackages lua$_i-augeas:split_${_i/./_}"
+done
+source="http://git.alpinelinux.org/cgit/lua-augeas.git/snapshot/lua-augeas-$pkgver.tar.bz2
+ 0001-support-for-Lua-5.2.patch"
-_builddir="$srcdir"/$pkgname-$pkgver
+_sdir="$srcdir"/lua-augeas-$pkgver
prepare() {
- cd "$_builddir"
+ cd "$_sdir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+ for _i in $_luaversions; do
+ cp -r "$_sdir" "$srcdir"/build-$_i
+ done
}
build() {
- cd "$_builddir"
- make || return 1
+ for _i in $_luaversions; do
+ cd "$srcdir"/build-$_i
+ make LUAPC=lua$_i || return 1
+ done
}
package() {
- cd "$_builddir"
- install -D augeas.so "$pkgdir"/usr/lib/lua/5.1/augeas.so
+ for _i in $_luaversions; do
+ install -D "$srcdir"/build-$_i/augeas.so \
+ "$pkgdir"/usr/lib/lua/$_i/augeas.so || return 1
+ done
}
-md5sums="20581b3eb4cc38491dec561ab9a9c156 lua-augeas-0.1.2.tar.bz2"
-sha256sums="1a4c273bdfad0106645fee85bcea2115b76ef7bab87cfad07c0c04eb331a85e3 lua-augeas-0.1.2.tar.bz2"
-sha512sums="3ccbb32d4d71a9d390e814084a91fc26d51f25d31a1ff3a1e9927c494d196fdbc3954ae763b18e3b6e938bba9090773e4ac5fdb93ebc6d3293dc6be351485459 lua-augeas-0.1.2.tar.bz2"
+_split() {
+ local d= _ver=$1
+ pkgdesc="Lua $_i bindings for Augeas"
+ replaces="$pkgname"
+ for d in usr/lib/lua usr/share/lua; do
+ if [ -d "$pkgdir"/$d/$_ver ]; then
+ mkdir -p "$subpkgdir"/$d
+ mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
+ fi
+ done
+}
+
+split_5_1() { _split 5.1; }
+split_5_2() { _split 5.2; }
+
+md5sums="20581b3eb4cc38491dec561ab9a9c156 lua-augeas-0.1.2.tar.bz2
+31296c5db6d0cf66c368f5c41b9147c1 0001-support-for-Lua-5.2.patch"
+sha256sums="1a4c273bdfad0106645fee85bcea2115b76ef7bab87cfad07c0c04eb331a85e3 lua-augeas-0.1.2.tar.bz2
+9ad43ff0492e0fa7d253fb55f62b5aee8e53374907fa11e16ba6b165dd4622df 0001-support-for-Lua-5.2.patch"
+sha512sums="3ccbb32d4d71a9d390e814084a91fc26d51f25d31a1ff3a1e9927c494d196fdbc3954ae763b18e3b6e938bba9090773e4ac5fdb93ebc6d3293dc6be351485459 lua-augeas-0.1.2.tar.bz2
+35ce609c0f34d88b3cd3a2edc6b7bc4332de9b06ad9b57a2fcc54c655399ad8e426b224e064d86146ccc1258ae7cb58a33d6187e7d5f396888a1d5a61637c940 0001-support-for-Lua-5.2.patch"