# Template file for 'leatherman'
pkgname=leatherman
version=1.12.4
revision=7
build_style=cmake
configure_args="-DLEATHERMAN_SHARED=ON"
hostmakedepends="pkg-config python3"
makedepends="boost-devel libcurl-devel"
short_desc="Collection of C++ and CMake utility libraries"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://github.com/puppetlabs/leatherman/"
distfiles="https://github.com/puppetlabs/leatherman/archive/${version}.tar.gz>${pkgname}-${version}.tar.gz"
checksum=00f1b50a7f5f15fcb8dcf0e242f8ada7d31ec78b6093152eee8744e3e284dc28
python_version=3

CXXFLAGS="-Wno-ignored-qualifiers -Wno-class-memaccess -Wno-catch-value"
CXXFLAGS+=" -Wno-deprecated-copy -Wno-type-limits -Wno-deprecated-declarations"

post_extract() {
	mkdir catch/inc
	bsdtar -C catch/inc --strip-components=2 -xf vendor/Catch-* '*/single_include'
}

do_check() {
	cd build
	ctest -V
}

post_install() {
	cat <<-'EOF' >"${DESTDIR}/usr/lib/cmake/leatherman/catch.cmake"
	add_leatherman_includes("${LEATHERMAN_PREFIX}/include/leatherman/vendor")
	EOF
}

leatherman-devel_package() {
	short_desc+=" - development files"
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove "usr/lib/*.so"
		vinstall catch/inc/catch.hpp 644 usr/include/leatherman/vendor
	}
}
