# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka pkgname=lua-xml _rockname=xml pkgver=1.1.3 pkgrel=0 pkgdesc="Very fast XML parser for Lua based on RapidXML" url="https://github.com/lubyk/xml" arch="all" license="MIT BSL-1.0" depends="lua-lub" checkdepends="lua-lut" makedepends="" subpackages="" source="https://github.com/lubyk/$_rockname/archive/REL-$pkgver/$pkgname-$pkgver.tar.gz" builddir="$srcdir/$_rockname-REL-$pkgver" # luajit is not available for s390x case "$CARCH" in s390x|aarch64) _luajit="";; *) checkdepends="$checkdepends luajit" _luajit="jit";; esac _luaversions="5.1 5.2 5.3" for _v in $_luaversions; do makedepends="$makedepends lua$_v-dev luarocks$_v" subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage" done build() { cd "$builddir" local lver; for lver in $_luaversions; do msg "Building for Lua $lver..." luarocks-$lver \ CC="$CC" \ CFLAGS="$CFLAGS -fPIC" \ LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \ LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \ make --tree=./build-$lver \ $_rockname-$pkgver-*.rockspec done } check() { cd "$builddir" local lver; for lver in $_luaversions $_luajit; do msg "Testing on lua$lver" ln -sf ../build-${lver/jit/5.1}/lib/lua/${lver/jit/5.1}/xml/core.so xml/ lua$lver test/all.lua done } package() { mkdir -p "$pkgdir" } _subpackage() { local lver="${subpkgname:3:3}" pkgdesc="$pkgdesc (for Lua $lver)" depends="$depends lua$lver" install_if="$pkgname=$pkgver-r$pkgrel lua$lver" local rocksdir="$subpkgdir/usr/lib/luarocks/rocks-$lver" mkdir -p "$subpkgdir"/usr cp -r "$builddir"/build-$lver/* "$subpkgdir"/usr/ rm -r "$rocksdir"/manifest "$rocksdir"/$_rockname/*/doc } sha512sums="fdbfab6aaf46e71a02a2ac6dd0b3f708ee7e712f9704a2b834c2240696519dbcbb28fcee555bd6f12f992ee8713597aaee4b7057efcc1c004303bbe0f2223776 lua-xml-1.1.3.tar.gz"