# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=pkgconf
pkgver=1.4.0
pkgrel=0
pkgdesc="development framework configuration tools"
url="https://github.com/pkgconf/pkgconf"
arch="all"
license="ISC"
replaces="pkgconfig"
provides="pkgconfig=1"
source="https://distfiles.dereferenced.org/pkgconf/pkgconf-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-dev"
checkdepends="kyua atf"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-pkg-config-dir=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig \
		|| return 1
	make || return 1
}

check() {
	cd "$builddir"
	make check || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1
	ln -s pkgconf "$pkgdir"/usr/bin/pkg-config
}

dev() {
	default_dev || return 1

	# Move pkg-config back to main package (default_dev implicitly moves
	# files /usr/bin/*-config to -dev).
	mv "$subpkgdir"/usr/bin/pkg-config "$pkgdir"/usr/bin/

	mkdir -p "$pkgdir"/usr/share/aclocal/
	mv "$subpkgdir"/usr/share/aclocal/pkg.m4 "$pkgdir"/usr/share/aclocal/
}

sha512sums="92c6790e524bd87c2f6ef17320aba4307009c2c7cd0a76ca9d828a41fd7e7b77a1bed841c204a4dafd2efbd2e3359790d877ac0a6ed13965c123da55f3e051a0  pkgconf-1.4.0.tar.xz"
