aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/APKBUILD
blob: 3d45235b20b91458a4f92c3384567666597eeb46 (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=20180530
_ver=${pkgver%_git*}
pkgrel=0
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="ebccd65d1887986dac5dc64a7fcd778a60b7cd9a4631ffc8e6337fc9ee1ee15207c84b31c13c363befd7aedb0200c2ff1441ee84a057373530c76b2799f1e04e  luaossl-20180530.tar.gz"