aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-sec/APKBUILD
blob: 6ca5f9daf63350d2240b8c8bb9aae5b93cdf3cf2 (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
76
77
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

_luaversions="5.1 5.2 5.3"
pkgname=lua-sec
pkgver=0.5
pkgrel=1
pkgdesc="TLS/SSL Support for Lua"
url="https://github.com/brunoos/luasec/wiki"
arch="all"
license="MIT"
depends=
makedepends="openssl-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="0518f4524f399f33424c6f450e1d06db  luasec-0.5.tar.gz"
sha256sums="6480598f7492ac479b6b608b5fb1488226bfa6ef675e29f6b24dbe9099083523  luasec-0.5.tar.gz"
sha512sums="fcf88f2566952c4d12be95531991180a1f3bd60f7dda41997f93c80ccc8d9dfd44b00e3330a07e451489dc9cd0640f7841101c10867e270608187df78549fe2f  luasec-0.5.tar.gz"