# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Mateusz 'mrlemux' Lemusisk mrlemux at gmail dotcom
# Based on the pcre package by Sébastien "Seblu" Luttringer
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Eric Belanger <eric@archlinux.org>
# Contributor: John Proctor <jproctor@prium.net>

_pkgname=pcre2
pkgname=static-compat-$_pkgname
pkgver=10.42
pkgrel=2
pkgdesc='A library that implements Perl 5-style regular expressions. 2nd version'
arch=('x86_64')
url='https://www.pcre.org/'
license=('BSD')
depends=('gcc-libs-static-compat')
makedepends=('static-compat-configure')
options=(!emptydirs staticlibs)
source=("https://github.com/PhilipHazel/${_pkgname}/releases/download/${_pkgname}-$pkgver/${_pkgname}-$pkgver.tar.bz2"{,.sig})
sha512sums=('72fbde87fecec3aa4b47225dd919ea1d55e97f2cbcf02aba26e5a0d3b1ffb58c25a80a9ef069eb99f9cf4e41ba9604ad06a7ec159870e1e875d86820e12256d3'
            'SKIP')
validpgpkeys=('45F68D54BBE23FB3039B46E59766E084FB0F43D8')  # Philip Hazel

build() {
  source static-compat-environment
  cd $_pkgname-$pkgver
  static-compat-configure \
    --disable-shared \
    --enable-static \
    --enable-pcre2-16 \
    --enable-pcre2-32 \
    --enable-jit \
    --disable-pcre2grep-libz \
    --disable-pcre2grep-libbz2 \
    --disable-pcre2test-libreadline
  make
}

check() {
  source static-compat-environment
  cd $_pkgname-$pkgver
  make -j1 check
}

package() {
  source static-compat-environment
  cd $_pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  rm -r "$pkgdir/$static_compat_prefix"/share/{doc,man}

  install -Dm644 LICENCE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:
