File cpupower.spec of Package cpupower.9225

# spec file for package cpupower
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Author: Thomas Renninger <>
# 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:           cpupower
# Use this as version when things are in mainline kernel
%define version %(rpm -q --qf '%VERSION' kernel-source)
Version:        4.15
Release:        0
%define tsversion      17.04.12
%define pbversion      17.05.11
Summary:        Tools to determine and set CPU Power related Settings
License:        GPL-2.0
Group:          System/Base
Source:         %name-%version.tar.bz2
Source1:        turbostat-%tsversion.tar.bz2
Source3:        x86_energy_perf_policy-%{pbversion}.tar.bz2

Patch1:         cpupower_rapl.patch
Patch2:         rapl_monitor.patch
Patch3:         cpupower_exclude_kernel_Makefile.patch
Patch4:         cpupower_fix_compilation_and_sysfs_read_file_mess.patch

Patch20:        turbostat_fix_man_perm.patch
Patch22:        turbostat_makefile_fix_asm_header.patch
# Fixes bsc#1048546:
Patch23:        turbostat_decode_MSR_IA32_MISC_ENABLE_only_on_Intel.patch

Patch30:        x86_perf_makefile_fix_asm_header.patch
Patch31:        x86_perf_fix_man_permissions.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gettext-tools
BuildRequires:  pciutils
BuildRequires:  pciutils-devel
Obsoletes:      cpufrequtils
Provides:       cpufrequtils = %version

This tool is to make access to the Linux kernel's processor power subsystems
like CPU frequency switching (cpufreq) or CPU sleep states (cpuidle) for users
and userspace tools easier.

%package -n libcpupower0
Summary:        Obsolete processor frequency related C-library
Group:          System/Libraries

%description -n libcpupower0
Contains libcpupower and soon possibly other CPU power related
C libraries.

%package devel
Summary:        Include files and C-libraries
Group:          Development/Languages/C and C++
Conflicts:      cpufrequtils-devel
Requires:       libcpupower0 = %version

%description devel
Include files and C-libraries for C/C++ development

%package bench
Summary:        CPU frequency micro benchmark
Group:          System/Benchmark
Obsoletes:      cpufrequtils-bench < %version
Provides:       cpufrequtils-bench = %version

%description bench
Helps to test the condition of a given kernel cpufreq
governor (e.g. ondemand, userspace, conservative) and the cpufreq HW driver
(e.g. powernow-k8, acpi-cpufreq, ...).
For that purpose, it compares the performance governor to a configured
powersave module.

%setup -D -b 1 -b 3
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

cd ../turbostat-%tsversion
%patch20 -p1
%patch22 -p1
%patch23 -p1

cd ../x86_energy_perf_policy-%{pbversion}
%patch30 -p1
%patch31 -p1

# This package failed when testing with -Wl,-as-needed being default.
# So we disable it here, if you want to retest, just delete this comment and the line below.
CONF="PACKAGE_BUGREPORT= mandir=%_mandir libdir=%_libdir CPUFRQ_BENCH=true VERSION=%version"
export CFLAGS="%optflags -I ."
make $CONF %{?_smp_mflags}

%ifarch ix86 x86_64
cd ../turbostat-%tsversion
export CFLAGS="%optflags -I ."
make %{?_smp_mflags}
cd ../x86_energy_perf_policy-%{pbversion}
make %{?_smp_mflags}

CONF="PACKAGE_BUGREPORT= mandir=%_mandir libdir=%_libdir CPUFRQ_BENCH=true DESTDIR=%buildroot sbindir=%_sbindir docdir=%_docdir/%name confdir=%_sysconfdir VERSION=%version"
%make_install $CONF
# copy to examples doc dir to avoid complains from the build
# system about an executable in the doc dir.
mkdir -p %buildroot/%_docdir/%name/examples
mv %buildroot//%_docdir/%name/ %buildroot/%_docdir/%name/examples
%find_lang %name

%ifarch ix86 x86_64
cd ../turbostat-%tsversion
%make_install -e
cd ../x86_energy_perf_policy-%{pbversion}

%post -n libcpupower0 -p /sbin/ldconfig

%postun -n libcpupower0 -p /sbin/ldconfig

%files -f %name.lang
%defattr (-,root,root)
%ifarch ix86 x86_64

%files bench
%defattr (-,root,root)
%config %_sysconfdir/cpufreq-bench.conf
%dir %_docdir/%name
%dir %_docdir/%name/examples

%files -n libcpupower0

%files devel

openSUSE Build Service is sponsored by