aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-09-16 09:54:37 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-09-16 09:54:37 +0000
commit41784e775538bdbe05e0c6a3a493095b152d0bcf (patch)
tree44f1812f93a9bb3fa1092e7a6ef9d01b4c1b9b51 /testing
parent0bcf492478624fc2fe36fc66289029a5ce53674f (diff)
downloadaports-41784e775538bdbe05e0c6a3a493095b152d0bcf.tar.bz2
aports-41784e775538bdbe05e0c6a3a493095b152d0bcf.tar.xz
testing/lua-struct: new aport
Library for Converting Data to and from C Structs for Lua http://www.inf.puc-rio.br/~roberto/struct/
Diffstat (limited to 'testing')
-rw-r--r--testing/lua-struct/APKBUILD73
-rw-r--r--testing/lua-struct/makefile.patch22
2 files changed, 95 insertions, 0 deletions
diff --git a/testing/lua-struct/APKBUILD b/testing/lua-struct/APKBUILD
new file mode 100644
index 0000000000..153bee00c2
--- /dev/null
+++ b/testing/lua-struct/APKBUILD
@@ -0,0 +1,73 @@
+# Maintailer: Natanael Copa <ncopa@alpinelinux.org>
+
+_luaversions="5.1 5.2"
+
+pkgname=lua-struct
+pkgver=0.2
+pkgrel=0
+pkgdesc="Library for Converting Data to and from C Structs for Lua"
+url="http://www.inf.puc-rio.br/~roberto/struct/"
+arch="all"
+license="MIT"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages=""
+source="http://www.inf.puc-rio.br/~roberto/struct/struct-$pkgver.tar.gz
+ makefile.patch
+ "
+
+for _i in $_luaversions; do
+ depends="$depends lua$_i-struct"
+ makedepends="$makedepends lua$_i-dev"
+ subpackages="$subpackages lua$_i-struct:_split${_i/./}"
+done
+
+_builddir="$srcdir"
+prepare() {
+ local i
+ 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
+ mkdir $i
+ cp makefile *.c $i/
+ done
+}
+
+build() {
+ for i in $_luaversions; do
+ cd "$_builddir"/$i
+ make OPT_CFLAGS="$CFLAGS" LUAPC="lua$i" || return 1
+ done
+
+}
+
+package() {
+ cd "$_builddir"
+ mkdir -p "$pkgdir"
+}
+
+_split() {
+ local _v=$1
+ pkgdesc="$pkgdesc - Lua $_v"
+ mkdir -p "$subpkgdir"/usr/lib/lua/$_v
+ install "$srcdir"/$_v/struct.so "$subpkgdir"/usr/lib/lua/$_v/struct.so \
+ || return 1
+}
+
+for _i in $_luaversions; do
+ eval "_split${_i/./}() { _split $_i; }"
+done
+
+
+md5sums="99384bf1f54457ec9f796ad0b539d19c struct-0.2.tar.gz
+45b8350d44a99d65ac7c1d2c33abd975 makefile.patch"
+sha256sums="c71d1f9f9f74ac74a973f75961285651200daf53dcb4316f23ba7bea6817a7a5 struct-0.2.tar.gz
+415cf549e0587252ab387f2ca624d2b17f511499908873b08774057e21da1b60 makefile.patch"
+sha512sums="6fea0bb2c04cdc47d402e0c8604bc78d9a68ec60f6d521ce031e4f9ede42fd2e2081f6732d74f2745883ad13bdef9f08fa4db5c0053fdc3204e2938dc01ea328 struct-0.2.tar.gz
+444ca21864ec92dde759f0f8f5d9990d029e9dbb1df908b092360b2eb9633c64079aff55ae91a4ea4de4c27a89243db195c2f460a03193e8c493c507387a1501 makefile.patch"
diff --git a/testing/lua-struct/makefile.patch b/testing/lua-struct/makefile.patch
new file mode 100644
index 0000000000..9d3867fe1c
--- /dev/null
+++ b/testing/lua-struct/makefile.patch
@@ -0,0 +1,22 @@
+--- ./makefile.orig
++++ ./makefile
+@@ -1,6 +1,5 @@
+-# point it to where the compiler can find the Lua header files (lua.h, etc.)
+-# LUADIR = ../lua
+-LUADIR = /usr/include/lua5.1/
++LUAPC?=lua5.1
++LUA_CFLAGS = $(shell pkg-config --cflags $(LUAPC))
+
+ # define your own "large" integer type; not defining a proper type
+ # will default to 'long', which may cause problems with 'size_t'
+@@ -16,8 +15,8 @@
+ -Wshadow \
+ -Wwrite-strings
+
+-CFLAGS = -D_POSIX_SOURCE $(CWARNS) $(INTTYPE) -O2 -I$(LUADIR)
+-CC = gcc
++OPT_CFLAGS ?= -O2
++CFLAGS = -D_POSIX_SOURCE $(CWARNS) $(INTTYPE) $(OPT_CFLAGS) $(LUA_CFLAGS)
+
+ struct.so: struct.c makefile
+ $(CC) $(CFLAGS) -shared -fpic -o struct.so struct.c