aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-sec/APKBUILD
blob: 54e0715509141b6606f3c387ca98a6b22fae4057 (plain) (blame)
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
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-sec
pkgver=0.7
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

sha512sums="6adf5241aa5a0d92c9dd7fc7f7e426969475548f47979ccc28187471b3bad4132c215de6da1f471d21b05c6558d36309264512c9c4ac70a53d6f6e204cac1358  luasec-0.7.tar.gz"