pkgname=libpsl
pkgver=0.21.5
pkgdesc='Public Suffix List library'
homepage='https://github.com/rockdaboot/libpsl'
arch=('x86_64')
license=('MIT')
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://github.com/rockdaboot/libpsl/releases/download/${pkgver}/${sources[0]}")
md5sums=("870a798ee9860b6e77896548428dba7b")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  mkdir build &&
  cd    build &&

  meson setup --prefix=/usr --buildtype=release &&

  ninja
  cd ..
}

src_check() {
  pushd build
  ninja test
  popd
}

src_install() {
  pushd build
  DESTDIR=$pkgdir ninja install
  install -Dm 644 ../COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  popd
}
