# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=budgie-desktop
pkgver=10.5
pkgrel=3
pkgdesc="Modern desktop environment from the Solus Project"
arch=('x86_64')
url="https://budgie-desktop.org/"
license=('GPL' 'LGPL')
depends=('accountsservice' 'gnome-bluetooth' 'gnome-menus' 'gnome-session' 'gnome-themes-standard' 'libibus' 'libpeas' 'libwnck3' 'mutter')
makedepends=('autoconf-archive' 'git' 'gobject-introspection' 'intltool' 'meson' 'sassc' 'vala')
optdepends=('gnome-backgrounds: Default background'
            'gnome-control-center: System settings'
            'gnome-screensaver: Lock screen'
            'network-manager-applet: Network management')
_commit=38b69f05619f0b1a681276dc258929f2fcb7a750  # tags/10.5
source=("git+https://github.com/budgie-desktop/budgie-desktop.git#commit=$_commit"
        "git+https://gitlab.gnome.org/GNOME/libgnome-volume-control.git"
        "gnome-3.32.patch"
        "gnome-3.34.patch"
        "vala-0.46.patch"
        "00_budgie-desktop.gschema.override")
validpgpkeys=('8876CC8EDAEC52CEAB7742E778E2387015C1205F') # Ikey Doherty (Solus Project Founder)
sha256sums=('SKIP'
            'SKIP'
            'aaf114147ef494224d4d151f788361ceccffdd5be7bc4b0a8de0b66ef5f48610'
            'be207c814589a8c5986f8b58aeb76db41eb4dae08ac5e0fc90663a9e9fd05c01'
            'c2a1d7a4ae56bdce9e62244b185b7ab25e47e91f816661268a7884e34efb349e'
            '94b56c7a8efaa12c43485c4592f520d166448e9c9277d0fba71408c1a501bd33')

pkgver() {
	cd $pkgname
	git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
	cd $pkgname

	# GNOME 3.30 + GNOME 3.32 compatibility patch
	# https://github.com/solus-project/budgie-desktop/pull/1591
	patch -Np1 -i ../gnome-3.32.patch

	# GNOME 3.34 compatibility patch
	# https://github.com/solus-project/budgie-desktop/pull/1856
	patch -Np1 -i ../gnome-3.34.patch

	# Vala 0.46 compatibility patch
	# https://github.com/solus-project/budgie-desktop/pull/1859
	patch -Np1 -i ../vala-0.46.patch

	git submodule init
	git config --local submodule.subprojects/gvc.url "$srcdir/libgnome-volume-control"
	git submodule update
}

build() {
	arch-meson $pkgname build -D with-desktop-icons=none
	ninja -C build
}

package() {
	DESTDIR="$pkgdir" meson install -C build
	install -Dm644 00_budgie-desktop.gschema.override "$pkgdir/usr/share/glib-2.0/schemas/00_budgie-desktop.gschema.override"
}
