# Template file for 'libgit2-1.9'
pkgname=libgit2-1.9
version=1.9.4
revision=1
build_style=cmake
configure_args="-DENABLE_REPRODUCIBLE_BUILDS=ON -DBUILD_CLI=OFF -DUSE_SSH=exec -DUSE_HTTP_PARSER=llhttp"
hostmakedepends="python3 pkg-config"
makedepends="zlib-devel openssl-devel llhttp-devel"
depends="openssh"
short_desc="Git linkable library ${pkgname#libgit2-}"
maintainer="tranzystorekk <tranzystorek.io@protonmail.com>"
license="GPL-2.0-only WITH GCC-exception-2.0"
homepage="https://libgit2.org"
distfiles="https://github.com/libgit2/libgit2/archive/refs/tags/v${version}.tar.gz"
checksum=824b73bd13647800fe4b566a1008ae77fea0e3e3424edab632fcfd8c0b14ba8b

if [ -z "$XBPS_CHECK_PKGS" ]; then
	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-1.9-devel_package() {
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	provides="virtual-libgit2-devel-${version}_${revision}"
	conflicts="virtual-libgit2-devel"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
