File rtkit.spec of Package rtkit

# spec file for package rtkit
# Copyright (c) 2014 SUSE LINUX Products 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

Name:           rtkit
Summary:        Realtime Policy and Watchdog Daemon
License:        GPL-3.0+ and BSD-3-Clause
Group:          System/Base
Version:        0.11_git201205151338
Release:        0
# The daemon itself is GPL v3 or later, the reference implementation for the client BSD-3-Clause
Source:         %{name}-%{version}.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  automake
BuildRequires:  dbus-1-devel >= 1.2
BuildRequires:  libcap-devel
BuildRequires:  polkit-devel
BuildRequires:  xz
Requires:       polkit
PreReq:         dbus-1
%if 0%{?suse_version} > 1140
BuildRequires:  pkgconfig(libsystemd-daemon)
%define has_systemd 1
Patch0:         rtkit-use-system-sd-daemon.patch
# PATCH-FIX-UPSTREAM rtkit-bnc836939.patch -- use of insecure polkit DBUS API
Patch1:         rtkit-bnc836939.patch
Patch2:         rtkit-no-cpu-controlgroup.patch

RealtimeKit is a D-Bus system service that changes the
scheduling policy of user processes/threads to SCHED_RR (i.e. realtime
scheduling mode) on request. It is intended to be used as a secure
mechanism to allow real-time scheduling to be used by normal user

%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

autoreconf -fiv
%configure --disable-silent-rules \
%if 0%{?has_systemd}
--with-systemdsystemunitdir=%{_unitdir} \

make %{?_smp_mflags}
./rtkit-daemon --introspect > org.freedesktop.RealtimeKit1.xml

install -D org.freedesktop.RealtimeKit1.xml $RPM_BUILD_ROOT/%{_datadir}/dbus-1/interfaces/org.freedesktop.RealtimeKit1.xml


%if 0%{?has_systemd}
%service_del_preun rtkit-daemon.service

groupadd -r rtkit &>/dev/null || :
/usr/bin/id rtkit >/dev/null 2>&1 || \
        useradd -r -g rtkit -c 'RealtimeKit' -s /bin/false -d /proc rtkit

%if 0%{?has_systemd}
%service_add_pre rtkit-daemon.service

dbus-send --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig >/dev/null 2>&1 || :
%if 0%{?has_systemd}
%service_add_post rtkit-daemon.service

%if 0%{?has_systemd}
%service_del_postun rtkit-daemon.service

%doc README GPL LICENSE rtkit.c rtkit.h
%attr(0755,root,root) %{_sbindir}/rtkitctl
%dir %{_libexecdir}/rtkit
%attr(0755,root,root) %{_libexecdir}/rtkit/rtkit-daemon
%if 0%{?has_systemd}

openSUSE Build Service is sponsored by