File cpupower-gui.spec of Package cpupower-gui

#
# spec file for package cpupower-gui
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

Name:           cpupower-gui
Version:        1.0.0+git.21.80e68e9
Release:        0%{?dist}
Summary:        Cpupower-gui is a graphical program to adjust the frequency limits of the cpu
License:        GPL-3.0-only
URL:            https://github.com/vagnum08/cpupower-gui
Source0:        %{name}-%{version}.tar.xz
Source1:        cpupower-gui-rpmlintrc
Requires:       hicolor-icon-theme
Requires:       python3-pyxdg
Suggests:       mate-polkit
Suggests:       polkit-gnome
Suggests:       polkit-kde
BuildArch:      noarch
BuildRequires:  systemd-rpm-macros
%if 0%{?fedora_version}
BuildRequires:  gettext
BuildRequires:  glib2-devel
BuildRequires:  meson
BuildRequires:  pkgconfig
BuildRequires:  python3
Requires:       gtk3
Requires:       libhandy1
Requires:       python3-dbus
Requires:       python3-gobject
Suggests:       libappindicator-gtk3
%else
%if 0%{?suse_version}
BuildRequires:  gettext-tools
BuildRequires:  glib2-devel
BuildRequires:  meson
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  systemd
Requires:       libgtk-3-0
Requires:       libhandy-1-0
Requires:       python3-dbus-python
Requires:       python3-gobject
Requires:       python3-gobject-Gdk
Requires:       systemd
Requires:       typelib-1_0-Gtk-3_0
Requires:       typelib-1_0-Handy-1_0
Suggests:       typelib-1_0-AppIndicator3-0_1
%endif
%endif

%description
This program is designed to allow you to change the frequency limits of your cpu and its governor. The application is similar in functionality to cpupower.

%global debug_package %{nil}

%prep
%autosetup -c

%build
cd %{name}-%{version}/
%meson --libdir %{_prefix}/lib
%meson_build

%install
cd %{name}-%{version}/
%meson_install

%find_lang %{name}

%pre
%if 0%{?fedora_version}
#
%else
%service_add_pre cpupower-gui-helper.service
%service_add_pre cpupower-gui.service
%endif

%post
%if 0%{?fedora_version}
%systemd_post cpupower-gui-helper.service
%systemd_post cpupower-gui.service
%else
%service_add_post cpupower-gui-helper.service
%service_add_post cpupower-gui.service
%endif
systemctl enable cpupower-gui cpupower-gui-helper.service
systemctl start cpupower-gui cpupower-gui-helper.service

%preun
%if 0%{?fedora_version}
%systemd_preun cpupower-gui-helper.service
%systemd_preun cpupower-gui.service
%else
%service_del_preun cpupower-gui-helper.service
%service_del_preun cpupower-gui.service
%endif
systemctl stop cpupower-gui.service cpupower-gui-helper.service
systemctl disable cpupower-gui.service cpupower-gui-helper.service

%postun
%if 0%{?fedora_version}
%systemd_postun_with_restart cpupower-gui-helper.service
%systemd_postun_with_restart cpupower-gui.service
%else
%service_del_postun cpupower-gui-helper.service
%service_del_postun cpupower-gui.service
%endif

%check
cd %{name}-%{version}/
%meson_test

%files
%if 0%{?suse_version}
%dir %{_datadir}/polkit-1/rules.d
%endif
%{_bindir}/cpupower-gui
%{_prefix}/lib/systemd/
%{_prefix}/lib/cpupower-gui/
%config %{_sysconfdir}/cpupower_gui.d/
%config %{_sysconfdir}/cpupower_gui.conf
%{_datadir}/cpupower-gui/
%{_datadir}/icons/
%{_datadir}/locale/
%{_datadir}/metainfo/
%{_datadir}/glib-2.0/schemas/org.rnd2.cpupower_gui.gschema.xml
%{_datadir}/polkit-1/actions/org.rnd2.cpupower-gui.policy
%{_datadir}/polkit-1/rules.d/org.rnd2.cpupower-gui.rules
%{_datadir}/dbus-1/
%{_datadir}/applications/org.rnd2.cpupower_gui.desktop
%{_mandir}/

%license %{name}-%{version}/COPYING
%doc %{name}-%{version}/AUTHORS

%changelog
openSUSE Build Service is sponsored by