mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
main/lua-stringy: improve abuild, add check() and rock manifest
This commit is contained in:
parent
40cd52c03a
commit
dbcde1d767
@ -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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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"
|
||||
done
|
||||
mkdir -p "$pkgdir"
|
||||
}
|
||||
|
||||
_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"
|
||||
_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
|
||||
}
|
||||
|
||||
for _v in $_luaversions; do
|
||||
eval "split_${_v/./_}() { _split $_v; }"
|
||||
done
|
||||
|
||||
|
||||
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"
|
||||
|
12
main/lua-stringy/makefile.patch
Normal file
12
main/lua-stringy/makefile.patch
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user