# Template file for 'libgit2'
pkgname=libgit2
version=1.6.4
revision=2
build_style=cmake
configure_args="-DENABLE_REPRODUCIBLE_BUILDS=ON -DUSE_SSH=ON"
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=d25866a4ee275a64f65be2d9a663680a5cf1ed87b7ee4c534997562c828e500d

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