# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=expat
pkgver=2.6.4
pkgrel=1
pkgdesc="An XML parser library"
arch=(x86_64)
url="https://libexpat.github.io/"
_url="https://github.com/libexpat/libexpat"
license=(MIT)
depends=(glibc)
makedepends=(
  cmake
  git
)
provides=(libexpat.so)
source=($pkgname::git+$_url?signed#tag=R_${pkgver//./_})
sha512sums=('99a4d3014a43b5dc5862f18daf901656ff2698f42bf9080f7b46c995fb7f69126add770e9ce52d26be44432852b9aa5ff326a75eb880d6921a3a3ae822792ab6')
b2sums=('063dcf84994afa7cd9bc4a172a328c1b13335bd2fd6456b9727e42e1821898e000a152a2991334924ded1813d4b59a5f1237d80dd37df89b46fb41124d40bc25')
validpgpkeys=(3176EF7DB2367F1FCA4F306B1F9B0E909AF37285) # Sebastian Pipping

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -S $pkgname/$pkgname
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname/$pkgname/COPYING -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 $pkgname/$pkgname/{AUTHORS,Changes,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
