# Template file for 'libwebsockets'
pkgname=libwebsockets
version=4.5.2
revision=1
build_style=cmake
configure_args="-DLWS_WITH_LIBEV=ON -DLWS_WITH_LIBUV=ON -DLWS_WITH_HTTP2=ON
 -DLWS_IPV6=ON -DLWS_HAVE_LIBCAP=ON -DLWS_WITH_EVLIB_PLUGINS=OFF
 -DDISABLE_WERROR=ON"
makedepends="libcap-devel libev-devel libuv-devel openssl-devel zlib-devel"
short_desc="Lightweight client and server websocket library"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="MIT"
homepage="https://libwebsockets.org"
changelog="https://raw.githubusercontent.com/warmcat/libwebsockets/main/changelog"
distfiles="https://github.com/warmcat/libwebsockets/archive/v${version}.tar.gz"
checksum=04244efb7a6438c8c6bfc79b21214db5950f72c9cf57e980af57ca321aae87b2

if [ "$XBPS_CHECK_PKGS" ]; then
	# Tests reliant on internet connection require ipv6
	# connectivity which isn't always an availability.
	configure_args+=" -DLWS_CTEST_INTERNET_AVAILABLE=0"
fi

post_install() {
	vlicense LICENSE
}

libwebsockets-devel_package() {
	depends="libwebsockets>=${version}_${revision} libcap-devel libev-devel openssl-devel libuv-devel"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/bin
		vmove usr/share/libwebsockets-test-server
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/cmake
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}
