aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-06-05 08:02:07 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-06-05 08:26:16 +0000
commitfa2422284685c88f06b20fd5a089ae27a0f543ab (patch)
tree4c89ed293ce0f54e31ccc3630f32bf824d44fb84
parent8d61a971f145e0f6e70e71494ebec4b4cea56ab7 (diff)
downloadaports-fa2422284685c88f06b20fd5a089ae27a0f543ab.tar.bz2
aports-fa2422284685c88f06b20fd5a089ae27a0f543ab.tar.xz
main/lua-sql: merge lua-sql drivers
we build all the different sql drivers for all the different lua versions from a single APKBUILD
-rw-r--r--main/lua-sql-mysql/APKBUILD34
-rw-r--r--main/lua-sql-postgres/APKBUILD27
-rw-r--r--main/lua-sql-sqlite3/APKBUILD26
-rw-r--r--main/lua-sql/APKBUILD115
-rw-r--r--main/lua-sql/widechars.patch10
-rw-r--r--main/lua5.2-sql-sqlite3/APKBUILD33
6 files changed, 125 insertions, 120 deletions
diff --git a/main/lua-sql-mysql/APKBUILD b/main/lua-sql-mysql/APKBUILD
deleted file mode 100644
index 1b5f3a5723..0000000000
--- a/main/lua-sql-mysql/APKBUILD
+++ /dev/null
@@ -1,34 +0,0 @@
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-pkgname=lua-sql-mysql
-_name=luasql-mysql
-pkgver=2.3.0
-pkgrel=0
-pkgdesc="MySQL driver for LuaSQL (luasql-mysql)"
-url="http://www.keplerproject.org/luasql/"
-arch="all"
-license="MIT"
-depends="lua"
-makedepends="lua-dev mysql-dev"
-install=
-subpackages=
-source="saveas-https://github.com/keplerproject/luasql/archive/v$pkgver.tar.gz/luasql-$pkgver.tar.gz"
-replaces=luasql-mysql
-
-build() {
- cd "$srcdir"/luasql-$pkgver
-
- # The config has DRIVER_INCS but it seems like its not respected
- # so we just fix the .c file
- sed -i -e 's:^\#include "mysql.h":\#include <mysql/mysql.h>:' \
- src/ls_mysql.c || return 1
-
- make CFLAGS="-fPIC $CFLAGS" T=mysql DRIVER_LIBS="-lmysqlclient" || return 1
-}
-
-package() {
- cd "$srcdir"/luasql-$pkgver
- local _install_cmod=$(pkg-config --variable INSTALL_CMOD lua)
- install -D src/mysql.so "$pkgdir"/$_install_cmod/luasql/mysql.so
-}
-
-md5sums="af9f0f3a2313a1fcf88c40700092048d luasql-2.3.0.tar.gz"
diff --git a/main/lua-sql-postgres/APKBUILD b/main/lua-sql-postgres/APKBUILD
deleted file mode 100644
index abcb3898f4..0000000000
--- a/main/lua-sql-postgres/APKBUILD
+++ /dev/null
@@ -1,27 +0,0 @@
-# Contributor: Mika Havela <mika.havela@gmail.com>
-# Maintainer: Mika Havela <mika.havela@gmail.com>
-pkgname=lua-sql-postgres
-pkgver=2.2.0
-pkgrel=0
-pkgdesc="PostgreSQL driver for LuaSQL"
-url="http://www.keplerproject.org/luasql/"
-arch="all"
-license="MIT"
-depends="lua"
-makedepends="lua-dev postgresql-dev"
-install=
-subpackages=
-source="http://dev.alpinelinux.org/archive/$pkgname/luasql-$pkgver.tar.gz"
-replaces=luasql-postgres
-
-build() {
- cd "$srcdir/luasql-$pkgver"
- make CFLAGS="$CFLAGS" T=postgres DRIVER_LIBS="-lpq" || return 1
-}
-
-package() {
- cd "$srcdir/luasql-$pkgver"
- install -D src/postgres.so "$pkgdir"/usr/lib/lua/5.1/luasql/postgres.so
-}
-
-md5sums="59d72db444c6369c936d4f03694db6b7 luasql-2.2.0.tar.gz"
diff --git a/main/lua-sql-sqlite3/APKBUILD b/main/lua-sql-sqlite3/APKBUILD
deleted file mode 100644
index 56a9f7d7f2..0000000000
--- a/main/lua-sql-sqlite3/APKBUILD
+++ /dev/null
@@ -1,26 +0,0 @@
-# Maintainer: Natanael Copa <natanael.copa@gmail.com>
-pkgname=lua-sql-sqlite3
-pkgver=2.1.1
-pkgrel=4
-pkgdesc="LuaSQL driver for sqlite3"
-url="http://www.keplerproject.org/luasql/"
-arch="all"
-license="MIT"
-depends="lua"
-makedepends="lua-dev sqlite-dev"
-install=
-subpackages=
-source="http://luaforge.net/frs/download.php/2686/luasql-$pkgver.tar.gz"
-replaces=luasql-sqlite3
-
-build() {
- cd "$srcdir"/luasql-$pkgver
- make CFLAGS="$CFLAGS" T=sqlite3 DRIVER_LIBS="-lsqlite3" || return 1
-}
-
-package() {
- cd "$srcdir"/luasql-$pkgver
- install -D src/sqlite3.so "$pkgdir"/usr/lib/lua/5.1/luasql/sqlite3.so
-}
-
-md5sums="63bdd57de4b9d1be336ba112d8cb69eb luasql-2.1.1.tar.gz"
diff --git a/main/lua-sql/APKBUILD b/main/lua-sql/APKBUILD
new file mode 100644
index 0000000000..45eda19d03
--- /dev/null
+++ b/main/lua-sql/APKBUILD
@@ -0,0 +1,115 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+_luaversions="5.1 5.2"
+_drivers="mysql postgres sqlite3 odbc"
+
+pkgname=lua-sql
+pkgver=2.3.0
+pkgrel=0
+pkgdesc="Lua SQL drivers"
+url="http://www.keplerproject.org/luasql/"
+arch="all"
+license="MIT"
+depends=""
+makedepends="mysql-dev postgresql-dev sqlite-dev unixodbc-dev"
+install=
+subpackages=
+for _i in $_luaversions; do
+ makedepends="$makedepends lua$_i-dev"
+ for _j in $_drivers; do
+ subpackages="$subpackages lua$_i-sql-$_j:split_${_j}_${_i/./}"
+ done
+done
+for _j in $_drivers; do
+ subpackages="$subpackages lua-sql-$_j:split_${_j}"
+done
+
+source="luasql-$pkgver.tar.gz::https://github.com/keplerproject/luasql/archive/v$pkgver.tar.gz
+ widechars.patch"
+
+_sdir="$srcdir"/luasql-$pkgver
+prepare() {
+ cd "$_sdir"
+ # apply patches here
+
+ # The config has DRIVER_INCS but it seems like its not respected
+ # so we just fix the .c file
+ sed -i -e 's:^\#include "mysql.h":\#include <mysql/mysql.h>:' \
+ src/ls_mysql.c || return 1
+
+ cd "$srcdir"
+ for _i in $_luaversions; do
+ cp -r "$_sdir" "$srcdir"/build-$_i
+ done
+}
+
+build() {
+ for _i in $_luaversions; do
+ msg "build for Lua $_i"
+ cd "$srcdir"/build-$_i
+ make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \
+ DRIVER_LIBS="-lmysqlclient" \
+ T=mysql || return 1
+
+ make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \
+ DRIVER_LIBS="$(pkg-config --libs libpq)" \
+ T=postgres || return 1
+
+ make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \
+ DRIVER_LIBS="$(pkg-config --libs sqlite3)" \
+ T=sqlite3 || return 1
+
+ make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC -DUNIXODBC" \
+ DRIVER_LIBS="-lodbc"\
+ T=odbc || return 1
+
+ done
+}
+
+package() {
+ for _i in $_luaversions; do
+ local _install_cmod=$(pkg-config --variable INSTALL_CMOD lua$_i)
+ cd "$srcdir"/build-$_i
+ for _j in $_drivers; do
+ install -D src/$_j.so \
+ "$pkgdir"/$_install_cmod/luasql/$_j.so \
+ || return 1
+ done
+ done
+}
+
+_split() {
+ local d= _ver=$1 _driver=$2
+ pkgdesc="Lua $_ver SQL driver for $2"
+ depends=
+ replaces=
+ if [ "$_ver" = "5.1" ]; then
+ replaces="lua-sql-$_driver"
+ fi
+ mkdir -p "$subpkgdir"/usr/lib/lua/$_ver/luasql
+ mv "$pkgdir"/usr/lib/lua/$_ver/luasql/$_driver.so \
+ "$subpkgdir"/usr/lib/lua/$_ver/luasql/ || return 1
+}
+
+for _i in $_luaversions; do
+ for _j in $_drivers; do
+ eval "split_${_j}_${_i/./}() { _split $_i $_j; }"
+ done
+done
+for _j in $_drivers; do
+ _deps=
+ for _i in $_luaversions; do
+ _deps="$_deps lua${_i}-sql-${_j}"
+ done
+ eval "split_$_j() {
+ pkgdesc=\"Lua SQL drivers for $_j\";
+ depends=\"$_deps\";
+ mkdir -p \"$subpkgdir\";
+ }"
+done
+
+md5sums="af9f0f3a2313a1fcf88c40700092048d luasql-2.3.0.tar.gz
+a706dfeb8cdfcca209b90755e8104545 widechars.patch"
+sha256sums="e173ff7b17a2757951b4b2f67d3b1bfe04caad7185b68cffa7758ce822e25e9f luasql-2.3.0.tar.gz
+89aed953834f9b6ed9998baac8454d7761f317d61513b532c17d0262c401a446 widechars.patch"
+sha512sums="62309cf6241ffab1ed32e718536a5c986168a7bb6fcf2cf55e884db5043d5ec473bbbb7c93b399dfc0a19f282e850f742452583ad0d973661a7f672b0f8da2d5 luasql-2.3.0.tar.gz
+b31fa46b99d06d6069c03679b7cef08412eee6d5e4606b02e02b98cb97e03c0b884d65390c1e80cf5a36fa41b3afba9cbbc441284ec3a1e725e3de7bc824908e widechars.patch"
diff --git a/main/lua-sql/widechars.patch b/main/lua-sql/widechars.patch
new file mode 100644
index 0000000000..784793348d
--- /dev/null
+++ b/main/lua-sql/widechars.patch
@@ -0,0 +1,10 @@
+--- a/src/ls_odbc.c
++++ b/src/ls_odbc.c
+@@ -150,6 +150,7 @@
+ case SQL_TYPE_DATE: case SQL_TYPE_TIME: case SQL_TYPE_TIMESTAMP:
+ case SQL_DATE: case SQL_INTERVAL: case SQL_TIMESTAMP:
+ case SQL_LONGVARCHAR:
++ case SQL_WCHAR: case SQL_WVARCHAR: case SQL_WLONGVARCHAR:
+ return "string";
+ case SQL_BIGINT: case SQL_TINYINT: case SQL_NUMERIC:
+ case SQL_DECIMAL: case SQL_INTEGER: case SQL_SMALLINT:
diff --git a/main/lua5.2-sql-sqlite3/APKBUILD b/main/lua5.2-sql-sqlite3/APKBUILD
deleted file mode 100644
index 34908e0844..0000000000
--- a/main/lua5.2-sql-sqlite3/APKBUILD
+++ /dev/null
@@ -1,33 +0,0 @@
-# Maintainer: Natanael Copa <natanael.copa@gmail.com>
-_luaver=5.2
-pkgname=lua$_luaver-sql-sqlite3
-pkgver=2.3.0
-pkgrel=0
-pkgdesc="Lua $_luaver SQL driver for sqlite3"
-url="http://www.keplerproject.org/luasql/"
-arch="all"
-license="MIT"
-depends=""
-makedepends="lua$_luaver-dev sqlite-dev"
-install=
-subpackages=
-source="luasql-$pkgver.tar.gz::https://github.com/keplerproject/luasql/archive/v$pkgver.tar.gz"
-
-build() {
- cd "$srcdir"/luasql-$pkgver
- local _sqlite_libs="$( pkg-config sqlite3 --libs )" || return 1
- local _lua_cflags="$( pkg-config lua$_luaver --cflags )" || return 1
- make CFLAGS="-fPIC $CFLAGS $_lua_cflags" \
- T=sqlite3 \
- DRIVER_LIBS="$_sqlite_libs" \
- || return 1
-}
-
-package() {
- cd "$srcdir"/luasql-$pkgver
- install -D src/sqlite3.so "$pkgdir"/usr/lib/lua/$_luaver/luasql/sqlite3.so
-}
-
-md5sums="af9f0f3a2313a1fcf88c40700092048d luasql-2.3.0.tar.gz"
-sha256sums="e173ff7b17a2757951b4b2f67d3b1bfe04caad7185b68cffa7758ce822e25e9f luasql-2.3.0.tar.gz"
-sha512sums="62309cf6241ffab1ed32e718536a5c986168a7bb6fcf2cf55e884db5043d5ec473bbbb7c93b399dfc0a19f282e850f742452583ad0d973661a7f672b0f8da2d5 luasql-2.3.0.tar.gz"