## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%bcond	gnome		1
%bcond	gnome40		1
%bcond	gnome45		%[0%{?fedora} || 0%{?rhel} >= 10]
%bcond	gnome_flashback	%{undefined flatpak}
%bcond	mate		%{undefined flatpak}
%bcond	xfce		%{undefined flatpak}

%global app_id org.workrave.Workrave

Name:          workrave
Version:       1.11.0~beta.12
Release:       %autorelease
Summary:       Program that assists in the recovery and prevention of RSI
# Based on older packages by Dag Wieers <dag@wieers.com> and Steve Ratcliffe
License:       GPL-3.0-or-later AND LGPL-2.0-or-later
URL:           https://workrave.org/
%global tag %(echo %{version} | sed -e 's/[\\.~]/_/g')
Source:        https://github.com/rcaelers/workrave/archive/v%{tag}/%{name}-v%{tag}.tar.gz
# upstream post-release patches
Patch:         https://github.com/rcaelers/workrave/commit/d4503c3c6eb6372d6cb1c29fffac15de62e86fc4.patch
Patch:         https://github.com/rcaelers/workrave/commit/a4c0951f296c6ea1a0c2a64df3c243c436246902.patch
Patch:         https://github.com/rcaelers/workrave/commit/4f91739328fe57b14977ffa9bc16fe8d3daebffd.patch
Patch:         https://github.com/rcaelers/workrave/commit/e9cf499f0360d03ba32ab66ac4c439877cc9574e.patch
Patch:         https://github.com/rcaelers/workrave/commit/88bd028a179667676530d656e3abda602cc24fe3.patch
Patch:         https://github.com/rcaelers/workrave/commit/67303e8d67491318bc600a74b5f893082458f5b3.patch

BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: gcc-c++
BuildRequires: libappstream-glib
# Base dependencies
BuildRequires: boost-devel
BuildRequires: python3-devel
BuildRequires: python3-jinja2
# Gtk+3 interface
BuildRequires: pkgconfig(glib-2.0) >= 2.56.0
BuildRequires: pkgconfig(gio-2.0) >= 2.56.0
BuildRequires: pkgconfig(gtk+-3.0) >= 3.22.0
BuildRequires: pkgconfig(glibmm-2.4) >= 2.28.0
BuildRequires: pkgconfig(gtkmm-3.0) >= 3.22.0
# Sound support
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(libpulse) >= 0.9.15
BuildRequires: pkgconfig(libpulse-mainloop-glib) >= 0.9.15
# Wayland support
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-scanner)
# X11 support
BuildRequires: libX11-devel
BuildRequires: libXScrnSaver-devel
BuildRequires: libXtst-devel
# Desktop applets
BuildRequires: pkgconfig(ayatana-appindicator3-0.1)
BuildRequires: pkgconfig(dbusmenu-glib-0.4)
BuildRequires: pkgconfig(dbusmenu-gtk3-0.4)
BuildRequires: pkgconfig(gobject-introspection-1.0)
%if %{with gnome_flashback}
BuildRequires: pkgconfig(libgnome-panel)
%endif
%if %{with gnome40}
BuildRequires: pkgconfig(gtk4)
%endif
%if %{with xfce}
BuildRequires: pkgconfig(libxfce4panel-2.0) >= 4.12
%endif
%if %{with mate}
BuildRequires: pkgconfig(libmatepanelapplet-4.0) >= 1.20.0
%endif
# Logging
BuildRequires: cmake(fmt)
BuildRequires: cmake(spdlog)

Requires:      dbus-common
Requires:      hicolor-icon-theme
Recommends:    (%{name}-cinnamon if cinnamon)
Recommends:    (%{name}-gnome if gnome-shell)
Recommends:    (%{name}-gnome-flashback if gnome-panel)
Recommends:    (%{name}-mate if mate-panel)
Recommends:    (%{name}-xfce if xfce4-panel)
Recommends:    gstreamer1-plugins-base
Recommends:    gstreamer1-plugins-good
Obsoletes:     %{name}-devel < %{version}-%{release}

# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch:   %{ix86}

%global _description Workrave is a program that assists in the recovery and prevention of\
Repetitive Strain Injury (RSI). The program frequently alerts you to\
take micro-pauses, rest breaks and restricts you to your daily limit.

%description
%{_description}

%package cinnamon
Requires:      %{name}%{?_isa} = %{version}-%{release}
Summary:       Workrave applet for Cinnamon desktop

%description cinnamon
%{_description}

This package provides an applet for the Cinnamon desktop.

%package gnome
Requires:      %{name}%{?_isa} = %{version}-%{release}
Summary:       Workrave applet for GNOME desktop

%description gnome
%{_description}

This package provides an applet for the GNOME desktop.

%package gnome-flashback
Requires:      %{name}%{?_isa} = %{version}-%{release}
Summary:       Workrave applet for GNOME Flashback

%description gnome-flashback
%{_description}

This package provides an applet for the GNOME Flashback panel.

%package mate
Requires:      %{name}%{?_isa} = %{version}-%{release}
Summary:       Workrave applet for MATE

%description mate
%{_description}

This package provides an applet for the MATE panel.

%package xfce
Requires:      %{name}%{?_isa} = %{version}-%{release}
Summary:       Workrave applet for Xfce

%description xfce
%{_description}

This package provides an applet for the Xfce panel.


%prep
%autosetup -n workrave-%{tag} -p1

# use versioned python command
%py3_shebang_fix libs/dbus/bin/dbusgen.py


%build
%cmake \
  -DWITH_GNOME_CLASSIC_PANEL:BOOL=%{?with_gnome_flashback:ON}%{!?with_gnome_flashback:OFF} \
  -DWITH_GNOME45:BOOL=%{?with_gnome45:ON}%{!?with_gnome45:OFF} \
  -DWITH_MATE:BOOL=%{?with_mate:ON}%{!?with_mate:OFF} \
  -DWITH_XFCE4:BOOL=%{?with_xfce:ON}%{!?with_xfce:OFF} \
  -DWITH_DBUS:BOOL=ON \
  -DWITH_GSTREAMER:BOOL=ON \
  -DWITH_PULSE:BOOL=ON \
  -DWITH_DBUSMENU:BOOL=ON \
  -DWITH_INDICATOR:BOOL=ON \
  -DWITH_APPINDICATOR:BOOL=ON \
  -DWITH_WAYLAND:BOOL=ON \
  %{nil}

%cmake_build


%install
%cmake_install

# workrave does not provide a public API
rm -f %{buildroot}%{_datadir}/gir-1.0/*.gir
rm -f %{buildroot}%{_libdir}/*.so
# indicators need to be enabled to build GIR but are not needed otherwise
rm -f %{buildroot}%{_libdir}/*indicators3/7/libworkrave.so*

# fix appstream ID
appstream-util modify %{buildroot}%{_metainfodir}/%{app_id}.metainfo.xml id %{app_id}

%find_lang %{name}


%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{app_id}.desktop
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{app_id}.metainfo.xml


%files -f %{name}.lang
%doc AUTHORS COPYING NEWS README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{app_id}.desktop
%{_datadir}/dbus-1/services/%{app_id}.service
%{_datadir}/glib-2.0/schemas/org.workrave.*.xml
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/sounds/%{name}/
%{_datadir}/%{name}/
%{_metainfodir}/%{app_id}.metainfo.xml
# support library for gtk3 applets
%{_libdir}/girepository-1.0/Workrave-1.0.typelib
%{_libdir}/libworkrave-private-1.0.so.*

%files cinnamon
%dir %{_datadir}/cinnamon/
%dir %{_datadir}/cinnamon/applets/
%{_datadir}/cinnamon/applets/workrave@workrave.org/

%if %{with gnome}
%files gnome
%if %{with gnome40}
%{_libdir}/girepository-1.0/Workrave-2.0.typelib
%{_libdir}/libworkrave-gtk4-private-1.0.so.*
%endif
%dir %{_datadir}/gnome-shell/
%dir %{_datadir}/gnome-shell/extensions/
%{_datadir}/gnome-shell/extensions/workrave@workrave.org/
%endif

%if %{with gnome_flashback}
%files gnome-flashback
%{_libdir}/gnome-panel/modules/libworkrave-applet.so
%endif

%if %{with xfce}
%files xfce
%{_libdir}/xfce4/panel/plugins/libworkrave-plugin.so
%{_datadir}/xfce4/panel/plugins/workrave-xfce-applet.desktop
%endif

%if %{with mate}
%files mate
%{_libdir}/mate-applets/workrave-applet
%{_datadir}/dbus-1/services/org.mate.panel.applet.WorkraveAppletFactory.service
%{_datadir}/mate-panel/applets/org.workrave.WorkraveApplet.mate-panel-applet
%{_datadir}/mate-panel/ui/workrave-menu.xml
%endif

%changelog
## START: Generated by rpmautospec
* Fri May 31 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 1.11.0~beta.12-2
- Fix operation on wayland

* Fri May 31 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 1.11.0~beta.12-1
- 1.11.0~beta.12

* Wed Mar 27 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.52-4
- Rebuilt for gnome-panel 3.52.0

* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.52-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.52-2
- Fix EPEL compatibility

* Sun Dec 17 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.52-1
- 1.10.52

* Fri Oct 20 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.51.1-5
- Drop 2to3 usage

* Mon Sep 11 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.51.1-4
- https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval

* Mon Sep 11 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.51.1-3
- Rebuilt for gnome-panel-3.49.1

* Tue Aug 29 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.51.1-1
- Update to 1.10.51.1

* Tue Aug 29 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.50-7
- Cleanup spec

* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.50-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.50-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Nov 04 2022 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.50-1
- Update to 1.10.50
- Enable GNOME Flashback applet
- Support GNOME Shell 42 (#2132504) and 43 (#2132507)

* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.49-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.49-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sun Jan 09 2022 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.10.49-1
- Update to 1.10.49
- Fixes rhbz#1986369 and rhbz#2035023

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.45-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Thu May 06 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.10.45-1
- Update to 1.10.45
- Drop upstreamed patch

* Mon Feb 08 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.10.44-3
- Build against xfce-4.16

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.44-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Fri Oct 02 2020 Lukas Zapletal <lzap+rpm@redhat.com> - 1.10.44-1
- new version

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.37-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Fri Mar 27 2020 Lukas Zapletal <lzap+rpm@redhat.com> - 1.10.37-1
- new version

* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.20-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.20-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Apr 12 2019 Lukas Zapletal <lzap+rpm@redhat.com> - 1.10.20-5
- Updated X11 and python3 deps

* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.20-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.20-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.20-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Nov 14 2017 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.20-1
- new version (#1508256)

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.16-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.16-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Sep 16 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.16-1
- new version (#1376625)

* Thu May 12 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.15-1
- new version (#1321458)

* Fri Feb 26 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 1.10.10-1
- new version
- Add Cinnamon, Indicator, MATE, Xfce applets
- Cleanup spec

* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 1.10-8
- Rebuilt for GCC 5 C++11 ABI change

* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jul 22 2014 Kalev Lember <kalevlember@gmail.com> - 1.10-6
- Rebuilt for gobject-introspection 1.41.4

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Fri May  3 2013 Tomáš Mráz <tmraz@redhat.com> - 1.10-3
- do not build the panel applet

* Mon Mar 25 2013 Peter Robinson <pbrobinson@fedoraproject.org> 1.10-2
- Add missing distag

* Tue Feb 19 2013 Tomáš Mráz <tmraz@redhat.com> - 1.10-1
- new upstream release

* Fri Feb  8 2013 Tomáš Mráz <tmraz@redhat.com> - 1.9.911-0.2.20130107git6f9bc5d
- drop --vendor from desktop-file-install call

* Tue Jan  8 2013 Tom Callaway <spot@fedoraproject.org> - 1.9.911-0.1.20130107git6f9bc5d
- update to 1.9.911 checkout from github
- build for gnome3

* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.4-5
- Rebuilt for c++ ABI breakage

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Nov  7 2011 Tomas Mraz <tmraz@redhat.com> - 1.9.4-3
- rebuilt with new libpng

* Tue Jun 28 2011 Tomas Mraz <tmraz@redhat.com> - 1.9.4-2
- no longer needs gnet2

* Wed Apr 06 2011 Rahul Sundaram <sundaram@fedoraproject.org> - 1.9.4-1
- New upstream bug fix release. Closes rhbz#693958
- https://github.com/rcaelers/workrave/blob/b491d9b5054b5571d5b4ff0f6c9137133735129d/NEWS
- Drop buildroot definition and clean section

* Thu Feb 10 2011 Tomas Mraz <tmraz@redhat.com> - 1.9.3-4
- due to changes in gnome applet API we have to build without
  gnome support

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Feb  3 2011 Tomas Mraz <tmraz@redhat.com> - 1.9.3-2
- rebuilt with new gnome-panel

* Fri Dec 17 2010 Tomas Mraz <tmraz@redhat.com> - 1.9.3-1
- new upstream release with bug fixes and usability improvements

* Wed Nov  3 2010 Tomas Mraz <tmraz@redhat.com> - 1.9.2-1
- new upstream release hopefully fixing at least some of the aborts

* Mon Apr 26 2010 Tomas Mraz <tmraz@redhat.com> - 1.9.1-4
- better guard for BadWindow errors in input monitor (#566156)

* Wed Mar 17 2010 Tomas Mraz <tmraz@redhat.com> - 1.9.1-3
- fix FTBFS (#564917)

* Thu Jan 28 2010 Tomas Mraz <tmraz@redhat.com> - 1.9.1-2
- do not build against gdome2 - not too useful optional feature

* Tue Dec  8 2009 Tomas Mraz <tmraz@redhat.com> - 1.9.1-1
- new upstream version

* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Feb 27 2009 Tomas Mraz <tmraz@redhat.com> - 1.9.0-3
- fix build with new gcc 4.4 and glibc

* Fri Sep 26 2008 Tomas Mraz <tmraz@redhat.com> - 1.9.0-1
- new upstream version

* Fri Apr  4 2008 Tomas Mraz <tmraz@redhat.com> - 1.8.5-4
- fix locking/unlocking with gnome-screensaver (#207058)
- make it build with current libsigc++

* Wed Feb 20 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.8.5-3
- Autorebuild for GCC 4.3

* Tue Feb 19 2008 Tomas Mraz <tmraz@redhat.com> - 1.8.5-2
- make it build on gcc-4.3

* Mon Jan  7 2008 Tomas Mraz <tmraz@redhat.com> - 1.8.5-1
- upgrade to latest upstream version

* Wed Aug 22 2007 Tomas Mraz <tmraz@redhat.com> - 1.8.4-4
- applet counters don't start properly
- license tag fix

* Wed Apr 18 2007 Tomas Mraz <tmraz@redhat.com> - 1.8.4-3
- fixed applet crash (#236543)

* Mon Mar 26 2007 Tomas Mraz <tmraz@redhat.com> - 1.8.4-2
- new upstream version
- add datadir/pixmaps/workrave to files (#233815)

* Thu Sep  7 2006 Tomas Mraz <tmraz@redhat.com> - 1.8.3-2
- rebuilt for FC6

* Wed May 31 2006 Tomas Mraz <tmraz@redhat.com> - 1.8.3-1
- New upstream version

* Wed Feb 15 2006 Tomas Mraz <tmraz@redhat.com> - 1.8.2-2
- Rebuilt with updated gcc

* Thu Feb  2 2006 Tomas Mraz <tmraz@redhat.com> - 1.8.2-1
- Updated version, dropped obsolete patch
- Added missing buildrequires for modular X
- Fixed compilation on gcc-4.1

* Sat Oct 22 2005 Tomas Mraz <tmraz@redhat.com> - 1.8.1-4
- Added a desktop file
- Added find_lang
- Fixed wrong install extension for message translations

* Thu Oct 20 2005 Tomas Mraz <tmraz@redhat.com> - 1.8.1-3
- Removed Prefix:, added BuildRequires gnome-panel-devel
- Group: Applications/Productivity

* Thu Sep 22 2005 Tomas Mraz <tmraz@redhat.com> - 1.8.1-2
- Initial package, reused spec from package by Steve Ratcliffe

## END: Generated by rpmautospec