aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/APKBUILD
blob: 7708a21fc218e47171359bed357a08de5163eaec (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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-ossl
_pkgname=luaossl
pkgver=20171028
_ver=${pkgver%_git*}
pkgrel=1
pkgdesc="A comprehensive OpenSSL Lua module"
url="http://25thandclement.com/~william/projects/luaossl.html"
arch="all"
license="MIT"
depends=""
makedepends="libressl-dev"
subpackages=""
source="$_pkgname-$_ver.tar.gz::https://github.com/wahern/$_pkgname/archive/rel-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-rel-$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

build() {
	cd "$builddir"

	make config prefix=/usr
	local lver; for lver in $_luaversions; do
		make openssl$lver
	done
}

check() {
	local lver; for lver in $_luaversions; do
		msg "Checking on lua$lver..."

		# Lua sources in src/ are in non-standard layout, so we can't
		# use them directly.
		make -C "$builddir" DESTDIR="$builddir/.test$lver" install$lver

		cd "$builddir"/regress
		local file; for file in $(find . -type f -perm +111); do
			echo "$file:" >&2
			LUA_CPATH="../.test$lver/usr/lib/lua/$lver/?.so;;" \
				LUA_PATH="../.test$lver/usr/share/lua/$lver/?.lua;;" \
				lua$lver $file
		done
	done
}

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

_package() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc for Lua $lver"
	depends="lua$lver"
	install_if="lua$lver $pkgname=$pkgver-r$pkgrel"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"

	cd "$builddir"
	make DESTDIR="$subpkgdir" install$lver

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

sha512sums="8fd88650222c1cb853691a2b1b60e2a21bec112ffbf5dedb50bd2a3f87af8a5b48923d916c055f1524e7ef0bd5dd9e6bf8950d5bf564031c8cdf2c25381dc115  luaossl-20171028.tar.gz"