aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-mosquitto/APKBUILD
blob: 8d817913c1f00ed2987efc68d4f7a2f6f702330c (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-mosquitto
pkgver=0.3
pkgrel=1
pkgdesc="Bindings to libmosquitto for Lua"
url="https://github.com/flukso/lua-mosquitto"
arch="all"
license="MIT"
makedepends="mosquitto-dev"
source="lua-mosquitto-$pkgver.tar.gz::https://github.com/flukso/lua-mosquitto/archive/v$pkgver.tar.gz"

_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

prepare() {
	default_prepare

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver"
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		make -C "$builddir-$lver" LUAPKGC=lua$lver
	done
}

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

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

	cd "$builddir-$lver"
	make install DESTDIR="$subpkgdir" \
		LUA_LIBDIR=/usr/lib \
		LUAPKGC=lua$lver

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

sha512sums="20e7602c7c5d8be8e69602513961f13b0a63a557bedca35400e9c5acda48c3600b124d211d70f135d0b97525a5bff844d4012f14a929539753256dd1f70e3004  lua-mosquitto-0.3.tar.gz"