# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

pkgname=publicsuffix-list
pkgver=20240306.1440.9094af5
pkgrel=1
pkgdesc='Cross-vendor public domain suffix database'
url='https://github.com/publicsuffix/list'
arch=('any')
license=('spdx:MPL-2.0')
makedepends=('git')
checkdepends=('libxslt-devel' 'python3' 'icu>=59.1')
_commit="9094af5c6cb260e69137c043c01be18fee01a540"
source=(${pkgname}::"git+https://github.com/publicsuffix/list#commit=${_commit}")
sha512sums=('SKIP')

pkgver() {
  cd ${pkgname}
  printf "%s.%s.%s" "$(TZ=UTC git show -s --pretty=%cd --date=format-local:%Y%m%d "${_commit}")" \
    "$(git rev-list --count "${_commit}")" \
    "$(git rev-parse --short "${_commit}")"
}

check() {
  cd ${pkgname}
  make test
}

package() {
  cd ${pkgname}
  install -Dm 644 public_suffix_list.dat tests/test_psl.txt -t "${pkgdir}/usr/share/publicsuffix"
  ln -s public_suffix_list.dat "${pkgdir}/usr/share/publicsuffix/effective_tld_names.dat"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
