# Template file for 'skalibs'
pkgname=skalibs
version=2.7.0.0
revision=2
_sysdepspkg=skaware-void-sysdeps
build_style=configure
configure_args="--libdir=/usr/lib --enable-static --enable-shared --enable-clock
 --enable-monotonic --enable-force-devr --datadir=/usr/share/$pkgname --libdir=/usr/lib
 --bindir=/usr/bin --dynlibdir=/usr/lib"
short_desc="General purpose libraries for building software from skarnet.org"
maintainer="bougyman <bougyman@voidlinux.eu>"
license="ISC"
homepage="https://skarnet.org/software/skalibs/"
distfiles="https://skarnet.org/software/${pkgname}/${pkgname}-${version}.tar.gz"
checksum=96494d76669d2f8622511d5d616b6367801a42683c0bb11a8855114e5ccbd756

CFLAGS="-D_DEFAULT_SOURCE"

if [ "$CROSS_BUILD" ]; then
	distfiles+=" https://github.com/CMB/${_sysdepspkg}/archive/${version}.tar.gz"
	checksum+=" e6bc70a9ddd593e0352e09d7681f73b3e11a5857920d46a7adf2a8ca1a3d8de0"
	configure_args+=" --with-sysdeps=../${_sysdepspkg}-${version}/${XBPS_CROSS_TRIPLET}"
fi

post_install() {
	vlicense COPYING LICENSE
}

skalibs-doc_package() {
	noarch=yes
	short_desc+=" - documentation"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmkdir usr/share/doc/skalibs
		vcopy "doc/*" usr/share/doc/skalibs
	}
}
skalibs-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/skalibs/sysdeps
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}
