aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ldap/APKBUILD
blob: 1ef54a71c1a24e71687e38c4ffdcfc90ca52254d (plain) (blame)
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
78
79
80
81
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-ldap
_pkgname=lualdap
pkgver=1.2.3
pkgrel=3
pkgdesc="Lua binding to LDAP"
url="https://github.com/bdellegrazie/lualdap"
arch="all"
license="MIT"
depends=""
makedepends="openldap-dev"
checkdepends="openldap openldap-back-bdb"
subpackages=""
source="$_pkgname-$pkgver.tar.gz::https://github.com/bdellegrazie/$_pkgname/archive/v$pkgver.tar.gz
	fix-open_simple-segfault.patch
	fix-search-iter.patch
	script-to-run-test.lua-against-a-dummy-slapd.patch
	update-test.lua-for-5.2.patch"
builddir="$srcdir/$_pkgname-$pkgver"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_package"
done

prepare() {
	default_prepare || return 1

	cd "$builddir"
	sed -i -e '/LUA_VERSION_NUM/d' config

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		cd "$builddir-$lver"
		make CFLAGS="-fPIC -ansi -Wall $(pkg-config --cflags lua$lver)" \
			OPENLDAP_LIB="-lldap -llber" || return 1
	done
}

check() {
	local lver; for lver in $_luaversions; do
		msg "Testing with Lua $lver..."

		cd "$builddir-$lver"
		make LUA=lua$lver check || return 1
	done
}

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

_package() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	replaces="lua$lver-lualdap"  # for backward compatibility (v3.5)
	[ "$lver" = "5.1" ] && replaces="${replaces:-} $pkgname"  # for backward compatibility (<v3.4)

	cd "$builddir-$lver"
	make DESTDIR="$subpkgdir" \
		LUA_LIBDIR="$(pkg-config --variable=INSTALL_CMOD lua$lver)" \
		install
}

sha512sums="51934d18d1ee97a0130545e657497e51542eef97c338df14e7171f94a2d6395fceb00313e1e64e46e6cdeedf85a17c63284595fdf6fbce8b7abce29d28f1b4a7  lualdap-1.2.3.tar.gz
6f71ec19be58e21778cdce0a28d52c2629df736a8cbd119e6b98a306f20df193c0a646449b40104490f992750d1fbcef4519238aca4b9706f7460a6238009769  fix-open_simple-segfault.patch
f1ba8e85421498abab814c20d2e410c5b13a6b63d0d56463ad38434405c5ae1cc694f168edfb37a0a727597f68dd67d511d234947b9df55d6322751275d4df61  fix-search-iter.patch
b769ef5d6a47a79d83b5f684414f4db5f316290d7b99de4e2f5a2d4fdad0d4e094dab6465578e534d4510f3dbc4a0bb1b1ff99ca9ad613a3736a2cf44e02db9c  script-to-run-test.lua-against-a-dummy-slapd.patch
970da7a53d050210298712742decdf2b617450e78ebaed993c73b5300870f2b1979661c83a82d316b37f26f373c2c86d6a024ab82c1b628c73f0ca6e9c61b0ac  update-test.lua-for-5.2.patch"