# Contributor: Bart Ribbers <bribbers@disroot.org>
# Contributor: Danct12 <danct12@disroot.org>
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Mike Banon <mikebdp2@gmail.com>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=chatty
pkgver=0.8.5
pkgrel=1
_libcmatrix=6c260ee37bd2eff096ee44c29690f30718566c1c
pkgdesc="XMPP and SMS messaging via libpurple and Modemmanager"
# s390x: doubt anyone would use a mainframe for texting
arch="all !s390x"
url="https://gitlab.gnome.org/World/Chatty"
license="GPL-3.0-or-later"
depends="
	cyrus-sasl
	purple-xmpp
	mmsd-tng
	purple-carbons
	purple-lurch
	purple-xmpp-http-upload
	"
makedepends="
	evolution-data-server-dev
	evolution-dev
	feedbackd-dev
	folks-dev
	gspell-dev
	gstreamer-dev
	gtk4.0-dev
	gtksourceview5-dev
	libadwaita-dev
	libcmatrix-dev
	libgee-dev
	libphonenumber-dev
	meson
	modemmanager-dev
	olm-dev
	pidgin-dev
	"
checkdepends="appstream-glib desktop-file-utils"
source="https://gitlab.gnome.org/World/Chatty/-/archive/v$pkgver/Chatty-v$pkgver.tar.gz
	https://source.puri.sm/Librem5/libcmatrix/-/archive/$_libcmatrix/libcmatrix-$_libcmatrix.tar.gz
	"

subpackages="$pkgname-lang $pkgname-bash-completion $pkgname-dbg"
options="!check" # Requires running Wayland compositor
builddir="$srcdir/Chatty-v$pkgver"

prepare() {
	rm -rf "$builddir"/subprojects/libcmatrix
	mv "$srcdir"/libcmatrix-$_libcmatrix "$builddir"/subprojects/libcmatrix

	default_prepare
}

build() {
	abuild-meson \
		-Db_lto=true \
		. output
	meson compile -C output
}

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

sha512sums="
7532a70403f70f058193a4ffc6ad9eee4fc6f1a3c574d615e7e94b84c84216d05c874d5700e23bc2674fb4665236e3b3ce562fe769217309794bee2a5b605e21  Chatty-v0.8.5.tar.gz
19dda48dcad027a737dae4031c5556bd42c204c45c7a870192b0ce3e61e211484cb52b3a8cce576ee757cda37c1a7cbef6746304b9d80efe103d2df7a2b199c2  libcmatrix-6c260ee37bd2eff096ee44c29690f30718566c1c.tar.gz
"
