# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=prime_server
pkgver=0.7.0
pkgrel=2
_commit_logging=39f2e39273c625d96790
_commit_testing=ada902fb51a1ad1e5a27
pkgdesc="Non-blocking (web)server API for distributed computing and SOA based on zeromq"
url="https://github.com/kevinkreiser/prime_server"
arch="all"
license="BSD-2-Clause"
makedepends="
	bash
	cmake
	curl-dev
	czmq-dev
	samurai
	zeromq-dev
	"
subpackages="$pkgname-dev"
source="https://github.com/kevinkreiser/prime_server/archive/$pkgver/prime_server-$pkgver.tar.gz
	logging-$_commit_logging.hpp::https://gist.githubusercontent.com/kevinkreiser/$_commit_logging/raw
	testing-$_commit_testing.hpp::https://gist.githubusercontent.com/kevinkreiser/$_commit_testing/raw
	"

prepare() {
	default_prepare

	mv "$srcdir/logging-$_commit_logging.hpp" src/logging/logging.hpp
	mv "$srcdir/testing-$_commit_testing.hpp" test/testing/testing.hpp
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

check() {
	case "$CARCH" in
		# tests time out
		s390x) ctest --test-dir build -E "http|interrupt" ;;
		*) ctest --test-dir build ;;
	esac
}

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

sha512sums="
b9f225689f5582798650b3141b73ef428fa687f38a1197b48edb19942c29d2c2f874e54257b74f9e8e4c998eaf67552a86f67a768eb9d64355eb7ccf0db4d379  prime_server-0.7.0.tar.gz
ff5bdbab9c3b45c415f9da28790df52fc67eb93b0cf70c3d6d39ac37d9a0a0a9908ffd6a8d17567ffdc890b4799ab07fda1e7f46e62816fdf7d03b30c327dd89  logging-39f2e39273c625d96790.hpp
0ebdb0d0ef5184357b4090bca1083bb351103a8ec05994c56114ee23590956a9aa3fb228c29b3d37885d1e9eb98e4c631c0e91e20f070a22c0509ef08085f2ba  testing-ada902fb51a1ad1e5a27.hpp
"
