# Template file for 'libgit2'
pkgname=libgit2
version=1.7.2
revision=1
build_style=cmake
configure_args="-DENABLE_REPRODUCIBLE_BUILDS=ON -DUSE_SSH=ON -DUSE_HTTP_PARSER=system"
hostmakedepends="python3 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=de384e29d7efc9330c6cdb126ebf88342b5025d920dcb7c645defad85195ea7f

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

CFLAGS="-D_LARGE_FILE_SOURCE=1 -D_FILE_OFFSET_BITS=64"

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"
	}
}
