# Template file for 'libgit2-1.8'
pkgname=libgit2-1.8
version=1.8.4
revision=2
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=49d0fc50ab931816f6bfc1ac68f8d74b760450eebdb5374e803ee36550f26774

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.8-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/pkgconfig
		vmove "usr/lib/*.so"
	}
}
