File thermald.spec of Package thermald

#
# spec file for package thermald
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           thermald
Version:        1.5.3
Release:        0
Summary:        The Linux Thermal Daemon program from 01.org
License:        GPL-2.0+
Group:          System/Daemons
Url:            https://01.org/linux-thermal-daemon
Source0:        https://github.com/01org/thermal_daemon/archive/v%{version}.tar.gz
Source1:        thermald.conf
BuildRequires:  automake
BuildRequires:  dbus-1-devel
BuildRequires:  gcc-c++
BuildRequires:  glib2-devel
BuildRequires:  libxml2
BuildRequires:  libxml2-devel
BuildRequires:  pkg-config
BuildRequires:  systemd-devel
BuildRequires:  pkgconfig(systemd)
%if %{defined suse_version}
BuildRequires:  dbus-1-glib-devel
%endif
%if %{defined fedora_version}
BuildRequires:  dbus-glib-devel
BuildRequires:  systemd-units
%endif
ExclusiveArch:  %{ix86} x86_64

%description
Thermald is a Linux daemon used to prevent the overheating of platforms.
This daemon monitors temperature and applies compensation using available cooling methods.

%prep
%setup -q -n thermal_daemon-%{version}

%build
./autogen.sh
%configure
make %{?_smp_mflags} CFLAGS="%{optflags}"

%pre
%service_add_pre thermald.service

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}

%if %{defined suse_version}
# Upstart file not needed
rm %{buildroot}%{_sysconfdir}/init/thermald.conf
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcthermald
install -Dm644 "%{_sourcedir}/thermald.conf" "%{buildroot}/%{_libexecdir}/modules-load.d/thermald.conf"
%endif

%post
%service_add_post thermald.service

%preun
%service_del_preun thermald.service

%postun
%service_del_postun thermald.service

%files
%defattr(-,root,root)
%dir %{_datadir}/dbus-1/system-services
%dir %{_sysconfdir}/dbus-1/system.d
%dir %{_sysconfdir}/thermald
%config %{_sysconfdir}/dbus-1/system.d/org.freedesktop.thermald.conf
%config %{_sysconfdir}/thermald/thermal-conf.xml
%config %{_sysconfdir}/thermald/thermal-cpu-cdev-order.xml
%{_datadir}/dbus-1/system-services/org.freedesktop.thermald.service
%{_mandir}/man5/thermal-conf.xml.5.gz
%{_mandir}/man8/thermald.8.gz
%{_sbindir}/thermald

%if %{defined suse_version}
%dir %{_libexecdir}/modules-load.d
%{_libexecdir}/modules-load.d/thermald.conf
%{_unitdir}/thermald.service
%{_sbindir}/rcthermald
%endif
%if %{defined fedora_version}
%{_unitdir}/thermald.service
%endif

%changelog
openSUSE Build Service is sponsored by