APKBUILD 2.99 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
2
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
Natanael Copa's avatar
Natanael Copa committed
3 4
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-ldap
5 6
_pkgname=lualdap
pkgver=1.2.3
7
pkgrel=5
8
pkgdesc="Lua binding to LDAP"
9
url="https://github.com/bdellegrazie/lualdap"
10
arch="all"
Natanael Copa's avatar
Natanael Copa committed
11 12
license="MIT"
depends=""
13
makedepends="openldap-dev"
14
checkdepends="openldap openldap-back-bdb"
15
subpackages=""
16 17
source="$_pkgname-$pkgver.tar.gz::https://github.com/bdellegrazie/$_pkgname/archive/v$pkgver.tar.gz
	fix-open_simple-segfault.patch
18
	fix-anonymous-bind.patch
19 20 21
	fix-search-iter.patch
	script-to-run-test.lua-against-a-dummy-slapd.patch
	update-test.lua-for-5.2.patch"
22
builddir="$srcdir/$_pkgname-$pkgver"
Natanael Copa's avatar
Natanael Copa committed
23

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

Natanael Copa's avatar
Natanael Copa committed
30
prepare() {
31 32 33
	default_prepare || return 1

	cd "$builddir"
Natanael Copa's avatar
Natanael Copa committed
34
	sed -i -e '/LUA_VERSION_NUM/d' config
35 36 37 38

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver" || return 1
	done
Natanael Copa's avatar
Natanael Copa committed
39 40 41
}

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

		cd "$builddir-$lver"
46
		make CFLAGS="-fPIC -ansi -Wall $(pkg-config --cflags lua$lver)" \
47 48
			OPENLDAP_LIB="-lldap -llber" || return 1
	done
Natanael Copa's avatar
Natanael Copa committed
49 50
}

51 52 53 54 55 56 57 58 59
check() {
	local lver; for lver in $_luaversions; do
		msg "Testing with Lua $lver..."

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

Natanael Copa's avatar
Natanael Copa committed
60
package() {
61 62 63 64 65
	mkdir -p "$pkgdir"
}

_package() {
	local lver="${subpkgname:3:3}"
66
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"
67 68 69
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
70 71
	replaces="lua$lver-lualdap"  # for backward compatibility (v3.5)
	[ "$lver" = "5.1" ] && replaces="${replaces:-} $pkgname"  # for backward compatibility (<v3.4)
72 73 74 75 76

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

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
Natanael Copa's avatar
Natanael Copa committed
80 81
}

82
sha512sums="51934d18d1ee97a0130545e657497e51542eef97c338df14e7171f94a2d6395fceb00313e1e64e46e6cdeedf85a17c63284595fdf6fbce8b7abce29d28f1b4a7  lualdap-1.2.3.tar.gz
83 84 85 86 87
f9f88ef13c8dd13064ca338720d461355cc4d32c03a7e597d7d7a0d9a8a20802bafe0dd479f8c341926fc714fb91489f0649c76675609b84d61ee0327fba8a56  fix-open_simple-segfault.patch
733bbe09edba98f7a549d1e4083a45bf05e1ce9aeffea0416b42e22f1a9f3072a4b36dd56bfde78586edcaafeffcd4880cb72953aeb2952121c92afadd0c8816  fix-anonymous-bind.patch
45170c06fe71bc61565fbdb960d74e59745dc91cbf52c760b8495890d9b02d8fa9361dc4c747d1257db8cb0dac16d97415db6fe69d6d17bb0b37b507aa60627e  fix-search-iter.patch
59622fabc03dd669c554cd8a58a934b5990f482da59bd5b7c243e53a41fbaaa55933ebd345d0d5911c48665fa18f6fcb08e0d9d74a61602f80afe6cb0b20dc4a  script-to-run-test.lua-against-a-dummy-slapd.patch
ffc0f08a141667db402b4b523f0de9893035bdbee5f8e68e48792cd7a29d549931ec4be0715b9f872992f492c1ac2e62c0e05552159571ffa05e5f507a1baf85  update-test.lua-for-5.2.patch"