# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Darshit Shah <darnir@gmail.com>

# no changes, hold for soname bumps

pkgname=libpsl
pkgver=0.21.0
pkgrel=2
pkgdesc='Public Suffix List library'
url='https://github.com/rockdaboot/libpsl'
arch=('x86_64')
license=('MIT')
depends=('libidn2' 'libidn2.so' 'libunistring')
makedepends=('libxslt' 'python' 'publicsuffix-list' 'gtk-doc')
provides=('libpsl.so')
source=(https://github.com/rockdaboot/libpsl/releases/download/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz
        libpsl-gtk-doc-1.30-fix.patch::https://github.com/rockdaboot/libpsl/commit/87d1add318b5e5d09977f7f374e923577b6ff3be.patch
        libpsl-0.21.0-build-fix.patch::https://github.com/rockdaboot/libpsl/commit/9347024221f4a9d63f9dcafcda13362a7c8d92fe.patch)
sha512sums=('165c4f0b0640a813d512bd916e1532e32e43c8c81a5efd048f3a5b07b1b3c9129b4c4b5008b8b11a7c1b3914caea17564321389cd350bf1d687d53a97f2afa4d'
            '9cca44a70c7e26bc6016767bce8888e5902c97eff92d004ca2ab659ee289a9e079fab62820f0f684ac25922260175c74c08c1dfca6dd1db6333c37edf38b8048'
            '692d6dd6f64653f6e355df0b6cfe519a5c202d966deab066123e814591692a28a805fe794dc57dd6f9ab357b4e0dd8dfdf842239ec39f303fc33d98019e7f24e')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np1 < ../libpsl-gtk-doc-1.30-fix.patch
  patch -Np1 < ../libpsl-0.21.0-build-fix.patch
  rm -frv list
  autoreconf -fiv
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure \
    --prefix=/usr \
    --disable-static \
    --disable-dependency-tracking \
    --enable-man \
    --enable-gtk-doc \
    --enable-{builtin,runtime}=libidn2 \
    --with-psl-file=/usr/share/publicsuffix/effective_tld_names.dat \
    --with-psl-testfile=/usr/share/publicsuffix/test_psl.txt
  LC_CTYPE=en_US.UTF-8 make
}

check() {
  cd ${pkgname}-${pkgver}
  make check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et: