aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-hiredis/APKBUILD
blob: 190ce311b773fbc94731ece9016cb5545d40d632 (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
# Maintainer: Nathan Angelacos <nangel@alpinelinux.org>

_luaversions="5.1 5.2 5.3"

pkgname=lua-hiredis
pkgver=0.2.1
pkgrel=0
pkgdesc="Binding to libhiredis for Lua"
url="https://github.com/agladysh/lua-hiredis"
arch="all"
license="MIT"
depends=""
depends_dev=""
makedepends="$depends_dev hiredis-dev"
subpackages=""

for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#*lua-}:split_${_v/./_}"
	eval "split_${_v/./_}() { _split $_v; }"
done

install=""
source="lua-hiredis-$pkgver.tar.gz::https://github.com/agladysh/lua-hiredis/archive/v$pkgver.tar.gz
	0001-lua-5-3-compatibility.patch
	"

_builddir="$srcdir"/lua-hiredis-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	for _v in $_luaversions; do
		cp -r $_builddir "$srcdir"/$pkgname-$_v
	done
}

build() {
	cd "$_builddir"
}

package() {
	mkdir -p "$pkgdir"
}

_split() {
	local _ver="$1"
	cd "$srcdir"/$pkgname-$_ver || return 1
	pkgdesc="$pkgdesc (Lua $_ver)"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	${CC:-gcc} ${CFLAGS} $(pkg-config --cflags hiredis) \
		$(pkg-config --cflags lua$_ver) -shared -fPIC \
		-I/usr/include/lua$_ver -I/usr/include/hiredis \
		-o hiredis.so src/lua-hiredis.c \
		|| return 1
	install -Dm755 hiredis.so \
		"$subpkgdir"/usr/lib/lua/$_ver/hiredis.so || return 1
}

md5sums="edd68a6f0b39ba9cae100de275853696  lua-hiredis-0.2.1.tar.gz
acf9dc5b26d8ce3fa341099467ae8776  0001-lua-5-3-compatibility.patch"
sha256sums="38976799776cc702f4b8cc396babda4152975855d593a17da1343eeb2cebcb34  lua-hiredis-0.2.1.tar.gz
de2edefec93d90adf2b594e81a284b82f4b5712e9422fd3e4d41f84afdae9a80  0001-lua-5-3-compatibility.patch"
sha512sums="b53eea8b51ddfbfa4592e7a3bb004416edd6240a860656ec809b603349357d3e754a2b5f2a92cb33d0a46259beae86f1c99981e848193f112888982d97cb94b7  lua-hiredis-0.2.1.tar.gz
78f15aac6088dd37de5d462e9ac26c1c3d0ea3d5e783df155f4be5b5415113eb0954feea499335003e89c40768d8005b0d158101acc197aa80aa57109c32ffca  0001-lua-5-3-compatibility.patch"