# Contributor:  David Runge <dvzrv@archlinux.org>
# Contributor:  Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Judd Vinet <jvinet@zeroflux.org>

_pkgname=expat
pkgname=static-compat-$_pkgname
pkgver=2.5.0
pkgrel=1
pkgdesc='An XML parser library'
arch=('x86_64')
url="https://libexpat.github.io/"
license=('MIT')
depends=('glibc-static-compat')
makedepends=('static-compat-cmake')
options=(staticlibs)
source=(https://github.com/libexpat/libexpat/releases/download/R_${pkgver//./_}/$_pkgname-$pkgver.tar.bz2{,.asc})
sha512sums=('22fd904d75aab7506a85c03519b9cf79e44898c8e1ba6abf6cb7f95de71b8e63a7e2d5cf4395e3627d46035ea29342b3e631a8809fef8aad3f59976dc075ad17'
            'SKIP')
b2sums=('15a5dcd3af17995fb4299301710b38d609c1fe7a8d6a6284581fedd96e89e0c16526d0342fb55773ac9d678cd65dc5cdb1532c764eeb3a20ccdf1e168b96e337'
        'SKIP')
validpgpkeys=(3176EF7DB2367F1FCA4F306B1F9B0E909AF37285) # Sebastian Pipping

build() {
  source static-compat-environment
  cd "$_pkgname-$pkgver"
  static-compat-cmake \
	-DEXPAT_SHARED_LIBS=OFF \
	-DEXPAT_BUILD_TOOLS=OFF \
	-DEXPAT_BUILD_EXAMPLES=OFF \
        -W no-dev \
        -B build \
        -S .
  make VERBOSE=1 -C build
}

check() {
  source static-compat-environment
  cd "$_pkgname-$pkgver"
  make VERBOSE=1 -C build test
}

package() {
  source static-compat-environment
  cd "$_pkgname-$pkgver"
  make VERBOSE=1 DESTDIR="$pkgdir" -C build install
  rm -r "$pkgdir/$static_compat_prefix"/share
  install -vDm 644 COPYING -t "${pkgdir}/usr/share/licenses/$pkgname/"
}
