diff options
Diffstat (limited to 'main/lua-rex')
-rw-r--r-- | main/lua-rex/APKBUILD | 88 |
1 files changed, 66 insertions, 22 deletions
diff --git a/main/lua-rex/APKBUILD b/main/lua-rex/APKBUILD index 1a8a5aca36..9631e4fd60 100644 --- a/main/lua-rex/APKBUILD +++ b/main/lua-rex/APKBUILD @@ -1,50 +1,94 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> +_luaversions="5.1 5.2 5.3" pkgname=lua-rex -pkgver=2.5.3 -pkgrel=1 +pkgver=2.8.0 +pkgrel=0 pkgdesc="Lua bindings to regular expression library pcre and posix" url="http://lrexlib.luaforge.net/" arch="all" license="MIT" depends="lua-rex-pcre lua-rex-posix" -makedepends="pcre-dev lua-dev" +makedepends="pcre-dev" install= -subpackages="$pkgname-pcre $pkgname-posix" -source="http://luaforge.net/frs/download.php/4759/lrexlib-2.5.3.zip" +subpackages="$pkgname-pcre:_pcre $pkgname-posix:_posix" -_builddir="$srcdir"/lrexlib-$pkgver +for _i in $_luaversions; do + makedepends="$makedepends lua$_i-dev lua$_i" + subpackages="$subpackages lua$_i-rex-pcre:_pcre_${_i/./_} + lua$_i-rex-posix:_posix_${_i/./_}" + + eval "_pcre_${_i/./_}() { _split $_i pcre; }" + eval "_posix_${_i/./_}() { _split $_i posix; }" +done + +source="$pkgname-$pkgver.tar.gz::https://github.com/rrthomas/lrexlib/archive/rel-${pkgver//./-}.tar.gz" + +_builddir="$srcdir"/lrexlib-rel-${pkgver//./-} prepare() { - cd "$_builddir" - sed -i -e "s/^MYCFLAGS.*/MYCFLAGS = $CFLAGS -fPIC/" src/defaults.mak - sed -i -e "s/^LD .*/LD = gcc/" \ - src/common.mak + local _ver + for _ver in $_luaversions; do + cp -r "$_builddir" "$srcdir"/build-$_ver + done +} + +_build_variant() { + local _ver=$1 + local _obj=$2 + local _flags="$3" + + ${CC:-gcc} \ + ${CFLAGS} \ + $(pkg-config --cflags lua$_ver) \ + -shared \ + -fPIC \ + -o $_obj.${pkgver%.*} \ + $_flags \ + -DVERSION=\"$pkgver\" \ + -DLUA_COMPAT_5_2 || return 1 + ln -s $_obj.${pkgver%.*} $_obj || return 1 } build() { - cd "$_builddir" - make -j1 -C src/pcre - make -j1 -C src/posix + local _ver + for _ver in $_luaversions; do + msg "build for Lua $_ver" + cd "$srcdir"/build-$_ver + _build_variant $_ver rex_pcre.so \ + 'src/common.c src/pcre/lpcre.c src/pcre/lpcre_f.c + -lpcre' || return 1 + _build_variant $_ver rex_posix.so \ + 'src/common.c src/posix/lposix.c' || return 1 + done } package() { mkdir -p "$pkgdir" } -pcre() { +_pcre() { pkgdesc="Lua bindings to pcre regular expressions library" depends= - cd "$_builddir" - install -d "$subpkgdir"/usr/lib/lua/5.1 - cp -a src/pcre/rex_pcre.so* "$subpkgdir"/usr/lib/lua/5.1 + mkdir -p "$subpkgdir" } -posix() { +_posix() { pkgdesc="Lua bindings to posix regular expressions library" depends= - cd "$_builddir" - install -d "$subpkgdir"/usr/lib/lua/5.1 - cp -a src/posix/rex_posix.so* "$subpkgdir"/usr/lib/lua/5.1 + mkdir -p "$subpkgdir" +} + +_split() { + local _ver=$1 + local _lib=$2 + pkgdesc="Lua $_ver bindings to $_lib regular expressions library" + install_if="lua$_ver lua-rex-$_lib=$pkgver-r$pkgrel" + depends= + install -d "$subpkgdir"/usr/lib/lua/$_ver || return 1 + cp -a "$srcdir"/build-$_ver/rex_$_lib.so* \ + "$subpkgdir"/usr/lib/lua/$_ver || return 1 } -md5sums="a51c5ff54d85bfd1222ddbfd922a7d51 lrexlib-2.5.3.zip" +md5sums="25b88d455e3d389ab431568290060af5 lua-rex-2.8.0.tar.gz" +sha256sums="d47f2de3340b30c75a849feaf02f79de5a8adf735edf631bbd58447db2101822 lua-rex-2.8.0.tar.gz" +sha512sums="9593263541757f384df327c85a01df648767041c494f9f7b3491a521e7d4f94918b967c48adff6794bc93baf3b4a11add6feb4630de8bf53903ff7a819c1b006 lua-rex-2.8.0.tar.gz" |