File bpftrace.spec of Package bpftrace
115
1
#
2
# spec file for package bpftrace
3
#
4
# Copyright (c) 2021 SUSE LLC
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 https://bugs.opensuse.org/
16
#
17
# nodebuginfo
18
19
20
# Disable binary stripping because bpftrace depends on debug symbols in its
21
# implementation of the BEGIN trigger. See bsc#1178928.
22
%undefine _build_create_debug
23
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
24
25
Name: bpftrace
26
Version: 0.11.4
27
Release: 0
28
Summary: High-level tracing language for Linux eBPF
29
License: Apache-2.0
30
Group: Development/Tools/Debuggers
31
URL: https://github.com/iovisor/bpftrace
32
Source: https://github.com/iovisor/bpftrace/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
33
Patch1: bpftrace-bsc1180670-sync-man-page-and-help.patch
34
BuildRequires: binutils
35
BuildRequires: binutils-devel
36
BuildRequires: bison
37
BuildRequires: clang
38
BuildRequires: clang-devel
39
BuildRequires: cmake
40
BuildRequires: flex
41
BuildRequires: libbpf-devel
42
BuildRequires: llvm-devel
43
BuildRequires: pkgconfig
44
BuildRequires: readline-devel
45
BuildRequires: pkgconfig(libbcc) >= 0.11
46
BuildRequires: pkgconfig(libelf)
47
BuildRequires: pkgconfig(zlib)
48
ExcludeArch: %arm %ix86
49
50
%description
51
High-level tracing language for Linux, allowing for instrumentation of
52
in-kernel and userspace state. It makes use of only upstream features such as
53
eBPF tracing (which builds on kprobes, uprobes, and a variety of other kernel
54
technologies). BPFtrace's language is inspired by awk and C, as well as other
55
tracers such as DTrace and SystemTap.
56
57
%package tools
58
Summary: Example bpftrace scripts and other useful snippets
59
Group: Development/Tools/Debuggers
60
Requires: %{name} = %{version}
61
BuildArch: noarch
62
63
%description tools
64
Collection of tools for quick instrumentation and inspection of a running
65
system. These are all BPFtrace scripts within %{_datadir}/bpftrace, and can be
66
easily modified to allow for different types of debugging.
67
68
%prep
69
%setup -q
70
%patch1 -p1
71
72
# Correct the #!-line to avoid rpmlint warnings.
73
find tools -name '*.bt' -type f \
74
-exec sed -i '1s|^#!%{_bindir}/env bpftrace|#!%{_bindir}/bpftrace|' '{}' ';'
75
76
%build
77
# Find libbfd.so and libopcodes.so. This is necessary because binutils gives
78
# these libraries very strange names which CMake cannot find. See boo#1162312.
79
LIBBFD="$(find "%{_libdir}" -type f -name 'libbfd*.so*')"
80
LIBOPCODES="$(find "%{_libdir}" -type f -name 'libopcodes*.so*')"
81
82
# We need to build with clang.
83
%define _lto_cflags %{nil}
84
export CC="clang"
85
export CXX="clang++"
86
%cmake \
87
-DLIBBFD_LIBRARIES="${LIBBFD}" \
88
-DLIBOPCODES_LIBRARIES="${LIBOPCODES}" \
89
-DBUILD_SHARED_LIBS:BOOL=OFF \
90
-DBUILD_STATIC_LIBS:BOOL=ON \
91
-DBUILD_TESTING:BOOL=OFF
92
%cmake_build
93
94
%install
95
%cmake_install
96
# Set executable bit for tools.
97
chmod +x %{buildroot}%{_datadir}/bpftrace/tools/*.bt
98
99
%files
100
%{_bindir}/bpftrace
101
%{_mandir}/man8/bpftrace.8%{?ext_man}
102
%doc README.md docs/
103
%license LICENSE
104
105
%files tools
106
%dir %{_datadir}/bpftrace/
107
%dir %{_datadir}/bpftrace/tools
108
%{_datadir}/bpftrace/tools/*.bt
109
%dir %{_datadir}/bpftrace/tools/doc
110
%{_datadir}/bpftrace/tools/doc/*_example.txt
111
%{_mandir}/man8/*.8%{?ext_man}
112
%exclude %{_mandir}/man8/bpftrace.8%{ext_man}
113
114
%changelog
115