# Maintainer: eNV25 <env252525@gmail.com>
# Contributor: Brett Cornwall <ainola@archlinux.org>

pkgname=keyd-git
_pkgname=${pkgname%-git}
pkgver=2.6.0.r2.gf564288
pkgrel=1
arch=('x86_64' 'aarch64')
pkgdesc="A key remapping daemon for linux"
url="https://github.com/rvaiya/${_pkgname}"
license=('MIT')
makedepends=('git')
optdepends=(
	"python: Required for use with keyd-application-mapper utility"
)
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=(
	"git+${url}.git"
	"${_pkgname}.sysusers"
)
sha256sums=('SKIP'
            'b3fa546c31f61be824a84a33af5c723692e2cedd4e5f87ff655e90f33227395d')

pkgver() {
	git -C "${_pkgname}/" describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//'
}

build() {
	make -C "${_pkgname}/" DESTDIR="${pkgdir}" PREFIX=/usr
}

package() {
	cd "${_pkgname}/"
	make DESTDIR="${pkgdir}" PREFIX=/usr install
	install -Dm644 "../${_pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}.conf"
	install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${_pkgname}/"
}
