# Conditional build:
%bcond_without verbose # verbose build (V=1)
%bcond_without perf # perf tools
-%bcond_without gtk # gtk perf version
+%bcond_without gtk # GTK+ 2.x perf support
+%bcond_without libunwind # libunwind perf support
-%define rel 3
-%define basever 3.10
-%define postver .27
+%ifarch x32
+%undefine with_libunwind
+%endif
+
+%define basever 4.1
+%define postver .6
Summary: Assortment of tools for the Linux kernel
Summary(pl.UTF-8): Zestaw narzędzi dla jądra Linuksa
Name: kernel-tools
Version: %{basever}%{postver}
-Release: %{rel}
+Release: 2
License: GPL v2
Group: Applications/System
-Source0: http://www.kernel.org/pub/linux/kernel/v3.x/linux-%{basever}.tar.xz
-# Source0-md5: 4f25cd5bec5f8d5a7d935b3f2ccb8481
-%if "%{postver}" != ".0"
-Patch0: http://www.kernel.org/pub/linux/kernel/v3.x/patch-%{version}.xz
-# Patch0-md5: 58009825fb7ca7ca7913ab68fbf8a8a7
-%endif
+Source0: https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{basever}.tar.xz
+# Source0-md5: fe9dc0f6729f36400ea81aa41d614c37
Source1: cpupower.service
Source2: cpupower.config
-Source3: perf
+%if "%{postver}" != ".0"
+Patch0: https://www.kernel.org/pub/linux/kernel/v4.x/patch-%{version}.xz
+# Patch0-md5: 7dea69f02c906206f88df48085069eb6
+%endif
+Patch1: x32.patch
URL: http://www.kernel.org/
+%ifarch %{x8664}
+BuildRequires: gcc-multilib-32
+BuildRequires: gcc-multilib-x32
+%endif
BuildRequires: gettext-tools
BuildRequires: pciutils-devel
BuildRequires: rpmbuild(macros) >= 1.647
BuildRequires: docbook-style-xsl
BuildRequires: elfutils-devel
BuildRequires: flex
-BuildRequires: libunwind-devel >= 0.99
+%{?with_libunwind:BuildRequires: libunwind-devel >= 0.99}
+BuildRequires: numactl-devel
BuildRequires: perl-devel >= 5.1
BuildRequires: python-devel
BuildRequires: rpm-pythonprov
%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# otherwise /usr/lib/rpm/bin/debugedit: canonicalization unexpectedly shrank by one character
+%define _enable_debug_packages 0
+
%define makeopts CC="%{__cc}" %{?with_verbose:V=1}
%description
%description cpupower-libs-devel -l pl.UTF-8
Pliki programistyczne biblioteki cpupower.
-%package perf-core
-Summary: perf profiler tool (core package)
-Summary(pl.UTF-8): Narzędzie profilujące perf (podstawowe narzędzia)
+%package perf
+Summary: perf profiler tool
+Summary(pl.UTF-8): Narzędzie profilujące perf
Group: Applications/System
+Suggests: binutils
+Obsoletes: perf-core
+Obsoletes: perf-slang
-%description perf-core
+%description perf
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
-This package contains core files and scripts.
+This package contains core files, scripts and text interface (TUI).
-%description perf-core -l pl.UTF-8
+%description perf -l pl.UTF-8
Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
odseparowujące od różnic sprzętowych między pomiarami wydajności w
zależności od procesora oraz udostępniające prosty interfejs linii
poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
przez nowe wersje jądra Linuksa.
-Ten pakiet zawiera podstawowe pliki i skrypty.
+Ten pakiet zawiera podstawowe pliki, skrypty oraz interfejs tekstowy
+(TUI).
-%package perf-gtk
-Summary: perf profiler tool (GTK+ GUI)
-Summary(pl.UTF-8): Narzędzie profilujące perf (interfejs graficzny GTK+)
-Group: X11/Applications
-Requires: %{name}-perf-core = %{version}-%{release}
-Provides: %{name}-perf = %{version}-%{release}
+%package perf-vdso32
+Summary: perf profiler tool
+Summary(pl.UTF-8): Narzędzie profilujące perf
+Group: Applications/System
+Requires: %{name}-perf = %{version}-%{release}
-%description perf-gtk
+%description perf-vdso32
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
-This package contains GTK+ based GUI.
+This package contains perf-read-vdso32 tool for reading the 32-bit
+compatibility VDSO in 64-bit mode.
-%description perf-gtk -l pl.UTF-8
-Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
-odseparowujące od różnic sprzętowych między pomiarami wydajności w
-zależności od procesora oraz udostępniające prosty interfejs linii
-poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
-przez nowe wersje jądra Linuksa.
+%package perf-vdsox32
+Summary: perf profiler tool
+Summary(pl.UTF-8): Narzędzie profilujące perf
+Group: Applications/System
+Requires: %{name}-perf = %{version}-%{release}
-Ten pakiet zawiera graficzny interfejs oparty na GTK+.
+%description perf-vdsox32
+Perf is a profiler tool for Linux 2.6+ based systems that abstracts
+away CPU hardware differences in Linux performance measurements and
+presents a simple commandline interface. Perf is based on the
+perf_events interface exported by recent versions of the Linux kernel.
-%package perf-slang
-Summary: perf profiler tool (Slang TUI)
-Summary(pl.UTF-8): Narzędzie profilujące perf (interfejs tekstowy Slang)
+This package contains perf-read-vdso32 tool for reading the x32 mode
+32-bit compatibility VDSO in 64-bit mode.
+
+%package perf-gtk
+Summary: perf profiler tool (GTK+ 2 GUI)
+Summary(pl.UTF-8): Narzędzie profilujące perf (interfejs graficzny GTK+ 2)
Group: X11/Applications
-Requires: %{name}-perf-core = %{version}-%{release}
-Provides: %{name}-perf = %{version}-%{release}
+Requires: %{name}-perf = %{version}-%{release}
-%description perf-slang
+%description perf-gtk
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
-This package contains Slang based TUI.
+This package contains GTK+ 2 based GUI.
-%description perf-slang -l pl.UTF-8
+%description perf-gtk -l pl.UTF-8
Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
odseparowujące od różnic sprzętowych między pomiarami wydajności w
zależności od procesora oraz udostępniające prosty interfejs linii
poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
przez nowe wersje jądra Linuksa.
-Ten pakiet zawiera tekstowy interfejs oparty na bibliotece Slang.
+Ten pakiet zawiera graficzny interfejs oparty na GTK+ 2.
%package -n bash-completion-perf
Summary: Bash completion for perf command
Group: Applications/Shells
Requires: %{name}-perf
Requires: bash-completion
+%if "%{_rpmversion}" >= "5"
+BuildArch: noarch
+%endif
%description -n bash-completion-perf
Bash completion for perf command.
%patch0 -p1
%endif
+%patch1 -p1
+
+sed -i -e 's#libexec/perf-core#%{_datadir}/perf-core#g' tools/perf/config/Makefile
+
%build
cd linux-%{basever}
OPTIMIZATION="%{rpmcflags}" \
STRIPCMD=true
-%ifarch %{ix86}
+%ifarch %{ix86} x32
%{__make} -C tools/power/cpupower/debug/i386 centrino-decode powernow-k8-decode \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
%endif
-%ifarch %{x8664}
+%ifarch %{x8664} x32
%{__make} -C tools/power/cpupower/debug/x86_64 centrino-decode powernow-k8-decode \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
%endif
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
%{__make} -C tools/power/x86/x86_energy_perf_policy \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
+CFLAGS="%{rpmcflags}" \
%{__make} -C tools/power/x86/turbostat \
- CC="%{__cc}" \
- CFLAGS="%{rpmcflags} -Wall -I../../../../arch/x86/include/uapi/"
+ CC="%{__cc}"
%endif
# page-types, slabinfo
CFLAGS="%{rpmcflags} -Wall -Wextra -I../lib"
%if %{with perf}
-# perf slang version
-PWD=${PWD:-$(pwd)}
-install -d $PWD/perf-{slang,gtk}
%{__make} -C tools/perf all man \
- O=$PWD/perf-slang \
- NO_GTK2=1 \
- %{makeopts} \
- CFLAGS_OPTIMIZE="%{rpmcflags}" \
- WERROR=0 \
- prefix=%{_prefix} \
- perfexecdir=%{_datadir}/perf-core \
- template_dir=%{_datadir}/perf-core/templates
-
-%if %{with gtk}
-# perf gtk version
-%{__make} -C tools/perf all man \
- O=$PWD/perf-gtk \
+%ifarch %{x8664}
+ IS_X86_64=1 \
+%endif
+ %{!?with_gtk:NO_GTK2=1} \
+ %{!?with_libunwind:NO_LIBUNWIND=1} \
%{makeopts} \
CFLAGS_OPTIMIZE="%{rpmcflags}" \
WERROR=0 \
prefix=%{_prefix} \
perfexecdir=%{_datadir}/perf-core \
+ lib=%{_lib} \
template_dir=%{_datadir}/perf-core/templates
%endif
-%endif
# gen_init_cpio
%{__make} -C usr gen_init_cpio \
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/cpupower.service
cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/cpupower
-%ifarch %{ix86}
+%ifarch %{ix86} x32
install -p tools/power/cpupower/debug/i386/{centrino,powernow-k8}-decode $RPM_BUILD_ROOT%{_bindir}
%endif
-%ifarch %{x8664}
+%ifarch %{x8664} x32
install -p tools/power/cpupower/debug/x86_64/{centrino,powernow-k8}-decode $RPM_BUILD_ROOT%{_bindir}
%endif
install -p tools/vm/page-types $RPM_BUILD_ROOT%{_sbindir}
install -p dslm $RPM_BUILD_ROOT%{_sbindir}
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
install -d $RPM_BUILD_ROOT%{_mandir}/man8
-# broken makefile, install manually
-%if 0
%{__make} install \
-C tools/power/x86/x86_energy_perf_policy \
DESTDIR=$RPM_BUILD_ROOT
-%else
-cd tools/power/x86/x86_energy_perf_policy
-install -p x86_energy_perf_policy $RPM_BUILD_ROOT%{_bindir}
-cp -p x86_energy_perf_policy.8 $RPM_BUILD_ROOT%{_mandir}/man8
-cd -
-%endif
-# broken makefile, install manually
-%if 0
%{__make} install \
-C tools/power/x86/turbostat \
DESTDIR=$RPM_BUILD_ROOT
-%else
-cd tools/power/x86/turbostat
-cp -p turbostat.8 $RPM_BUILD_ROOT%{_mandir}/man8
-cd -
-install -p turbostat $RPM_BUILD_ROOT%{_bindir}/turbostat
-%endif
%endif
%if %{with perf}
-# perf slang
-PWD=${PWD:-$(pwd)}
-# perf slang version
-%{__make} -j1 install install-man \
- -C tools/perf \
- O=$PWD/perf-slang \
- NO_GTK2=1 \
- CC="%{__cc}" \
- CFLAGS_OPTIMIZE="%{rpmcflags}" \
- WERROR=0 \
- %{?with_verbose:V=1} \
- prefix=%{_prefix} \
- perfexecdir=%{_datadir}/perf-core \
- template_dir=%{_datadir}/perf-core/templates \
- DESTDIR=$RPM_BUILD_ROOT
-%{__mv} $RPM_BUILD_ROOT%{_bindir}/perf{,_slang}
-
-%if %{with gtk}
-# perf gtk
%{__make} -j1 install install-man \
-C tools/perf \
- O=$PWD/perf-gtk \
+%ifarch %{x8664}
+ IS_X86_64=1 \
+%endif
+ %{!?with_gtk:NO_GTK2=1} \
+ %{!?with_libunwind:NO_LIBUNWIND=1} \
CC="%{__cc}" \
CFLAGS_OPTIMIZE="%{rpmcflags}" \
WERROR=0 \
prefix=%{_prefix} \
perfexecdir=%{_datadir}/perf-core \
template_dir=%{_datadir}/perf-core/templates \
+ lib=%{_lib} \
DESTDIR=$RPM_BUILD_ROOT
-%{__mv} $RPM_BUILD_ROOT%{_bindir}/perf{,_gtk}
-%endif
%py_comp $RPM_BUILD_ROOT%{_datadir}/perf-core/scripts/python
%py_ocomp $RPM_BUILD_ROOT%{_datadir}/perf-core/scripts/python
-rm -r $RPM_BUILD_ROOT%{_datadir}/perf-core/tests
-
-install %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/perf
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/perf-core/tests
%endif
# gen_init_cpio
%attr(755,root,root) %{_bindir}/slabinfo
%attr(755,root,root) %{_sbindir}/dslm
%attr(755,root,root) %{_sbindir}/page-types
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/centrino-decode
%attr(755,root,root) %{_bindir}/powernow-k8-decode
%endif
-%ifarch %{ix86} %{x8664}
+%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/turbostat
%attr(755,root,root) %{_bindir}/x86_energy_perf_policy
%{_mandir}/man8/turbostat.8*
%{_includedir}/cpufreq.h
%if %{with perf}
-%files perf-core
+%files perf
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/perf
+%attr(755,root,root) %{_bindir}/trace
%{_mandir}/man1/perf*.1*
%dir %{_datadir}/perf-core
%attr(755,root,root) %{_datadir}/perf-core/perf-archive
+%attr(755,root,root) %{_datadir}/perf-core/perf-with-kcore
%dir %{_datadir}/perf-core/scripts
%attr(755,root,root) %{_datadir}/perf-core/scripts/python/bin/*
%{_datadir}/perf-core/scripts/python/*.py*
-%if %{with gtk}
-%files perf-gtk
+%dir %{_libdir}/traceevent
+%dir %{_libdir}/traceevent/plugins
+%attr(755,root,root) %{_libdir}/traceevent/plugins/plugin_*.so
+
+%ifarch %{x8664}
+%files perf-vdso32
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/perf_gtk
+%attr(755,root,root) %{_bindir}/perf-read-vdso32
+
+%files perf-vdsox32
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/perf-read-vdsox32
%endif
-%files perf-slang
+%if %{with gtk}
+%files perf-gtk
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/perf_slang
+%attr(755,root,root) %{_libdir}/libperf-gtk.so
+%endif
%files -n bash-completion-perf
%defattr(644,root,root,755)