File slimbookamdcontroller.spec of Package slimbookamdcontroller

#
# spec file for package slimbookamdcontroller
#
# 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/
#


# exclude while 3.12 isn't default python in TW yet
%define skip_python312 1

Name:           slimbookamdcontroller
Version:        0.3.8b+git
Release:        0
Summary:        Battery optimization application for portable devices
BuildArch:      noarch
License:        GPL-3.0
Group:          System/Management
URL:            https://github.com/Slimbook-Team/slimbookamdcontroller
Source0:        %{name}-%{version}.tar.xz
Patch0:         %{name}-desktop.patch
BuildRequires:  fdupes
BuildRequires:  dos2unix
BuildRequires:  polkit
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme

Requires:       python3-matplotlib-gtk3
Requires:       python3-pyamdgpuinfo
Requires:       ryzenadj
# systray icon embedding
Recommends: typelib-1_0-AppIndicator3-0_1
Recommends: typelib-1_0-Notify-0_7

%description

Slimbook AMD Controller works by setting your CPU TDP value. That is,
the amount of power measured in watts that you CPU is allowed to draw to
save battery or to improve the overall performance under heavy workloads
like rendering jobs or serious number crunching on large spreadsheets.
Increasing the TDP allows the CPU to use its boost frequency more often
or even permanently on some scenarios.

Use this software with caution as the heat output will increase
dramatically on the higher performance settings, we can't guarantee that
all AMD CPU's will behave the same way, so your mileage may vary.

Slimbook AMD Controller is designed with mobile AMD Ryzen processors in mind.

%prep
%autosetup -p1

dos2unix src/images/icons/scalable/apps/slimbookamdcontroller.svg

%build
# nothing to do

%install
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
mkdir -p %{buildroot}/usr/lib/systemd/system-sleep/
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/polkit-1/actions/
mkdir -p %{buildroot}%{_udevrulesdir}
mkdir %{buildroot}%{_datadir}/%{name}/images
mkdir %{buildroot}%{_datadir}/%{name}/src

install -m 755 bin/* %{buildroot}%{_bindir}

install -m 755 post-suspension/* %{buildroot}/usr/lib/systemd/system-sleep/
cp -r src/images/* %{buildroot}%{_datadir}/%{name}/images/
cp -r src/images/icons/* %{buildroot}%{_datadir}/icons/hicolor/
chmod 755 src/*.py
chmod 644 src/utils.py
chmod 644 src/settings.py
chmod 644 src/translations/README.md
cp -r src/* %{buildroot}%{_datadir}/%{name}/src/
install -m 644 %{name}.desktop %{buildroot}%{_datadir}/applications/
install -m 644 policykit/* %{buildroot}%{_datadir}/polkit-1/actions/
install -m 644 udev-rules/* %{buildroot}%{_udevrulesdir}/

%fdupes %{buildroot}

%post
%desktop_database_post

%postun
%desktop_database_postun

%check

%files
%license LICENSE
%doc README.md
%{_bindir}/*
%dir /usr/lib/systemd/system-sleep
/usr/lib/systemd/system-sleep/*
%{_udevrulesdir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/polkit-1/actions/com.slimbook.amdcontroller.pkexec.policy
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*

%changelog
openSUSE Build Service is sponsored by