# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka pkgname=pcre2 pkgver=10.34 pkgrel=1 pkgdesc="Perl-compatible regular expression library" url="https://pcre.org/" arch="all" license="BSD-3-Clause" depends_dev="libedit-dev zlib-dev" makedepends="$depends_dev" subpackages="$pkgname-dev $pkgname-doc $pkgname-tools libpcre2-16:_libpcre libpcre2-32:_libpcre" source="https://ftp.pcre.org/pub/pcre/pcre2-$pkgver.tar.gz fix-rspamd-segfault.patch " case "$CARCH" in s390x|armhf) _enable_jit="";; # https://bugs.exim.org/show_bug.cgi?id=2468 *) _enable_jit="--enable-jit";; esac build() { case "$CARCH" in mips64*) export CPPFLAGS="$CPPFLAGS -DSLJIT_IS_FPU_AVAILABLE=0";; mips*) export CPPFLAGS="$CPPFLAGS -DSLJIT_IS_FPU_AVAILABLE=0 -DSLJIT_MIPS_R1=1";; esac # Note: Forced -O3 is recommended (needed?) for Julia. ./configure \ CFLAGS="$CFLAGS -O3" \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --docdir=/usr/share/doc/$pkgname-$pkgver \ --htmldir=/usr/share/doc/$pkgname-$pkgver/html \ --enable-pcre2-16 \ --enable-pcre2-32 \ --enable-pcre2grep-libz \ --enable-pcre2test-libedit \ --with-match-limit-depth=8192 \ $_enable_jit make } # Note: RunTest and pcre2_jit_test generates some binaries in .libs that needs # to disable MPROTECT on grsecurity kernel. That's why it's so complicated... check() { ./RunTest if [ -n "$_enable_jit" ]; then ./pcre2_jit_test fi } package() { make DESTDIR="$pkgdir" install } _libpcre() { local bits="${subpkgname##*-}" pkgdesc="PCRE2 with $bits bit character support" mkdir -p "$subpkgdir"/usr/lib mv "$pkgdir"/usr/lib/libpcre2-$bits.so* "$subpkgdir"/usr/lib/ } tools() { pkgdesc="Auxiliary utilities for PCRE2" mkdir -p "$subpkgdir"/usr/ mv "$pkgdir"/usr/bin "$subpkgdir"/usr/ } sha512sums="820b3805fc7fcf3a80dfd42ff570efc8518fe3c50f3feb720319b95316619e5b8f6601b3c9522606315aecd5558ccfc8a04a89fab9921fdfc3400dc2caf17c22 pcre2-10.34.tar.gz 571e89a3dc74a3e6b52fe9c8083df79a72a6430849a7ffe887fed832c8d40537554ac8ee29c42b3c1f212ad13f0326b9c5d9305d0dd889be10ed25b1cc6992b6 fix-rspamd-segfault.patch"