aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-05-10 14:07:26 +0300
committerTimo Teräs <timo.teras@iki.fi>2014-05-10 14:07:26 +0300
commit664ab287e76baeccff5ab7c556a477f08a42fec4 (patch)
tree451e8efe5177a7cfced6b512584d965d102fb84e
parent6fbca72d680bb7ce7bccb41c86becf1762b042c1 (diff)
downloadaports-664ab287e76baeccff5ab7c556a477f08a42fec4.tar.bz2
aports-664ab287e76baeccff5ab7c556a477f08a42fec4.tar.xz
main/lua-pc: build for lua5.1 and lua5.2
-rw-r--r--main/lua-pc/APKBUILD64
-rw-r--r--main/lua-pc/lpc-lua5.2-compat.patch41
2 files changed, 95 insertions, 10 deletions
diff --git a/main/lua-pc/APKBUILD b/main/lua-pc/APKBUILD
index 20707585d1..ee96cc1e7c 100644
--- a/main/lua-pc/APKBUILD
+++ b/main/lua-pc/APKBUILD
@@ -1,25 +1,69 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+
+_luaversions="5.1 5.2"
+
pkgname=lua-pc
_name=lpc
pkgver=1.0.0
-pkgrel=4
+pkgrel=5
pkgdesc="Lua Process Call"
url="https://github.com/LuaDist/lpc"
arch="all"
license="MIT/X11"
-makedepends="lua-dev"
-depends="lua"
-source="http://dev.alpinelinux.org/archive/lpc/lpc-$pkgver.tar.gz"
+makedepends=""
+depends="lua5.1-pc"
+source="http://dev.alpinelinux.org/archive/lpc/lpc-$pkgver.tar.gz
+ lpc-lua5.2-compat.patch
+ "
+
+for _i in $_luaversions; do
+ makedepends="$makedepends lua$_i-dev"
+ subpackages="$subpackages lua$_i-pc:_pc_${_i/./_}"
+done
+
+_builddir="$srcdir/$_name-$pkgver"
+
+prepare() {
+ cd "$_builddir"
+ 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 "$_builddir" "$srcdir"/build-$_i
+ done
+}
build() {
- cd "$srcdir/$_name-$pkgver"
- make CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS -shared"
+ for _i in $_luaversions; do
+ cd "$srcdir"/build-$_i
+ make LUA_PKGCONF="lua$_i" \
+ CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS -shared" \
+ || return 1
+ done
}
package() {
- cd "$srcdir/$_name-$pkgver"
- # does not respect DESTDIR
- make install PREFIX="$pkgdir"/usr
+ mkdir -p "$pkgdir"
}
-md5sums="a8cd8b0c190e7d72dd7ec2f76e74e3c8 lpc-1.0.0.tar.gz"
+_split_pc() {
+ local _ver=$1
+ pkgdesc="$pkgdesc for Lua $_ver"
+
+ mkdir -p "$subpkgdir"
+ cd "$srcdir"/build-$_ver
+ make install LUA_PKGCONF="lua$_ver" PREFIX="$subpkgdir"/usr
+}
+
+for _i in $_luaversions; do
+ eval "_pc_${_i/./_}() { _split_pc $_i; }"
+done
+
+md5sums="a8cd8b0c190e7d72dd7ec2f76e74e3c8 lpc-1.0.0.tar.gz
+7ef6e6439837a31ca4e9ea63c6a887b1 lpc-lua5.2-compat.patch"
+sha256sums="2fbbdfbbfa03a70792bb83655f3e1f990fcb972c55a074717ba417514261805c lpc-1.0.0.tar.gz
+c495eafd855f964a95dfea16e0ca4670a2b92463ae4157136ed61f9802ba79f1 lpc-lua5.2-compat.patch"
+sha512sums="a955f802b9ea7c4615b8b22b1f4ab540d41e4ddb0edb5e1b77f2f2e1472c49248cb276f8bfec6b929d23ef01681a0018db6cbd401ade1cc1eb366b0a6ace9772 lpc-1.0.0.tar.gz
+ff731dd87ed4e9d4f0651747ed2d39a45cf6a637f279f4f9c40209f1b3ee54093a069e6d3adcf19399a07a3b32077fc15e73f35c908df32c3b8369b57af93f87 lpc-lua5.2-compat.patch"
diff --git a/main/lua-pc/lpc-lua5.2-compat.patch b/main/lua-pc/lpc-lua5.2-compat.patch
new file mode 100644
index 0000000000..17a9aaab4b
--- /dev/null
+++ b/main/lua-pc/lpc-lua5.2-compat.patch
@@ -0,0 +1,41 @@
+diff -ru lpc-1.0.0.orig/Makefile lpc-1.0.0/Makefile
+--- lpc-1.0.0.orig/Makefile 2012-08-21 17:39:10.000000000 -0300
++++ lpc-1.0.0/Makefile 2014-05-10 13:52:18.833865486 -0300
+@@ -1,16 +1,20 @@
+-LUA_PREFIX = /usr/local/
+-PREFIX = /usr/local/
++LUA_PKGCONF ?= lua
++
+ MODULE = lpc
+ VERSION = 1.0.0
+
+-INSTALL_PREFIX = $(PREFIX)/lib/lua/5.1/
++ifneq ($(shell pkg-config $(LUA_PKGCONF) || echo not-installed),)
++$(error $(LUA_PKGCONF).pc not found)
++endif
++
++INSTALL_PREFIX = $(PREFIX)$(shell pkg-config $(LUA_PKGCONF) --variable=INSTALL_CMOD)
+
+ CC = gcc
+ TARGET = lpc.so
+ OBJS = lpc.o
+ LIBS =
+-CFLAGS = -I $(LUA_PREFIX)/include -fPIC
+-LDFLAGS = -shared -fPIC
++CFLAGS = $(shell pkg-config $(LUA_PKGCONF) --cflags) -fPIC
++LDFLAGS = $(shell pkg-config $(LUA_PKGCONF) --libs) -shared -fPIC
+
+ default: $(TARGET)
+
+diff -ru lpc-1.0.0.orig/lpc.c lpc-1.0.0/lpc.c
+--- lpc-1.0.0.orig/lpc.c 2012-08-21 17:39:10.000000000 -0300
++++ lpc-1.0.0/lpc.c 2014-05-10 13:51:01.740949801 -0300
+@@ -192,7 +192,7 @@
+ lua_settable (L, -3);
+ }
+
+-static const struct luaL_reg lpclib[] =
++static const struct luaL_Reg lpclib[] =
+ {
+ {"run", lpc_run},
+ {"wait", lpc_wait},