# Template file for 'capnproto'
pkgname=capnproto
version=1.4.0
revision=1
build_style=cmake
configure_args="-DBUILD_SHARED_LIBS=ON"
hostmakedepends="cmake"
short_desc="Cap'n Proto serialization/RPC system"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://capnproto.org"
distfiles="https://capnproto.org/capnproto-c++-${version}.tar.gz"
checksum=fa02378ad522b318916b9ad928d1372fc9abd43dd1f4f0392e50450f5c87828f

CXXFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" capnproto-devel"
	configure_args+=" -DEXTERNAL_CAPNP=ON"
fi

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
	makedepends+=" libucontext-devel"
fi

# if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
# 	LDFLAGS+=" -latomic"
# fi

post_install() {
	 vlicense LICENSE.txt
}

capnproto-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
