# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Mike Crute <mike@crute.us>
pkgname=libupnp
pkgver=1.14.19
pkgrel=0
pkgdesc="Portable Open Source UPnP Development Kit"
url="https://pupnp.github.io/pupnp/"
arch="all"
license="BSD-3-Clause"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/pupnp/pupnp/archive/refs/tags/release-$pkgver.tar.gz
disable-failing-test.patch"
builddir="$srcdir"/pupnp-release-$pkgver

# secfixes:
#   1.12.1-r1:
#     - CVE-2020-13848

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-Dblocking_tcp_connections=OFF \
		-Dreuseaddr=ON \
		-Dsamples=OFF
	cmake --build build
}

check() {
	cmake --build build --target test
}

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

sha512sums="
76ae3bf8b69fd649ede0b92e03b36a6cbc7a9df9fa7828386c97761df12f2ae6346dec9ab45f78e17eb793d4d225707ecb3a7628d7678287979115cd4ba65c49  libupnp-1.14.19.tar.gz
f5890d2c1a3540fd1717eb038d1c4fc361b04e5a13be37d4f0ecbc574651b054b7326160c9399c6f7a4ce631c6ab912151d49a724615ee8f87138e4c0da9af0a  disable-failing-test.patch
"
