aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-sec/APKBUILD
blob: 440a70ccb664827e4981e52a9c6339bf6ca93625 (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
70
71
72
73
74
75
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-sec
pkgver=0.6
pkgrel=2
pkgdesc="TLS/SSL Support for Lua"
url="https://github.com/brunoos/luasec/wiki"
arch="all"
license="MIT"
depends=
makedepends="libressl-dev"
install=
subpackages="$pkgname-doc"
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-sec:split_${_i/./_}"
done

source="luasec-$pkgver.tar.gz::https://github.com/brunoos/luasec/archive/luasec-$pkgver.tar.gz"
_builddir="$srcdir"/luasec-luasec-$pkgver

prepare() {
	cd "$srcdir"
	for _i in $_luaversions; do
		cp -r "$srcdir"/luasec-luasec-$pkgver build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make linux INC_PATH="$(pkg-config --cflags lua$_i)" \
			LD="${CC:-gcc}" || return 1
	done
}

package() {
	for _i in $_luaversions; do
		_luasharedir=/usr/share/lua/$_i
		_lualibdir=/usr/lib/lua/$_i
		cd "$srcdir"/build-$_i
		mkdir -p "$pkgdir"/$_luasharedir "$pkgdir"/$_lualibdir
		make LUAPATH="$pkgdir"/$_luasharedir \
			LUACPATH="$pkgdir"/$_lualibdir \
			install
		if ! [ -d "$pkgdir"/usr/share/doc/$pkgname/sambles ]; then
			mkdir -p "$pkgdir"/usr/share/doc/$pkgname
			cp -r samples "$pkgdir"/usr/share/doc/$pkgname/ \
				|| return 1
		fi
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="TLS/SSL Support for Lua $_ver"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"
	depends="lua$_ver-socket"
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d
			mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
		fi
	done
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

md5sums="14e1aef6d2aae96bbf98afc6b6634af2  luasec-0.6.tar.gz"
sha256sums="cef3a35c18beb8a54d9c8ce6260a4cabbd9a386de8711320d084daffad0aed5d  luasec-0.6.tar.gz"
sha512sums="f7004a329153d0126a3ea27b4986e9d83fb8f2de9c5c2f0c96427c50cc42e1252c69fd8cc69e2e8d423745d2dbfdb5a781b609938f7f502c7aedeb99fd0778cd  luasec-0.6.tar.gz"