%global git_date  20241005
%global git_hash  a7c5d46
%global git_ver  1.9.0

%global rel  12
%global src_name %{name}-%{git_date}-%{git_hash}.tar.xz

Name:       mako
Version:	%{git_ver}^%{git_date}g%{git_hash}
Release:	%{rel}%{?dist}
Summary:    Lightweight Wayland notification daemon
Provides:   desktop-notification-daemon

License:    MIT
URL:        https://github.com/emersion/%{name}
Source0:	%{url}/%{src_name}
# Add dbus-activated systemd unit as required by the packaging guidelines. To
# be upstreamed as discussed in RHBZ#1689634.
Source1:    %{name}.service
Source2:    fr.emersion.Mako.service
# Disable werror compiler flag breaking compilation with warning_level > 2,
# which is implied by Fedora's default compiler flags. Discussed in
# RHBZ#1689634.
#Patch0:     meson-disable-werror.patch

BuildRequires:  systemd-rpm-macros
BuildRequires:  gcc
BuildRequires:  meson >= 0.43.0
BuildRequires:  pkgconfig(wayland-protocols) >= 1.14
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(pango)
BuildRequires:  pkgconfig(cairo)
BuildRequires:  systemd-devel
BuildRequires:  scdoc
BuildRequires:  cmake
BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
Requires:       dbus

%{?systemd_requires}

%description
mako is a lightweight notification daemon for Wayland compositors that support
the layer-shell protocol.

%prep
%autosetup -n %{name}

%build
%meson -Dsd-bus-provider=libsystemd
%meson_build

%install
%meson_install

# Install dbus-activated systemd unit
install -m0644 -Dt %{buildroot}%{_userunitdir}/ %{SOURCE1}
install -m0644 -Dt %{buildroot}%{_datadir}/dbus-1/services/ %{SOURCE2}

%post
%systemd_user_post %{name}.service

%preun
%systemd_user_preun %{name}.service

%files
%license LICENSE
%doc README.md
%{_bindir}/mako
%{_bindir}/makoctl
%{_mandir}/man1/mako.1*
%{_mandir}/man1/makoctl.1*
%{_userunitdir}/%{name}.service
%{_datadir}/dbus-1/services/*
%{_mandir}/man5/mako*

%changelog
%autochangelog