# Template file for 'libfido2'
pkgname=libfido2
version=1.5.0
revision=1
build_style=cmake
hostmakedepends="pkg-config"
makedepends="libcbor-devel libressl-devel eudev-libudev-devel"
short_desc="Library for FIDO 2.0, including communication with a device over USB"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="BSD-2-Clause"
homepage="https://github.com/Yubico/libfido2"
distfiles="https://github.com/Yubico/libfido2/archive/${version}.tar.gz"
checksum=5990f923c9390fe1e6a00ba5d1d1f74030e7344b855e971d9fb7223e70ff3122

CFLAGS="-Wno-type-limits"
if [ "$XBPS_TARGET_LIBC" = musl ]; then
	# ioctl takes int on musl
	CFLAGS+=" -Wno-overflow"
fi

pre_configure() {
	vsed -i -e "s;sign-conversion;no-sign-conversion;" \
		{tools,src,examples}/CMakeLists.txt
}

post_install() {
	vlicense LICENSE
}

libfido2-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision} libcbor-devel"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.a
		vmove usr/lib/*.so
		vmove usr/lib/pkgconfig
		vmove usr/share/man/man3
	}
}
