# Template file for 'Criterion'
pkgname=Criterion
version=2.4.3
revision=1
_debugbreak_commit=83bf7e933311b88613cbaadeced9c2e2c811054a
_klib_commit=cdb7e9236dc47abf8da7ebd702cc6f7f21f0c502
_nanopb_ver=0.4.9.1
_BoxFort_ver=0.1.5
build_style=meson
configure_args="-Dsamples=false"
hostmakedepends="pkg-config cmake"
makedepends="libffi-devel libgit2-devel nanomsg-devel gettext-devel"
short_desc="Cross-platform C and C++ unit testing framework for the 21st century"
maintainer="Mihail Ivanchev <contact@ivanchev.net>"
license="MIT"
homepage="https://github.com/Snaipe/Criterion"
changelog="https://raw.githubusercontent.com/Snaipe/Criterion/refs/heads/bleeding/ChangeLog"
distfiles="https://github.com/Snaipe/Criterion/archive/refs/tags/v${version}.tar.gz
 https://github.com/MrAnno/debugbreak/archive/${_debugbreak_commit}.tar.gz>debugbreak-${_debugbreak_commit}.tar.gz
 https://github.com/attractivechaos/klib/archive/${_klib_commit}.tar.gz>klib-${_klib_commit}.tar.gz
 https://github.com/nanopb/nanopb/archive/refs/tags/${_nanopb_ver}.tar.gz>nanopb-${_nanopb_ver}.tar.gz
 https://github.com/Snaipe/BoxFort/archive/refs/tags/v${_BoxFort_ver}.tar.gz>BoxFort-${_BoxFort_ver}.tar.gz"
checksum="6d924ee5eeaaaed7762ab968f560b9ff543fc3473aa949bf53ac56a2a1a9416c
 9de3bb0d23f43a6f019f186261a21f3f709c5717c61539ab655b7051ae58ee51
 1291ba5df7badf7f68188b4a622a7e694de61f8a01adbed9099da01df81f9c9a
 4575944a468718ef25f05eb01d994364650b581563089a9841986bb1e460eac3
 47fde5ce6fbbd7166268e97edc0fc22ed2bf0bf4d93b81ee30d664a8c35a155c"

skip_extraction="
 debugbreak-${_debugbreak_commit}.tar.gz
 klib-${_klib_commit}.tar.gz
 nanopb-${_nanopb_ver}.tar.gz
 BoxFort-${_BoxFort_ver}.tar.gz"

CFLAGS="-D_LARGEFILE64_SOURCE"

post_extract() {
	vsrcextract -C subprojects/debugbreak "debugbreak-${_debugbreak_commit}.tar.gz"
	cp subprojects/packagefiles/debugbreak/meson.build subprojects/debugbreak/meson.build

	vsrcextract -C subprojects/klib "klib-${_klib_commit}.tar.gz"
	cp subprojects/packagefiles/klib/meson.build subprojects/klib/meson.build

	vsrcextract -C subprojects/nanopb "nanopb-${_nanopb_ver}.tar.gz"
	vsrcextract -C subprojects/boxfort "BoxFort-${_BoxFort_ver}.tar.gz"
}

post_install() {
	vlicense LICENSE
}

Criterion-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove "usr/lib/*.a"
	}
}
