# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=dino
pkgver=0.4.4
pkgrel=0
pkgdesc="Modern Jabber/XMPP client"
url="https://dino.im"
# missing webrtc-audio-processing
arch="all !s390x !ppc64le !riscv64"
license="GPL-3.0-only"
depends="gst-plugins-good gst-plugins-good-gtk icu-data-full"
makedepends="
	cmake
	glib-dev
	glib-networking
	gpgme-dev
	gspell-dev
	gst-libav
	gst-plugins-base-dev
	gtk4.0-dev
	libadwaita-dev
	libcanberra-dev
	libgcrypt-dev
	libgee-dev
	libnice-dev
	libqrencode-dev
	libsignal-protocol-c-dev
	libsoup3-dev
	libsrtp-dev
	ninja
	sqlite-dev
	vala
	webrtc-audio-processing-dev
	"
subpackages="$pkgname-lang $pkgname-notificationsound"
source="https://github.com/dino/dino/releases/download/v$pkgver/dino-$pkgver.tar.gz"

# secfixes:
#   0.4.2-r0:
#     - CVE-2023-28686
#   0.2.1-r0:
#     - CVE-2021-33896

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_TESTS="$(want_check && echo ON || echo OFF)" \
		-DENABLED_PLUGINS="notification-sound" \
		-DUSE_SOUP3=yes
	cmake --build build
}

check() {
	build/xmpp-vala-test
	build/signal-protocol-vala-test
}

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

notificationsound() {
	amove usr/lib/dino/plugins/notification-sound.so
}

sha512sums="
d2d5553c60d20e163930c0d8468727109871651f7305bf86940b7efd70a42d11ca85572f4dbea01e67ec8ce48fb0a244acb29b491d5d43bf188653ddc6ecface  dino-0.4.4.tar.gz
"
