pkgname=libxkbcommon
_name=${pkgname/lib/}
pkgver=1.12.3
pkgdesc='Keymap handling library for toolkits and window systems'
homepage='https://xkbcommon.org/'
arch=(x86_64)
license=(MIT)
makedepends=(
  bash-completion
  glibc
  libxml2
  meson
  xkeyboard-config
  xorg-proto
)
sources=("${_name}-${pkgver}.tar.gz")
urls=("https://github.com/xkbcommon/libxkbcommon/archive/refs/tags/${_name}-${pkgver}.tar.gz")
md5sums=("a212ad9025ff96c94a4fcfeb5f1ac903")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local meson_options=(
    --prefix=/usr
    --buildtype=release
    -Ddefault_library=shared
    -Dxkb-config-root="/usr/share/X11/xkb"
    -D enable-x11=false
    -D enable-docs=false
    -D enable-wayland=true
  )
  meson setup build "${meson_options[@]}"
  meson configure build --no-pager
  meson compile -C build
}

src_check() {
  meson test -C build --print-errorlogs
}

src_install() {
  meson install -C build --destdir "$pkgdir"
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 LICENSE
}

# vim:ft=sh syn=sh et sw=2:
