diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-12-04 21:50:48 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2016-12-04 21:51:18 +0100 |
commit | dbb0cc0ecabbafb4a523fa6ee55ff5c918207288 (patch) | |
tree | 3171a273dd342d1c2ef9286964b7908b51a88387 /main | |
parent | e9a11ed243f930c333e1fb09af51d022bf9b2b5e (diff) | |
download | aports-dbb0cc0ecabbafb4a523fa6ee55ff5c918207288.tar.bz2 aports-dbb0cc0ecabbafb4a523fa6ee55ff5c918207288.tar.xz |
main/lua-sql: simplify abuild
Diffstat (limited to 'main')
-rw-r--r-- | main/lua-sql/APKBUILD | 110 |
1 files changed, 46 insertions, 64 deletions
diff --git a/main/lua-sql/APKBUILD b/main/lua-sql/APKBUILD index ca36b4838a..0fe0f2ddf3 100644 --- a/main/lua-sql/APKBUILD +++ b/main/lua-sql/APKBUILD @@ -4,107 +4,89 @@ _luaversions="5.1 5.2 5.3" _drivers="mysql postgres sqlite3 odbc" pkgname=lua-sql +_pkgname=luasql pkgver=2.3.4 pkgrel=0 pkgdesc="Lua SQL drivers" url="http://keplerproject.github.io/luasql/doc/us/" arch="all" license="MIT" -depends="" makedepends="mariadb-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/./}" +subpackages="" +for _v in $_luaversions; do + makedepends="$makedepends lua$_v-dev" + for _d in $_drivers; do + subpackages="$subpackages lua$_v-sql-$_d:_subpackage" done done -for _j in $_drivers; do - subpackages="$subpackages lua-sql-$_j:split_${_j}" +for _d in $_drivers; do + subpackages="$subpackages lua-sql-$_d:_meta_subpackage" done -source="luasql-$pkgver.tar.gz::https://github.com/keplerproject/luasql/archive/v$pkgver.tar.gz" +source="$_pkgname-$pkgver.tar.gz::https://github.com/keplerproject/$_pkgname/archive/v$pkgver.tar.gz" +builddir="$srcdir/$_pkgname-$pkgver" -_sdir="$srcdir"/luasql-$pkgver prepare() { - cd "$_sdir" - for i in $source; do - case $i in - *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; - esac - done + default_prepare || return 1 - # apply patches here + cd "$builddir" # 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>:' \ + # so we just fix the .c file. + sed -i '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 + local lver; for lver in $_luaversions; do + cp -r "$builddir" "$builddir-$lver" || return 1 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" \ + local cflags lver + + for lver in $_luaversions; do + cflags="$CFLAGS $(pkg-config lua$lver --cflags) -fPIC" + + msg "Building for Lua $lver..." + cd "$builddir-$lver" + + make CFLAGS="$cflags" DRIVER_LIBS="-lmysqlclient" \ mysql || return 1 - make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \ - DRIVER_LIBS="$(pkg-config --libs libpq)" \ + make CFLAGS="$cflags" DRIVER_LIBS="$(pkg-config --libs libpq)" \ postgres || return 1 - make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC" \ - DRIVER_LIBS="$(pkg-config --libs sqlite3)" \ + make CFLAGS="$cflags" DRIVER_LIBS="$(pkg-config --libs sqlite3)" \ sqlite3 || return 1 - make CFLAGS="$CFLAGS $( pkg-config lua$_i --cflags ) -fPIC -DUNIXODBC" \ - DRIVER_LIBS="-lodbc"\ + make CFLAGS="$cflags -DUNIXODBC" DRIVER_LIBS="-lodbc" \ 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 + mkdir -p "$pkgdir" } -_split() { - local d= _ver=$1 _driver=$2 - pkgdesc="Lua $_ver SQL driver for $2" - install_if="lua$_ver lua-sql-$_driver=$pkgver-r$pkgrel" - depends= - replaces= - 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 +_meta_subpackage() { + local driver="${subpkgname##*-}" + pkgdesc="$pkgdesc for $driver" + + mkdir -p "$subpkgdir" } -for _i in $_luaversions; do - for _j in $_drivers; do - eval "split_${_j}_${_i/./}() { _split $_i $_j; }" - done -done -for _j in $_drivers; do - eval "split_$_j() { - pkgdesc=\"Lua SQL drivers for $_j\"; - mkdir -p \"$subpkgdir\"; - }" -done +_subpackage() { + local lver="${subpkgname:3:3}" + local driver="${subpkgname##*-}" + pkgdesc="Lua $lver SQL driver for $driver" + depends="lua$lver" + install_if="lua-sql-$driver=$pkgver-r$pkgrel lua$lver" + + cd "$builddir-$lver" + local install_cmod="$(pkg-config --variable INSTALL_CMOD lua$lver)" + install -D src/$driver.so \ + "$subpkgdir"/$install_cmod/luasql/$driver.so +} md5sums="e1219155ac996d45c984add3bba99815 luasql-2.3.4.tar.gz" sha256sums="690287d1aabceb636ad9be440c6d1717d755d975ab2f6300e15dcf4995cba1bd luasql-2.3.4.tar.gz" |