# Template file for 'libgit2'
pkgname=libgit2
version=1.5.1
revision=1
build_style=cmake
configure_args="-DENABLE_REPRODUCIBLE_BUILDS=ON -DUSE_SSH=ON"
hostmakedepends="python3 git pkg-config"
makedepends="zlib-devel openssl-devel http-parser-devel libssh2-devel"
short_desc="Git linkable library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="custom:GPL-2.0-or-later WITH GCC-exception-2.0"
homepage="https://libgit2.org"
distfiles="https://github.com/libgit2/libgit2/archive/refs/tags/v${version}.tar.gz"
checksum=7074f1e2697992b82402501182db254fe62d64877b12f6e4c64656516f4cde88

if [ "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" -DBUILD_TESTS=ON"
else
	configure_args+=" -DBUILD_TESTS=OFF"
fi

post_patch() {
	# no online tests
	vsed \
		-i tests/libgit2/CMakeLists.txt \
		-e '/-sonline/s/^/#/'
}

post_install() {
	vlicense COPYING
}

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