# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

_pkgname=libwacom
pkgname=static-compat-$_pkgname
pkgver=2.2.0
pkgrel=1
pkgdesc="Library to identify Wacom tablets and their features"
arch=('x86_64')
url="https://github.com/linuxwacom/libwacom/wiki"
license=('MIT')
depends=('static-compat-glib2' 'static-compat-systemd-libs' 'static-compat-libgudev')
makedepends=('static-compat-libxml2' 'static-compat-meson')
checkdepends=('python-pytest' 'python-libevdev' 'python-pyudev')
options=('staticlibs')
validpgpkeys=('3C2C43D9447D5938EF4551EBE23B7E70B467F0BF')
source=(https://github.com/linuxwacom/libwacom/releases/download/${_pkgname}-${pkgver}/${_pkgname}-${pkgver}.tar.xz{,.sig})
# https://github.com/linuxwacom/libwacom/releases
sha256sums=('e62ac9edb522d36ad2fa99adca35ddc02067383d4668eeaa13d7efccc30bb8c8'
            'SKIP')

prepare() {
  sed -i 's|shared_library|library|g' $_pkgname-$pkgver/meson.build
}

build() {
  export LDFLAGS+=' -llzma -lz -lm -lrt'
  source static-compat-environment
  static-compat-meson build $_pkgname-$pkgver
  ninja -C build
}

check() {
  source static-compat-environment
  ninja test -C build
}

package() {
  source static-compat-environment
  DESTDIR="$pkgdir" ninja install -C build
  install -D -m644 $_pkgname-$pkgver/COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  find "$pkgdir/$static_compat_prefix" -iname '*.so*' -delete
  rm -r "$pkgdir/$static_compat_prefix"/share/man
}
