# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=libfossil
pkgver=0.20240903.1644
_fslhash=404f376c0e
pkgrel=0
pkgdesc="Unofficial Fossil SCM library"
url="https://fossil.wanderinghorse.net/r/libfossil"
arch="all"
license="BSD-2-Clause"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="bash tcl zlib-dev"
subpackages="$pkgname-apps $pkgname-dev"
source="https://fossil.wanderinghorse.net/r/libfossil/tarball/$_fslhash/libfossil-$_fslhash.tar.gz"
builddir="$srcdir/$pkgname-$_fslhash"
options="!check" # no tests provided

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-c++ \
		--no-debug \
		--no-fnc
	make
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dvm644 include/*.h -t "$pkgdir"/usr/include/
	install -Dvm644 include/fossil-scm/*.h -t "$pkgdir"/usr/include/fossil-scm/
}

apps() {
	pkgdesc="$pkgdesc (command-line apps)"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove usr/bin
}

sha512sums="
a976777331cc3f684c24b9c90cc31e89d696ed833039fe47c844951a4a8e95704c5203845ceb6fcddc8513ca21a651dd641f2c4823e553a5a1861911b28a2244  libfossil-404f376c0e.tar.gz
"
