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

_sdir="$srcdir"/lua-evdev-evdev-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	for _v in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_v
	done
}

build() {
	for _v in $_luaversions; do
		cd "$srcdir"/build-$_v
		make MYCFLAGS="$CFLAGS $(pkg-config --cflags lua$_v)" || return 1
	done
}

package() {
	for _v in $_luaversions; do
		cd "$srcdir"/build-$_v
		for i in evdev.lua evdev/constants.lua; do
			install -D $i "$pkgdir"/usr/share/lua/$_v/$i || return 1
		done
		for i in evdev/core.so; do
			install -D $i "$pkgdir"/usr/lib/lua/$_v/$i || return 1
		done
	done
}

_split() {
	local _ver=$1
	pkgdesc="$pkgdesc - Lua $_ver"
	depends=""
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"/usr/share/lua "$subpkgdir"/usr/lib/lua
	mv "$pkgdir"/usr/share/lua/$_ver "$subpkgdir"/usr/share/lua
	mv "$pkgdir"/usr/lib/lua/$_ver "$subpkgdir"/usr/lib/lua
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

md5sums="c91a12b9f269f298ebd2da87332cf93d  lua-evdev-2.2.tar.gz"
sha256sums="a808513e1ae19124e7d75d649d3783c790d7d963fe0816376a46eaa3861245d3  lua-evdev-2.2.tar.gz"
sha512sums="6216fe9bec48a6c2564598f833a6507408ffcba76e632aead6c507db30f218588f64fbb07ff74d9beb37dff704fdb4e8a59b485741fcdd0e010aeb75bece953f  lua-evdev-2.2.tar.gz"