# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
pkgname=pkgconf
pkgver=2.4.3
pkgrel=0
pkgdesc="development framework configuration tools"
url="https://gitea.treehouse.systems/ariadne/pkgconf"
arch="all"
license="ISC"
replaces="pkgconfig"
provides="pkgconfig=1"
checkdepends="kyua atf"
subpackages="$pkgname-doc $pkgname-dev"
source="https://distfiles.ariadne.space/pkgconf/pkgconf-$pkgver.tar.xz
	"

# secfixes:
#   1.9.4-r0:
#     - CVE-2023-24056

build() {
	./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
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	ln -s pkgconf "$pkgdir"/usr/bin/pkg-config
}

dev() {
	default_dev

	# 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="
7e59b6aaf875ec3fc8c225985937384d2aef57d9daf64b7ea88242bf1a11349fe52cf6d1238d728f0509599982d69c761a0f01e8f8e24de028db58288760896f  pkgconf-2.4.3.tar.xz
"
