# Temporary fork for N900 and BlackBerry KEY2
# * https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/840
# * https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/856
maintainer="Paul Sajna <sajattack@postmarketos.org>"
pkgname=xkeyboard-config
_pkgver=2.48
pkgver=9999$_pkgver
pkgrel=0
pkgdesc="X keyboard configuration files"
url="https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config"
arch="aarch64 armv7"
license="MIT"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
depends_dev="$pkgname"
makedepends="gettext meson perl libxslt"
checkdepends="gawk"
source="
	https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/archive/xkeyboard-config-$_pkgver/xkeyboard-config-xkeyboard-config-$_pkgver.tar.gz
	0001-re-nokia.patch
	0002-add-symbols-for-BlackBerry-KEY2-keypad.patch
	"
builddir="$srcdir"/xkeyboard-config-xkeyboard-config-$_pkgver

build() {
	abuild-meson . output
	meson compile -C output
}

check() {
	meson test --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	# apk bug: can't migrate directory -> symlink
	# https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/11110
	rm "$pkgdir"/usr/share/X11/xkb/
	mv "$pkgdir"/usr/share/xkeyboard-config-2/ "$pkgdir"/usr/share/X11/xkb/
	ln -s X11/xkb "$pkgdir"/usr/share/xkeyboard-config-2
}

sha512sums="
7fc550af99b66c5032a2162e60c86519e3a2cca67966c9b3264d046d827436a248293946408d61fde590e915c621f1db4a533b7529908946f420c22a719a6b23  xkeyboard-config-xkeyboard-config-2.48.tar.gz
99042ebe47474a6125f992d0f7d4624ce28100b556192772ab541b21b76826a235c26160b128eb0e087ebee551dbcade1436f1469f56d3affcc48488b43aa005  0001-re-nokia.patch
8c999e1a056cfa7cef97153a5ddd55c30dcb4ec51c521d8120e734828fdf17fe4e4185d9f46e1eea187d21b026df6f257fea4571bfbdd64b3c496799bcf9e75c  0002-add-symbols-for-BlackBerry-KEY2-keypad.patch
"
