# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/gnome <pabloyoyoista@postmarketos.org>
pkgname=calls
pkgver=48.2
pkgrel=0
pkgdesc="Phone dialer and call handler"
# armhf blocked by libpeas2 -> gjs-dev -> mozjs
arch="all !armhf"
url="https://gitlab.gnome.org/GNOME/calls"
license="GPL-3.0-or-later"
depends="
	callaudiod
	modemmanager
	sofia-sip-linphone
	"
makedepends="
	callaudiod-dev
	desktop-file-utils
	evolution-data-server-dev
	feedbackd-dev
	folks-dev
	gettext-dev
	gobject-introspection-dev
	gom-dev
	gsound-dev
	gstreamer-dev
	gtk4.0-dev
	libadwaita-dev
	libpeas2-dev
	meson
	modemmanager-dev
	ninja
	py3-docutils
	sofia-sip-linphone-dev
	vala
	"
subpackages="$pkgname-doc $pkgname-dbg $pkgname-lang"
_libcall_ui_commit="f66056ace818ff19b507335634dd67138a92c77f"
# temporary upstream issue: https://gitlab.gnome.org/Infrastructure/openshift-images/gnome-release-service/-/issues/14
#source="https://download.gnome.org/sources/calls/${pkgver%%.*}/calls-$pkgver.tar.xz
source="https://gitlab.gnome.org/GNOME/calls/-/archive/v$pkgver/calls-v$pkgver.tar.gz
	https://gitlab.gnome.org/World/Phosh/libcall-ui/-/archive/$_libcall_ui_commit/libcall-ui-$_libcall_ui_commit.tar.gz
	"
options="!check" # Requires running Wayland compositor
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare

	mv "$srcdir"/libcall-ui-$_libcall_ui_commit/* "$builddir"/subprojects/libcall-ui
}

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

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

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

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
94ab084b1614b09d06bbaf4fb209785d68844d97193da468d87ae931440b4d638ab44172de84725d624c0c9ceb6ec87f53c4361ef636df946d415a68093ed1f3  calls-v48.2.tar.gz
26e2ebd3332df4280accd13870e739dc7c2c39bd9df5a5a6eedd3818fa3478908318c280345e5b7e666e89dedb88841548328fa1daca9c510f5044e909da0bc1  libcall-ui-f66056ace818ff19b507335634dd67138a92c77f.tar.gz
"
