# 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.4.8
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//./_}/expat-${pkgver}.tar.bz2"{,.asc})
sha512sums=('46cc9d725f359b77681a2875bfefa15ceee50eb9513f6577607c0c5833dfa4241565c74f26b84b38d802c3cd8c32f00204fd74272bcecbd21229425764eef86c'
            'SKIP')
b2sums=('a829bd94d2cc9b305874ae2539dd4388ea99eaed21d2da17bbd99a1e7735b0f7cb910d096f72c71b128dcb8ffdff9021109e7ff5e562d8cefad228fd8d66f897'
        '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/"
}
