# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
pkgname=ustream-ssl
pkgver=20240728
pkgrel=0
pkgdesc="ustream SSL library"
url="https://git.openwrt.org/project/ustream-ssl.git"
arch="all"
license="ISC"
depends_dev="libubox-dev openssl-dev"
makedepends="cmake samurai zstd $depends_dev"
subpackages="$pkgname-dev"
_owrtgit=99bd3d2b
_owrtver="${pkgver:0:4}.${pkgver:4:2}.${pkgver:6:2}~$_owrtgit"
source="https://sources.openwrt.org/ustream-ssl-$_owrtver.tar.zst"
builddir="$srcdir/ustream-ssl-$_owrtver"

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 \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	ctest
}

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

sha512sums="
17ce1598f8040b2846b03800f448988e141ff49cd211daf9fca3f33c7636284fe673e581ffd5b548ff618cb769af0d4ce33cc311b8393fd24c00f1e6882b74dc  ustream-ssl-2024.07.28~99bd3d2b.tar.zst
"
