# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=pkgconf
pkgver=2.3.0
pkgrel=1
pkgdesc="Package compiler and linker metadata toolkit"
url="https://gitea.treehouse.systems/ariadne/pkgconf"
license=(ISC)
arch=(x86_64)
depends=(
  glibc
  sh
)
makedepends=(
  git
  meson
)
provides=(
  libpkgconf.so
  pkg-config
  pkgconfig
)
conflicts=(pkg-config)
replaces=(pkg-config)
source=(
  "git+$url#tag=pkgconf-$pkgver"
  {x86_64,i686}-pc-linux-gnu.personality
)
b2sums=('d117cb9c246a870faf4702db2ef0df6558e411c9605a7f63b560bd11af4fc05b4f88b942c37e7aeac792abebb0db35f4200b6f98df39cda5b49952821e27315b'
        'c04583e19149c1035cb7777a59f0fbc4988b672d8e45105e33def3d0f9054464e33a400a3e7c7e8b99b334e4fe06aaa9d7e34662e806096d4374bd6b12d803db'
        '94c8fd12b5f33611fd6dbeae03b20e72bcf2937e764766e2633b2fd4c14925860d57eee234016c81b0563a47b112ac9ef4a8b3bb9fa3fc0dd266f355bc156c58')

prepare() {
  cd pkgconf
}

build() {
  local meson_options=(
    -D tests=disabled  # Tests need kyua
  )

  arch-meson pkgconf build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"

  local p
  for p in {x86_64,i686}-pc-linux-gnu; do
    install -Dt "$pkgdir/usr/share/pkgconfig/personality.d" -m644 $p.personality
    ln -s pkgconf "$pkgdir/usr/bin/$p-pkg-config"
  done

  ln -s pkgconf "$pkgdir/usr/bin/pkg-config"
  ln -s pkgconf.1 "$pkgdir/usr/share/man/man1/pkg-config.1"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 pkgconf/COPYING
}

# vim:set sw=2 sts=-1 et:
