File perf.spec of Package perf.openSUSE_Leap_42.3_Update
#
# spec file for package perf
#
# Copyright (c) 2018 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: perf
%define version %(rpm -q --qf '%{VERSION}' kernel-source)
Version: %{version}
Release: 0
Summary: Performance Monitoring Tools for Linux
License: GPL-2.0-only
Group: Development/Tools/Debuggers
Url: https://perf.wiki.kernel.org/
BuildRequires: asciidoc
BuildRequires: audit-devel
BuildRequires: binutils-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: gtk2-devel
BuildRequires: kernel-source >= 2.6.31
BuildRequires: libdw-devel
BuildRequires: libelf-devel
BuildRequires: xz-devel
%ifarch aarch64 ia64 x86_64 ppc64 ppc64le ppc %sparc
BuildRequires: libnuma-devel
%endif
%ifarch s390x s390
%define _perf_unwind NO_LIBUNWIND=1
%else
%define _perf_unwind %{nil}
BuildRequires: libunwind-devel
%endif
BuildRequires: newt-devel
BuildRequires: openssl-devel
BuildRequires: xmlto
BuildRequires: zlib-devel
# dl_open requirement so not autodetected
%ifarch ppc64 ppc64le
Requires: libebl
%endif
%{perl_requires}
%{?libperl_requires}
Patch1: perf-probe-fix-to-free-temporal-dwarf_frame.patch
Patch2: perf-probe-fix-to-free-temporal-dwarf_frame-correctly.patch
Patch3: perf-probe-search-both-eh_frame-and-debug_frame-sections-for-probe-location.patch
Patch4: perf-symbols-refactor-vmlinux_path__init-to-ease-path-additions.patch
Patch5: perf-symbols-add-the-path-to-vmlinux.debug.patch
Patch6: perf-powerpc-0001-Fix-kprobe-and-kretprobe-handling-with-.patch
Patch7: perf-powerpc-0002-symbols-Fix-kallsyms-perf-test-on-ppc64le.patch
Patch8: perf-powerpc-0003-probe-Add-function-to-post-process-kernel-trace.patch
Patch9: perf-powerpc-0004-probe-ppc64le-Fix-probe-location-when-using-DWA.patch
Patch10: perf-powerpc-0005-ppc64le-Fix-build-failure-when-libelf-is-not-pr.patch
Patch11: perf-powerpc-0006-tools-Add-missing-struct-definition-in-probe_ev.patch
Patch12: perf-variable-0001-probe-Fix-to-show-correct-error-message-for-var.patch
Patch13: perf-variable-0002-probe-Add-helper-function-to-check-if-probe-wit.patch
Patch14: perf-variable-0003-uprobe-Skip-prologue-if-program-compiled-withou.patch
Patch15: perf-scripting-python-add-ppc64le-to-audit-uname-list.patch
Patch16: perf-probe-fix-offline-module-name-missmatch-issue.patch
Patch17: perf-probe-fix-module-probe-issue-if-no-dwarf-support.patch
Patch18: perf-pmu-events-support-additional-power8-pvr-in-mapfile.patch
Patch19: perf-vendor-events-add-power9-pmu-events.patch
Patch20: perf-vendor-events-add-power9-pvrs-to-mapfile.patch
Patch21: perf-vendor-events-powerpc-remove-suffix-in-mapfile.patch
Patch22: perf-vendor-events-powerpc-update-power9-events.patch
Patch23: perf-vendor-events-powerpc-remove-duplicate-events.patch
Patch24: tools-lib-traceevent-add-operation-within-arg_num_eval.patch
Patch25: perf-pmu-only-print-using-cpuid-message-once.patch
Patch26: perf-pmu-extract-function-to-get-json-alias-map.patch
Patch27: perf-vendor-events-use-more-flexible-pattern-matching-for-cpu-identification-for-mapfile-csv.patch
Patch28: perf-vendor-events-update-power9-events-e795dd42.patch
Patch29: perf-vendor-events-update-power9-events-9749adc3.patch
Patch30: perf-uretprobe-ppc64le-fix-probe-location.patch
Requires: kernel >= 2.6.31
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
This package provides a userspace tool 'perf', which monitors performance for
either unmodified binaries or the entire system. It requires a Linux kernel
which includes the Performance Counters for Linux (PCL) subsystem (>= 2.6.31).
This subsystem utilizes the Performance Monitoring Unit (PMU) / hardware
counters of the underlying cpu architecture (if supported).
%prep
# copy necessary files from kernel-source since we need to modify them
(cd /usr/src/linux ; tar -cf - COPYING CREDITS README tools include scripts Kbuild Makefile arch/*/{include,lib,Makefile} lib) | tar -xf -
chmod +x tools/perf/util/generate-cmdlist.sh
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%build
cd tools/perf
export WERROR=0
# PASS rpm optflags as EXTRA_FLAGS, passing as CFLAGS overrides and breaks build
make %{?_smp_mflags} -f Makefile.perf EXTRA_CFLAGS="%{optflags}" ASCIIDOC8=1 prefix=/usr libdir=%{_libdir} perfexecdir=lib/%{name}-core all doc %{_perf_unwind} tipdir=share/doc/packages/perf
%install
cd tools/perf
export WERROR=0
make -f Makefile.perf V=1 EXTRA_CFLAGS="%{optflags}" prefix=/usr libdir=%{_libdir} perfexecdir=lib/%{name}-core DESTDIR=%{buildroot} install install-doc %{_perf_unwind} tipdir=share/doc/packages/perf
%files
%defattr(-, root, root)
%doc COPYING CREDITS README tools/perf/design.txt
%{_bindir}/perf
%{_bindir}/trace
%{_libdir}/libperf-gtk.so
%ifnarch armv7l
%dir %{_libdir}/traceevent
%dir %{_libdir}/traceevent/plugins
%{_libdir}/traceevent/plugins/plugin_*.so
%endif
%attr(0644, -, -) %{_sysconfdir}/bash_completion.d/perf
%{_libexecdir}/%{name}-core
%{_datarootdir}/%{name}-core
%{_mandir}/man1/perf*
%changelog