File perf.spec of Package perf
xxxxxxxxxx
1
#
2
# spec file for package perf
3
#
4
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via http://bugs.opensuse.org/
16
#
17
18
19
Name: perf
20
%define version %(rpm -q --qf '%{VERSION}' kernel-source)
21
Version: %{version}
22
Release: 0
23
Summary: Performance Monitoring Tools for Linux
24
License: GPL-2.0-only
25
Group: Development/Tools/Debuggers
26
Url: https://perf.wiki.kernel.org/
27
BuildRequires: asciidoc
28
BuildRequires: audit-devel
29
BuildRequires: binutils-devel
30
BuildRequires: bison
31
BuildRequires: fdupes
32
BuildRequires: flex
33
BuildRequires: gtk2-devel
34
BuildRequires: kernel-source >= 2.6.31
35
BuildRequires: libdw-devel
36
BuildRequires: libelf-devel
37
BuildRequires: OpenCSD-devel
38
BuildRequires: python3-devel
39
BuildRequires: xz-devel
40
%ifarch aarch64 ia64 x86_64 ppc64 ppc64le ppc %sparc
41
BuildRequires: libnuma-devel
42
%endif
43
%ifarch s390x s390
44
%define _perf_unwind NO_LIBUNWIND=1
45
%else
46
%define _perf_unwind %{nil}
47
BuildRequires: libunwind-devel
48
%endif
49
BuildRequires: newt-devel
50
BuildRequires: openssl-devel
51
BuildRequires: xmlto
52
BuildRequires: zlib-devel
53
# dl_open requirement so not autodetected
54
%ifarch ppc64 ppc64le
55
Requires: libebl
56
%endif
57
%{perl_requires}
58
%{?libperl_requires}
59
# upstream patches
60
Patch1: perf-tests-attr-Add-missing-topdown-metrics-events.patch
61
Patch2: perf-bpf-Avoid-memory-leak-from-perf_env__insert_btf.patch
62
Patch3: perf-tests-Remove-bash-construct-from-record-zstd_comp_decomp.sh.patch
63
Patch4: perf-bench-Fix-two-memory-leaks-detected-with-ASan.patch
64
Patch5: perf-tools-Fix-SMT-detection-fast-read-path.patch
65
Patch6: tools-build-Remove-needless-libpython-version-feature-check-that-breaks-test-all-fast-path.patch
66
Patch7: perf-bpf-Fix-building-perf-with-BUILD_BPF_SKEL-1-by-default-in-more-distros.patch
67
Patch8: perf-bpf_skel-Do-not-use-typedef-to-avoid-error-on-old-clang.patch
68
Patch9: perf-intel-pt-Fix-some-PGE-packet-generation-enable-control-flow-packets-usage.patch
69
Patch10: perf-intel-pt-Fix-sync-state-when-a-PSB-synchronization-packet-is-found.patch
70
Patch11: perf-intel-pt-Fix-intel_pt_fup_event-assumptions-about-setting-state-type.patch
71
Patch12: perf-intel-pt-Fix-state-setting-when-receiving-overflow-OVF-packet.patch
72
Patch13: perf-intel-pt-Fix-next-err-value-walking-trace.patch
73
Patch14: perf-intel-pt-Fix-missing-instruction-events-with-q-option.patch
74
Patch15: perf-intel-pt-Fix-error-timestamp-setting-on-the-decoder-error-path.patch
75
Patch16: perf-inject-Fix-segfault-due-to-close-without-open.patch
76
Patch17: perf-intel-pt-Fix-parsing-of-VM-time-correlation-arguments.patch
77
Patch18: perf-script-Fix-CPU-filtering-of-a-script-s-switch-events.patch
78
Patch19: perf-scripts-python-intel-pt-events.py-Fix-printing-of-switch-events.patch
79
Patch20: perf-script-Fix-hex-dump-character-output.patch
80
Patch21: perf-probe-Fix-ppc64-perf-probe-add-events-failed-case.patch
81
Patch22: perf-evsel-Override-attr-sample_period-for-non-libpfm4-events.patch
82
# non upstream patches
83
84
Requires: kernel >= 2.6.31
85
BuildRoot: %{_tmppath}/%{name}-%{version}-build
86
87
%description
88
This package provides a userspace tool 'perf', which monitors performance for
89
either unmodified binaries or the entire system. It requires a Linux kernel
90
which includes the Performance Counters for Linux (PCL) subsystem (>= 2.6.31).
91
This subsystem utilizes the Performance Monitoring Unit (PMU) / hardware
92
counters of the underlying cpu architecture (if supported).
93
94
%package devel
95
Summary: Development headers for perf
96
Group: Development/Libraries/Other
97
Requires: %{name} = %{version}
98
99
%description devel
100
Development headers for perf.
101
102
%prep
103
# copy necessary files from kernel-source since we need to modify them
104
(cd /usr/src/linux ; tar -cf - COPYING CREDITS README tools include scripts Kbuild Makefile arch/*/{include,lib,Makefile} lib) | tar -xf -
105
chmod +x tools/perf/util/generate-cmdlist.sh
106
107
%autopatch -p1
108
109
# don't error out on deprecated definitions in gtk2.h
110
sed -i 's@ignored "-Wstrict-prototypes"@&\n#pragma GCC diagnostic ignored "-Wdeprecated-declarations"@' tools/build/feature/test-gtk2.c
111
112
%build
113
cd tools/perf
114
export WERROR=0
115
# PASS rpm optflags as EXTRA_FLAGS, passing as CFLAGS overrides and breaks build
116
make %{?_smp_mflags} -f Makefile.perf VF=1 GTK2=1 CORESIGHT=1 PYTHON=python3 EXTRA_CFLAGS="%{optflags}" ASCIIDOC8=1 prefix=/usr libdir=%{_libdir} perfexecdir=lib/%{name}-core %{_perf_unwind} tipdir=share/doc/packages/perf all
117
make %{?_smp_mflags} -f Makefile.perf VF=1 GTK2=1 CORESIGHT=1 PYTHON=python3 EXTRA_CFLAGS="%{optflags}" ASCIIDOC8=1 prefix=/usr libdir=%{_libdir} perfexecdir=lib/%{name}-core %{_perf_unwind} tipdir=share/doc/packages/perf doc
118
119
%install
120
cd tools/perf
121
export WERROR=0
122
make -f Makefile.perf GTK2=1 CORESIGHT=1 PYTHON=python3 EXTRA_CFLAGS="%{optflags}" prefix=/usr libdir=%{_libdir} perfexecdir=lib/%{name}-core DESTDIR=%{buildroot} %{_perf_unwind} tipdir=share/doc/packages/perf install
123
make -f Makefile.perf GTK2=1 CORESIGHT=1 PYTHON=python3 EXTRA_CFLAGS="%{optflags}" prefix=/usr libdir=%{_libdir} perfexecdir=lib/%{name}-core DESTDIR=%{buildroot} install %{_perf_unwind} tipdir=share/doc/packages/perf install-doc
124
mkdir -p %{buildroot}/%{_docdir}/perf/examples/bpf
125
mv %{buildroot}/usr/lib/perf/examples/bpf/* %{buildroot}/%{_docdir}/perf/examples/bpf
126
127
%fdupes %{buildroot}/%{_prefix}/lib/%{name}-core
128
129
%files
130
%defattr(-, root, root)
131
%attr(0644, root, root) %doc COPYING CREDITS README tools/perf/design.txt
132
%attr(0644, root, root) %doc %{_docdir}/perf/tips.txt
133
%{_bindir}/perf
134
%{_bindir}/trace
135
%{_libdir}/libperf-gtk.so
136
%ifnarch armv7l
137
%dir %{_libdir}/traceevent
138
%dir %{_libdir}/traceevent/plugins
139
%{_libdir}/traceevent/plugins/plugin_*.so
140
%endif
141
%attr(0644, -, -) %{_sysconfdir}/bash_completion.d/perf
142
%{_libexecdir}/%{name}-core
143
%{_datarootdir}/%{name}-core
144
%{_mandir}/man1/perf*
145
%dir /usr/lib/perf
146
147
%files devel
148
%dir %{_includedir}/perf/
149
%attr(0644, root, root) %{_includedir}/perf/*.h
150
%dir /usr/lib/perf/include
151
%dir /usr/lib/perf/include/bpf
152
%attr(0644, root, root) /usr/lib/perf/include/bpf/*.h
153
%dir /usr/lib/perf/include/bpf/linux
154
%attr(0644, root, root) /usr/lib/perf/include/bpf/linux/*.h
155
%dir %{_docdir}/perf/examples
156
%dir %{_docdir}/perf/examples/bpf
157
%attr(0644, root, root) %{_docdir}/perf/examples/bpf/*
158
159
%changelog
160