summaryrefslogtreecommitdiff
path: root/main/lua-evdev/APKBUILD
blob: 25defe7f9ab516487fcf10f487c823395e48f127 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.1 5.2 5.3"
pkgname=lua-evdev
_rockname=evdev
pkgver=2.2.1
pkgrel=2
pkgdesc="Lua module for reading input events"
url="https://github.com/Tangent128/lua-evdev"
arch="all"
license="MIT"
makedepends="linux-headers"
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
	time64.patch"
builddir="$srcdir/$pkgname-evdev-$pkgver"

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..."

		cd "$builddir-$lver"
		make MYCFLAGS="$CFLAGS $(pkg-config --cflags lua$lver)"
	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
	done
	install -D evdev/core.so "$subpkgdir"/usr/lib/lua/$lver/evdev/core.so

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

sha512sums="6d8bfb148013c780f7276c884e297b7d6ea55c0c257ac074c677b0dc6495a6087e0e1cb671d844b22d13c9a4c19c544d22a10f3ded5ad3580ccce33c74690871  lua-evdev-2.2.1.tar.gz
6842d2fb223aa44ae799b0f2841d4847c3bbe83d64dc643cf843592a4e84bc0f734b745868985b3cb1977417c9afce2108b5a8c4e8c8d147529b9c4bee1b473e  time64.patch"