# Maintainer: Bartlomiej Piotrowski <nospam@bpiotrowski.pl>

pkgname=pkgconf
pkgver=2.5.1
pkgrel=1
pkgdesc='pkg-config compatible utility which does not depend on glib'
url='https://github.com/pkgconf/pkgconf'
msys2_references=(
  "cpe: cpe:/a:pkgconf:pkgconf"
)
arch=('i686' 'x86_64')
license=('spdx:ISC')
makedepends=('meson'
             'ninja'
             'gcc')
conflicts=('pkg-config')
provides=('pkg-config')
replaces=('pkg-config')
source=(https://github.com/pkgconf/pkgconf/archive/pkgconf-$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('79721badcad1987dead9c3609eb4877ab9b58821c06bdacb824f2c8897c11f2a')

prepare() {
  mv "${pkgname}-${pkgname}-${pkgver}" "${pkgname}-${pkgver}"
  cd "${srcdir}/${pkgname}-${pkgver}"
}

build() {
  mkdir "${srcdir}"/build && cd "${srcdir}"/build

  meson \
    --buildtype=plain \
     --prefix=/usr \
     -Dtests=disabled \
    "../${pkgname}-${pkgver}"

  meson compile
}

package() {
  cd "${srcdir}"/build

  DESTDIR="$pkgdir" meson install

  cp "$pkgdir"/usr/bin/pkgconf "$pkgdir/usr/bin/${CHOST}-pkg-config"
  cp "$pkgdir"/usr/bin/pkgconf "$pkgdir"/usr/bin/pkg-config
}
