# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=ws
pkgver=11.4.5
pkgrel=0
pkgdesc="WebSocket and HTTP client and server"
options="!check"
url="https://github.com/machinezone/IXWebSocket"
arch="all"
license="BSD-3-Clause"
makedepends="cmake openssl-dev>3 fmt-dev samurai spdlog-dev zlib-dev"
subpackages="ixwebsocket-libs ixwebsocket-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/machinezone/IXWebSocket/archive/v$pkgver.tar.gz
	spdlog.patch
	"
builddir="$srcdir/IXWebSocket-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DUSE_TLS=1 \
		-DUSE_WS=1 \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9a3b118ecec2ca39094ccbd7ec0610bbc59271a14c9e7ee0ac5d5e01a86111f33b722460ee5a32da60bfa31944acaf9a442d1655233ef252f35fd168d50ab471  ws-11.4.5.tar.gz
bb1349a486dd26c82c20a2a95e21be8abced796285ff0a70fd6eee85419be7ed71067480c3e2b4fef803aad965d783e12267838bca02d9106dd86f79d2bb7821  spdlog.patch
"
