diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-12-28 00:04:38 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-12-28 00:08:06 +0100 |
commit | dbcde1d7670408ec11a976b205ca9bf6a6b9e291 (patch) | |
tree | ac1dff76d63263e55de348917c1f3b22e2ad8877 | |
parent | 40cd52c03ab5e1686b41fca0ae6caf7412e34252 (diff) | |
download | aports-dbcde1d7670408ec11a976b205ca9bf6a6b9e291.tar.bz2 aports-dbcde1d7670408ec11a976b205ca9bf6a6b9e291.tar.xz |
main/lua-stringy: improve abuild, add check() and rock manifest
-rw-r--r-- | main/lua-stringy/APKBUILD | 90 | ||||
-rw-r--r-- | main/lua-stringy/makefile.patch | 12 |
2 files changed, 60 insertions, 42 deletions
diff --git a/main/lua-stringy/APKBUILD b/main/lua-stringy/APKBUILD index 09c83be394..ec42cb7815 100644 --- a/main/lua-stringy/APKBUILD +++ b/main/lua-stringy/APKBUILD @@ -1,71 +1,77 @@ # Contributor: Natanael Copa <ncopa@alpinelinux.org> # Maintainer: Natanael Copa <ncopa@alpinelinux.org> - -_luaversions="5.1 5.2 5.3" pkgname=lua-stringy pkgver=0.4.0 -pkgrel=5 +_pkgver=${pkgver%.*}-${pkgver##*.} +pkgrel=6 pkgdesc="Lua string utility library" url="https://github.com/brentp/lua-stringy/" arch="all" license="MIT" -depends="" +checkdepends="" makedepends="" -install="" subpackages="" -source="lua-stringy-$pkgver.tar.gz::https://github.com/brentp/lua-stringy/archive/v$pkgver.tar.gz" +source="$pkgname-$pkgver.tar.gz::https://github.com/brentp/$pkgname/archive/v$pkgver.tar.gz + makefile.patch" +builddir="$srcdir/$pkgname-$pkgver/stringy" +# luajit is not available on s390x. +case "$CARCH" in + s390x) _luajit="";; + *) checkdepends="$checkdepends luajit" _luajit="jit";; +esac + +_luaversions="5.1 5.2 5.3" for _v in $_luaversions; do - makedepends="$makedepends lua$_v lua$_v-dev" - subpackages="$subpackages lua$_v-stringy:split_${_v/./_}" + checkdepends="$checkdepends lua$_v" + makedepends="$makedepends lua$_v-dev" + subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage" done - -_builddir="$srcdir"/lua-stringy-$pkgver/stringy prepare() { - local i - cd "$_builddir" - for i in $source; do - case $i in - *.patch) msg $i; patch -p2 -i "$srcdir"/$i || return 1;; - esac + default_prepare + + local lver; for lver in $_luaversions; do + cp -r "$builddir" "$builddir-$lver" done } build() { - cd "$_builddir" - for _v in $_luaversions; do - make CC="${CC:-gcc}" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ - LUA_PC="lua$_v" LUA="lua$_v" || return 1 - mv stringy.so stringy.so.$_v - make clean + local lver; for lver in $_luaversions; do + msg "Building for Lua $lver..." + make -C "$builddir-$lver" \ + CC="${CC:-gcc}" \ + LUA_PC="lua$lver" \ + LUA="lua$lver" done } -package() { - local d - cd "$_builddir" - for _v in $_luaversions; do - d=$pkgdir/usr/lib/lua/$_v - mkdir -p "$d" || return 1 - cp stringy.so.$_v "$d/stringy.so" +check() { + local lver; for lver in $_luaversions $_luajit; do + msg "Testing on lua$lver..." + cd "$builddir-${lver/jit/5.1}" + lua$lver stringy_test.lua done } -_split() { - local d=usr/lib/lua _ver=$1 - pkgdesc="$pkgdesc for Lua $_ver" - install_if="lua$_ver $pkgname=$pkgver-r$pkgrel" - depends= - mkdir -p "$subpkgdir/$d" || return 1 - mv "$pkgdir/$d/$1" "$subpkgdir/$d" +package() { + mkdir -p "$pkgdir" } -for _v in $_luaversions; do - eval "split_${_v/./_}() { _split $_v; }" -done +_subpackage() { + local lver="${subpkgname:3:3}" + pkgdesc="$pkgdesc (for Lua $lver)" + depends="lua$lver" + install_if="$pkgname=$pkgver-r$pkgrel lua$lver" + local cmoddir="$subpkgdir/$(pkg-config --variable=INSTALL_CMOD lua$lver)" + local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$pkgname/$_pkgver" + + install -m 755 -D "$builddir-$lver"/stringy.so "$cmoddir"/stringy.so + + mkdir -p "$rockdir" + echo 'rock_manifest = {}' > "$rockdir"/rock_manifest +} -md5sums="00a3bb395cc91b597df7d7931c226c47 lua-stringy-0.4.0.tar.gz" -sha256sums="ec4a97a9d0294b8b2df6b5d94576414c4f29e782c4ef7ac6fcff07cd73757e3c lua-stringy-0.4.0.tar.gz" -sha512sums="909a0d6da308ed97d394b953456446151476a27a122fca503187f13f61a71d94ee3561a179c7d5307db517a31eaaa5b58b53d5abaa6912da3d46fc0dbb3dcc6c lua-stringy-0.4.0.tar.gz" +sha512sums="909a0d6da308ed97d394b953456446151476a27a122fca503187f13f61a71d94ee3561a179c7d5307db517a31eaaa5b58b53d5abaa6912da3d46fc0dbb3dcc6c lua-stringy-0.4.0.tar.gz +c3a8a6705e1b39a99e117f57e49263f676905775452787a1c8dc5a30eda51bc652d9bfe6c975bcb4ded9cb60a6bf70f6654dd31575f22f932be58474de01efba makefile.patch" diff --git a/main/lua-stringy/makefile.patch b/main/lua-stringy/makefile.patch new file mode 100644 index 0000000000..8dc3a70548 --- /dev/null +++ b/main/lua-stringy/makefile.patch @@ -0,0 +1,12 @@ +Tests are run in check phase. + +--- a/Makefile ++++ b/Makefile +@@ -13,7 +13,6 @@ + + stringy.so: stringy.o stringy_test.lua + $(CC) -shared stringy.o -o $@ +- $(LUA) stringy_test.lua + + clean: + rm -f stringy.so stringy.o *.rock |