File irqbalance.spec of Package irqbalance.18799

#
# spec file for package irqbalance
#
# Copyright (c) 2021 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:           irqbalance
Version:        1.1.0
Release:        0
Summary:        Balance IRQs on SMP Machines
License:        GPL-2.0-or-later
Group:          System/Daemons
URL:            https://github.com/Irqbalance/irqbalance
Source:         https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz
Source3:        sysconfig.irqbalance
Patch1:         fix-aarch64-support.patch
Patch2:         Set-fd-limit.patch
Patch3:         0001-Teach-irqbalance-about-Intel-CoD.patch
Patch4:         set-numa-node.patch
Patch5:         procinterrupts-check-xen-dyn-event-more-flexible.patch
BuildRequires:  libcap-ng-devel
BuildRequires:  libtool
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(glib-2.0)
Requires(pre):  coreutils
Requires(pre):  fillup
ExcludeArch:    s390 s390x
%{?systemd_requires}
%ifnarch %arm
BuildRequires:  libnuma-devel
%endif

%description
irqbalance dynamically switches the CPUs for IRQs to prevent cpu0 from
being used for all IRQs.

%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

%build
NOCONFIGURE=1 ./autogen.sh
%configure
make %{?_smp_mflags} LDFLAGS="-Wl,-z,relro,-z,now" CFLAGS="%{optflags} -fPIE -pie"
cp %{SOURCE3} .
gzip irqbalance.1

%install
mkdir -p %{buildroot}%{_sbindir}
install -m 0755 irqbalance %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_mandir}/man1
install -m 0644 irqbalance.1.gz %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates/
install -m 0644 sysconfig.irqbalance %{buildroot}%{_localstatedir}/adm/fillup-templates/
sed -ie "s|EnvironmentFile=.*|EnvironmentFile=%{_sysconfdir}/sysconfig/irqbalance|g" misc/irqbalance.service
# Remove syslog.target in systemd service file; not provided by systemd anymore
sed -ie "s|After=syslog.target||g" misc/irqbalance.service
install -D -m 0644 misc/irqbalance.service %{buildroot}%{_unitdir}/irqbalance.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcirqbalance

%pre
%service_add_pre irqbalance.service

%post
%fillup_only %{name}
%service_add_post irqbalance.service

%preun
%service_del_preun irqbalance.service

%postun
%service_del_postun irqbalance.service

%files
%defattr(-,root,root,-)
%{_sbindir}/irqbalance
%{_sbindir}/rcirqbalance
%{_unitdir}/irqbalance.service
%{_mandir}/man1/irqbalance.1.gz
%{_localstatedir}/adm/fillup-templates/sysconfig.irqbalance

%changelog
openSUSE Build Service is sponsored by