aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-evdev/APKBUILD
blob: 0a27f9303c8a3bdc30b10a3129b51db339efbc57 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-evdev
_rockname=evdev
pkgver=2.2.1
pkgrel=1
pkgdesc="Lua module for reading input events"
url="https://github.com/Tangent128/lua-evdev"
arch="all"
license="MIT"
depends=""
makedepends="linux-headers"
subpackages=""
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_package"
done
source="$pkgname-$pkgver.tar.gz::https://github.com/Tangent128/$pkgname/archive/evdev-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-evdev-$pkgver"

prepare() {
	default_prepare || return 1

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

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		cd "$builddir-$lver"
		make MYCFLAGS="$CFLAGS $(pkg-config --cflags lua$lver)" || return 1
	done
}

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

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

	cd "$builddir-$lver"

	local f; for f in evdev.lua evdev/constants.lua; do
		install -D $f "$subpkgdir"/usr/share/lua/$lver/$f || return 1
	done
	install -D evdev/core.so "$subpkgdir"/usr/lib/lua/$lver/evdev/core.so

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

md5sums="8db10a3079bda7acd20046e0793df678  lua-evdev-2.2.1.tar.gz"
sha256sums="8ccec638250a839e8567f55e5c61982396ec81f9e339dbf36ee809cb5375c0ae  lua-evdev-2.2.1.tar.gz"
sha512sums="6d8bfb148013c780f7276c884e297b7d6ea55c0c257ac074c677b0dc6495a6087e0e1cb671d844b22d13c9a4c19c544d22a10f3ded5ad3580ccce33c74690871  lua-evdev-2.2.1.tar.gz"