# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libsoup
pkgver=2.74.3
pkgrel=2
pkgdesc="Gnome HTTP client/server Library"
url="https://wiki.gnome.org/Projects/libsoup"
arch="all"
license="LGPL-2.0-or-later"
subpackages="$pkgname-dev $pkgname-lang $pkgname-dbg"
depends="glib-networking gsettings-desktop-schemas"
makedepends="
	brotli-dev
	gobject-introspection-dev
	libgcrypt-dev
	libpsl-dev
	libxml2-dev
	meson
	sqlite-dev
	vala
	zlib-dev
	"
source="https://download.gnome.org/sources/libsoup/${pkgver%.*}/libsoup-$pkgver.tar.xz"
options="!check" # tls test fails

# secfixes:
#   2.68.2-r0:
#     - CVE-2019-17266
#   2.58.2-r0:
#     - CVE-2017-2885

build() {
	abuild-meson \
		-Db_lto=true \
		-Dtls_check=false \
		-Dintrospection=enabled \
		-Dvapi=enabled \
		-Dtests="$(want_check && echo true || echo false)" \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
72f8a055df984cb35105fe67f4ca67d3fb110d40a9cacb660fccd89f93b06bc32e25d94375dcc76608a245f7c5e081d968d7aaf5952eb16013d81c741247cb4c  libsoup-2.74.3.tar.xz
"
