blob: 04a533f9291073b28133822f3a5d84d56c7fc4b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-stringy
pkgver=0.5.0
_pkgver=${pkgver%.*}-${pkgver##*.}
pkgrel=0
pkgdesc="Lua string utility library"
url="https://github.com/brentp/lua-stringy/"
arch="all"
license="MIT"
checkdepends=""
makedepends=""
subpackages=""
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
checkdepends="$checkdepends lua$_v"
makedepends="$makedepends lua$_v-dev"
subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done
prepare() {
default_prepare
local lver; for lver in $_luaversions; do
cp -r "$builddir" "$builddir-$lver"
done
}
build() {
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() {
mkdir -p "$pkgdir"
}
_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
}
sha512sums="899cd7921e7dcbc12c1b9d5891637566af7e9a0330b75e2bf31f83447618e981e7a2e88da065aca7525bd564e9d04d720b6f7138edea78007a8fc972dc5f59a2 lua-stringy-0.5.0.tar.gz
c3a8a6705e1b39a99e117f57e49263f676905775452787a1c8dc5a30eda51bc652d9bfe6c975bcb4ded9cb60a6bf70f6654dd31575f22f932be58474de01efba makefile.patch"
|