summaryrefslogtreecommitdiff
path: root/community/luasql
diff options
context:
space:
mode:
Diffstat (limited to 'community/luasql')
-rw-r--r--community/luasql/PKGBUILD62
-rw-r--r--community/luasql/lua52.patch283
2 files changed, 333 insertions, 12 deletions
diff --git a/community/luasql/PKGBUILD b/community/luasql/PKGBUILD
index 54aff4c20..399192c50 100644
--- a/community/luasql/PKGBUILD
+++ b/community/luasql/PKGBUILD
@@ -1,22 +1,60 @@
-# $Id: PKGBUILD 61380 2011-12-29 16:34:45Z spupykin $
+# $Id: PKGBUILD 81122 2012-12-12 00:49:33Z eric $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
-# Maintainer: Anders Bergh <anders1@gmail.com>
+# Contributor: Sébastien Luttringer <seblu@archlinux.org>
+# Contributor: Anders Bergh <anders1@gmail.com>
-pkgname=luasql-mysql
+pkgbase=luasql
+pkgname=('lua-sql-mysql' 'lua-sql-postgres' 'lua-sql-sqlite')
pkgver=2.2.0
pkgrel=1
-pkgdesc="MySQL module for Lua"
arch=('i686' 'x86_64')
-url="http://www.keplerproject.org/luasql/"
+url='http://www.keplerproject.org/luasql/'
license=('MIT')
-depends=('lua' 'libmysqlclient')
-source=(https://github.com/downloads/keplerproject/luasql/luasql-$pkgver.tar.gz)
-md5sums=('59d72db444c6369c936d4f03694db6b7')
+conflicts=('luasql-mysql')
+makedepends=('lua' 'libmysqlclient' 'postgresql-libs' 'sqlite')
+source=("https://github.com/downloads/keplerproject/luasql/luasql-$pkgver.tar.gz"
+ 'lua52.patch')
+md5sums=('59d72db444c6369c936d4f03694db6b7'
+ 'a1d6083215e7a83cfc08621b6998914c')
build() {
- cd "$srcdir/luasql-$pkgver"
+ cd $pkgbase-$pkgver
+ patch -p1 < "$srcdir/lua52.patch"
+ msg2 'Building sqlite support'
+ make T=sqlite3 PREFIX=/usr DRIVER_LIBS='-lsqlite3' DRIVER_INCS='-fPIC -std=c99'
+ msg2 'Building PostgreSQL support'
+ make T=postgres PREFIX=/usr DRIVER_LIBS='-lpq' DRIVER_INCS='-fPIC'
+ msg2 'Building MySQL support'
make T=mysql PREFIX=/usr DRIVER_LIBS="$(mysql_config --libs)" \
- DRIVER_INCS="$(mysql_config --include) -fPIC"
- install -Dm644 src/mysql.so $pkgdir/usr/lib/lua/5.1/luasql/mysql.so
- install -Dm644 doc/us/license.html $pkgdir/usr/share/licenses/$pkgname/license.html
+ DRIVER_INCS="$(mysql_config --include) -fPIC"
}
+
+package_lua-sql-mysql() {
+ pkgdesc='MySQL module for Lua'
+ depends=('lua' 'libmysqlclient')
+ replaces=('luasql-mysql')
+
+ cd $pkgbase-$pkgver
+ install -Dm644 src/mysql.so "$pkgdir/usr/lib/lua/5.2/luasql/mysql.so"
+ install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
+}
+
+package_lua-sql-postgres() {
+ pkgdesc='PostgreSQL module for Lua'
+ depends=('lua' 'postgresql-libs')
+
+ cd $pkgbase-$pkgver
+ install -Dm644 src/postgres.so "$pkgdir/usr/lib/lua/5.2/luasql/postgres.so"
+ install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
+}
+
+package_lua-sql-sqlite() {
+ pkgdesc='SQLite module for Lua'
+ depends=('lua' 'sqlite')
+
+ cd $pkgbase-$pkgver
+ install -Dm644 src/sqlite3.so "$pkgdir/usr/lib/lua/5.2/luasql/sqlite3.so"
+ install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/luasql/lua52.patch b/community/luasql/lua52.patch
new file mode 100644
index 000000000..6f4eb59e0
--- /dev/null
+++ b/community/luasql/lua52.patch
@@ -0,0 +1,283 @@
+diff -wbBur luasql-2.2.0/src/ls_firebird.c luasql-2.2.0.my/src/ls_firebird.c
+--- luasql-2.2.0/src/ls_firebird.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_firebird.c 2012-11-14 19:06:50.508901839 +0400
+@@ -1008,13 +1008,13 @@
+ ** Create metatables for each class of object.
+ */
+ static void create_metatables (lua_State *L) {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_gc},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_gc},
+ {"close", conn_close},
+ {"execute", conn_execute},
+@@ -1024,7 +1024,7 @@
+ {"escape", conn_escape},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_gc},
+ {"close", cur_close},
+ {"fetch", cur_fetch},
+@@ -1043,7 +1043,7 @@
+ ** driver open method.
+ */
+ LUASQL_API int luaopen_luasql_firebird (lua_State *L) {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"firebird", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/ls_mysql.c luasql-2.2.0.my/src/ls_mysql.c
+--- luasql-2.2.0/src/ls_mysql.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_mysql.c 2012-11-14 19:06:56.782236770 +0400
+@@ -511,13 +511,13 @@
+ ** Create metatables for each class of object.
+ */
+ static void create_metatables (lua_State *L) {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_close},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_close},
+ {"close", conn_close},
+ {"escape", escape_string},
+@@ -528,7 +528,7 @@
+ {"getlastautoid", conn_getlastautoid},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_close},
+ {"close", cur_close},
+ {"getcolnames", cur_getcolnames},
+@@ -562,7 +562,7 @@
+ ** driver open method.
+ */
+ LUASQL_API int luaopen_luasql_mysql (lua_State *L) {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"mysql", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/ls_oci8.c luasql-2.2.0.my/src/ls_oci8.c
+--- luasql-2.2.0/src/ls_oci8.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_oci8.c 2012-11-14 19:06:39.182232288 +0400
+@@ -814,13 +814,13 @@
+ ** Create metatables for each class of object.
+ */
+ static void create_metatables (lua_State *L) {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_close},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_close},
+ {"close", conn_close},
+ {"execute", conn_execute},
+@@ -829,7 +829,7 @@
+ {"setautocommit", conn_setautocommit},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_close},
+ {"close", cur_close},
+ {"getcolnames", cur_getcolnames},
+@@ -850,7 +850,7 @@
+ ** driver open method.
+ */
+ LUASQL_API int luaopen_luasql_oci8 (lua_State *L) {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"oci8", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/ls_odbc.c luasql-2.2.0.my/src/ls_odbc.c
+--- luasql-2.2.0/src/ls_odbc.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_odbc.c 2012-11-14 19:06:53.652235973 +0400
+@@ -638,13 +638,13 @@
+ ** Create metatables for each class of object.
+ */
+ static void create_metatables (lua_State *L) {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_close},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_close},
+ {"close", conn_close},
+ {"execute", conn_execute},
+@@ -653,7 +653,7 @@
+ {"setautocommit", conn_setautocommit},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_close},
+ {"close", cur_close},
+ {"fetch", cur_fetch},
+@@ -701,7 +701,7 @@
+ ** driver open method.
+ */
+ LUASQL_API int luaopen_luasql_odbc (lua_State *L) {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"odbc", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/ls_postgres.c luasql-2.2.0.my/src/ls_postgres.c
+--- luasql-2.2.0/src/ls_postgres.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_postgres.c 2012-11-14 19:06:47.275567683 +0400
+@@ -551,13 +551,13 @@
+ ** Create metatables for each class of object.
+ */
+ static void create_metatables (lua_State *L) {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_gc},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_gc},
+ {"close", conn_close},
+ {"escape", conn_escape},
+@@ -567,7 +567,7 @@
+ {"setautocommit", conn_setautocommit},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_gc},
+ {"close", cur_close},
+ {"getcolnames", cur_getcolnames},
+@@ -600,7 +600,7 @@
+ ** driver open method.
+ */
+ LUASQL_API int luaopen_luasql_postgres (lua_State *L) {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"postgres", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/ls_sqlite3.c luasql-2.2.0.my/src/ls_sqlite3.c
+--- luasql-2.2.0/src/ls_sqlite3.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_sqlite3.c 2012-11-14 19:06:26.115562295 +0400
+@@ -560,13 +560,13 @@
+ */
+ static void create_metatables (lua_State *L)
+ {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_close},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_close},
+ {"close", conn_close},
+ {"escape", conn_escape},
+@@ -577,7 +577,7 @@
+ {"getlastautoid", conn_getlastautoid},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_close},
+ {"close", cur_close},
+ {"getcolnames", cur_getcolnames},
+@@ -611,7 +611,7 @@
+ */
+ LUASQL_API int luaopen_luasql_sqlite3(lua_State *L)
+ {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"sqlite3", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/ls_sqlite.c luasql-2.2.0.my/src/ls_sqlite.c
+--- luasql-2.2.0/src/ls_sqlite.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/ls_sqlite.c 2012-11-14 19:06:43.845566808 +0400
+@@ -518,13 +518,13 @@
+ */
+ static void create_metatables (lua_State *L)
+ {
+- struct luaL_reg environment_methods[] = {
++ struct luaL_Reg environment_methods[] = {
+ {"__gc", env_close},
+ {"close", env_close},
+ {"connect", env_connect},
+ {NULL, NULL},
+ };
+- struct luaL_reg connection_methods[] = {
++ struct luaL_Reg connection_methods[] = {
+ {"__gc", conn_close},
+ {"close", conn_close},
+ {"escape", conn_escape},
+@@ -534,7 +534,7 @@
+ {"setautocommit", conn_setautocommit},
+ {NULL, NULL},
+ };
+- struct luaL_reg cursor_methods[] = {
++ struct luaL_Reg cursor_methods[] = {
+ {"__gc", cur_close},
+ {"close", cur_close},
+ {"getcolnames", cur_getcolnames},
+@@ -568,7 +568,7 @@
+ */
+ LUASQL_API int luaopen_luasql_sqlite(lua_State *L)
+ {
+- struct luaL_reg driver[] = {
++ struct luaL_Reg driver[] = {
+ {"sqlite", create_environment},
+ {NULL, NULL},
+ };
+diff -wbBur luasql-2.2.0/src/luasql.c luasql-2.2.0.my/src/luasql.c
+--- luasql-2.2.0/src/luasql.c 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/luasql.c 2012-11-14 19:06:32.412230565 +0400
+@@ -60,7 +60,7 @@
+ /*
+ ** Create a metatable and leave it on top of the stack.
+ */
+-LUASQL_API int luasql_createmeta (lua_State *L, const char *name, const luaL_reg *methods) {
++LUASQL_API int luasql_createmeta (lua_State *L, const char *name, const luaL_Reg *methods) {
+ if (!luaL_newmetatable (L, name))
+ return 0;
+
+diff -wbBur luasql-2.2.0/src/luasql.h luasql-2.2.0.my/src/luasql.h
+--- luasql-2.2.0/src/luasql.h 2009-10-20 20:38:38.000000000 +0400
++++ luasql-2.2.0.my/src/luasql.h 2012-11-14 19:06:29.002229695 +0400
+@@ -22,7 +22,7 @@
+
+ LUASQL_API int luasql_faildirect (lua_State *L, const char *err);
+ LUASQL_API int luasql_failmsg (lua_State *L, const char *err, const char *m);
+-LUASQL_API int luasql_createmeta (lua_State *L, const char *name, const luaL_reg *methods);
++LUASQL_API int luasql_createmeta (lua_State *L, const char *name, const luaL_Reg *methods);
+ LUASQL_API void luasql_setmeta (lua_State *L, const char *name);
+ LUASQL_API void luasql_set_info (lua_State *L);
+