aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ldap/APKBUILD
blob: 77ea50252e151bd3763b2b6360421ac852a199b4 (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
# 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.6
pkgrel=0
pkgdesc="Lua binding to LDAP"
url="https://github.com/lualdap/lualdap"
arch="all"
license="MIT"
options="!check" # fails to detect correct builddir
makedepends="openldap-dev"
checkdepends="openldap openldap-back-bdb lua-busted"
source="$_pkgname-$pkgver.tar.gz::https://github.com/lualdap/lualdap/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

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

prepare() {
	default_prepare

	sed -i -e '/LUA_VERSION_NUM/d' config

	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..."

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

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

		cd "$builddir-$lver"
		make LUA_CPATH="src/?.so.$V" LUA=lua$lver check
	done
}

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

_package() {
	local lver="${subpkgname:3:3}"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"
	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)

	mkdir -p "$subpkgdir/usr/lib/lua/$lver"
	cd "$builddir-$lver"
	make DESTDIR="$subpkgdir" \
		LUA=lua$lver \
		LUA_LIBDIR="$(pkg-config --variable=INSTALL_CMOD lua$lver)" \
		install

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="e32010caa8efea5c23f2a595bd6a339267ecd08cf23e39389005bf8e499d6bad63771d0c7faf3ab5b8f670ba22bb15bf7ae691ed67920e86d8ed2c5649d7a079  lualdap-1.2.6.tar.gz"