Package bpftrace: Specfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | # SPDX-License-Identifier: GPL-2.0-only %define _unpackaged_files_terminate_build 1 %define _stripped_files_terminate_build 1 %set_verify_elf_method strict,lint=relaxed %ifarch loongarch64 # XXX: only lld supports thin LTO. However # - as of LLVM 16 lld does not support LoongArch targets at all # - as of LLVM 17 lld does not support LoongArch relocations properly # and is unable to link with libraries produced by GNU ld (i.e. glibc) %def_without lld %define optflags_lto %nil %else %def_with lld %define optflags_lto -flto=thin %endif # Based on https://github.com/iovisor/bpftrace/blob/master/INSTALL.md Name: bpftrace Version: 0.20.3 Release: alt2 Summary: High-level tracing language for Linux eBPF Group: Development/Debuggers License: Apache-2.0 URL: https://github.com/iovisor/bpftrace # Docs: https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md # Docs: https://github.com/iovisor/bpftrace/blob/master/docs/tutorial_one_liners.md # Docs: http://www.brendangregg.com/BPF/bpftrace-cheat-sheet.html # Docs: http://www.brendangregg.com/ebpf.html#bpftrace # PR: https://lwn.net/Articles/793749/ # PR: http://www.brendangregg.com/blog/2018-10-08/dtrace-for-linux-2018.html Source: %name-%version.tar # Submodules are maintained with gear-submodule-update. Source1: bcc-0.tar Source2: blazesym-0.tar Source3: bpftool-0.tar Source4: libbpf-0.tar Source5: libbpf-1.tar Source6: libbpf-2.tar ExclusiveArch: x86_64 aarch64 loongarch64 %define llvm_ver 17 %define llvm_pkgver %llvm_ver.0 BuildRequires(pre): rpm-macros-cmake BuildRequires: binutils-devel BuildRequires: cereal-devel BuildRequires: clang%llvm_pkgver-devel BuildRequires: cmake BuildRequires: flex BuildRequires: libbcc-devel BuildRequires: libbpf-devel BuildRequires: libdw-devel BuildRequires: libelf-devel BuildRequires: libpcap-devel BuildRequires: libstdc++-devel BuildRequires: libstdc++-devel-static %if_with lld BuildRequires: lld%llvm_pkgver %endif BuildRequires: llvm%llvm_pkgver-devel BuildRequires: /proc BuildRequires: python3-module-setuptools # Assuming 'kernel' dependency will bring un-def kernel %{?!_without_check:%{?!_disable_check: BuildRequires: kernel-headers-modules-un-def BuildRequires: rpm-build-vm }} %description bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for interacting with the Linux BPF system, as well as existing Linux tracing capabilities: kernel dynamic tracing (kprobes), user-level dynamic tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was created by Alastair Robertson. %prep %setup tar xf %SOURCE1 -C . tar xf %SOURCE2 -C bcc/libbpf-tools tar xf %SOURCE3 -C bcc/libbpf-tools tar xf %SOURCE4 -C bcc/libbpf-tools/bpftool tar xf %SOURCE5 -C bcc/src/cc tar xf %SOURCE6 -C . sed -i 's/\bpython\b/python3/' tests/runtime/call sed -i 's/@.*@/True/' tests/runtime/engine/cmake_vars.py %build %remove_optflags -frecord-gcc-switches export CC=clang-%llvm_ver export CXX=clang++-%llvm_ver %if_with lld export LDFLAGS="-fuse-ld=lld $LDFLAGS" %endif export Clang_DIR=/usr/share/cmake/Modules/clang # -DBUILD_TESTING:BOOL=ON will require googletest and try to clone it from github %cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_TESTING:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DLLVM_DIR=$(llvm-config-%llvm_ver --cmakedir) \ -DLLVM_REQUESTED_VERSION=%llvm_ver \ -DOFFLINE_BUILDS:BOOL=ON \ -DALLOW_UNSAFE_PROBE:BOOL=ON \ -DUSE_SYSTEM_BPF_BCC:BOOL=ON \ %nil %cmake_build %install %cmake_install find %buildroot%_datadir/%name/tools -name '*.bt' | xargs chmod a+x # Fix man pages. pushd %buildroot%_man8dir rename '' bpftrace- *.gz popd # Need to keep BEGIN_trigger and END_trigger # https://github.com/iovisor/bpftrace/issues/954 %brp_strip_debug %_bindir/bpftrace %check %_cmake__builddir/src/bpftrace --version # not requires root vm-run %_cmake__builddir/src/bpftrace --info # should be fast enough even w/o kvm vm-run --kvm=cond %_cmake__builddir/src/bpftrace -l 'kprobe:*_sleep_*' if kvm-ok; then ## Great run-time tests # Some fail due to no BUILD_TESTING .gear/delete-blocks syscalls: tests/runtime/* .gear/delete-blocks testprogs tests/runtime/* .gear/delete-blocks uprobe tests/runtime/* .gear/delete-blocks usdt tests/runtime/usdt .gear/delete-blocks vfs_read tests/runtime/* # TIMEOUT .gear/delete-blocks hardware tests/runtime/probe # TIMEOUT .gear/delete-blocks k.*_order tests/runtime/probe # TIMEOUT .gear/delete-blocks watchpoint: tests/runtime/watchpoint .gear/delete-blocks string_args tests/runtime/other .gear/delete-blocks interval_order tests/runtime/probe .gear/delete-blocks tracepoint_order tests/runtime/probe .gear/delete-blocks uint64_t tests/runtime/signed_ints .gear/delete-blocks tracepoint:random:random_read tests/runtime/variable .gear/delete-blocks tracepoint:sched:sched_wakeup tests/runtime/regression .gear/delete-blocks histogram-finegrain tests/runtime/json-output %ifarch aarch64 # TIMEOUT on aarch64 .gear/delete-blocks python tests/runtime/json-output %endif export BPFTRACE_RUNTIME_TEST_EXECUTABLE=$PWD/%_cmake__builddir/src/bpftrace sed -i 's/xattr.h/user.h/' tests/runtime/basic vm-run --kvm=cond --sbin tests/runtime-tests.sh fi %files %define _customdocdir %_docdir/%name %doc LICENSE README.md CHANGELOG.md CONTRIBUTING-TOOLS.md %doc docs/reference_guide.md docs/tutorial_one_liners.md %_bindir/* %_datadir/%name %_man8dir/* %changelog * Mon Apr 22 2024 Vitaly Chikunov <vt@altlinux.org> 0.20.3-alt2 - Fix FTBFS Do not build with Clang/LLVM 18. * Thu Apr 04 2024 Vitaly Chikunov <vt@altlinux.org> 0.20.3-alt1 - Update to v0.20.3 (2024-03-25). * Sun Mar 17 2024 Vitaly Chikunov <vt@altlinux.org> 0.20.2-alt1 - Update to v0.20.2 (2024-03-07). - Fix potential security issue with kheader unpacking. * Sat Mar 09 2024 Alexey Sheplyakov <asheplyakov@altlinux.org> 0.20.1-alt2 - NMU: fixed FTBFS on LoongArch * Sun Mar 03 2024 Vitaly Chikunov <vt@altlinux.org> 0.20.1-alt1 - Update to v0.20.1 (2024-01-29). * Tue Feb 06 2024 Grigory Ustinov <grenka@altlinux.org> 0.19.1-alt2 - Fixed FTBFS. * Sun Nov 12 2023 Vitaly Chikunov <vt@altlinux.org> 0.19.1-alt1 - Update to v0.19.1 (2023-10-04). * Wed Aug 30 2023 Vitaly Chikunov <vt@altlinux.org> 0.16.0-alt3 - Fix FTBFS errors and crash for LLVM 15. * Mon Dec 19 2022 Vitaly Chikunov <vt@altlinux.org> 0.16.0-alt2 - Fix SIGSEGV when vmlinux is not available and loading BTF data failed. * Sun Oct 09 2022 Vitaly Chikunov <vt@altlinux.org> 0.16.0-alt1 - Update to v0.16.0 (2022-08-30). * Sat May 28 2022 Vitaly Chikunov <vt@altlinux.org> 0.15.0-alt1 - Updated to v0.15.0 (2022-05-24). * Fri Jan 21 2022 Vitaly Chikunov <vt@altlinux.org> 0.13.1-alt1 - Updated to v0.13.1 (2021-12-21). - Do not strip BEGIN/END triggers from bpftrace (closes: #41750). * Thu Sep 09 2021 Aleksei Nikiforov <darktemplar@altlinux.org> 0.12.1-alt3 - Rebuilt with LTO. * Wed May 12 2021 Arseny Maslennikov <arseny@altlinux.org> 0.12.1-alt2 - NMU: spec: adapt to new cmake macros. * Fri Apr 30 2021 Vitaly Chikunov <vt@altlinux.org> 0.12.1-alt1 - Update to v0.12.1 (2021-04-16). - spec: Build with default Clang/LLVM (>= 11). * Mon Nov 30 2020 Vitaly Chikunov <vt@altlinux.org> 0.11.4-alt1 - Update to v0.11.4 (2020-11-13). * Tue Aug 25 2020 Vitaly Chikunov <vt@altlinux.org> 0.11.0-alt3 - Rename man pages with bpftrace- prefix. - Rebuild with debuginfo. * Mon Aug 10 2020 Vitaly Chikunov <vt@altlinux.org> 0.11.0-alt2 - Rebuild with clang10. * Fri Jul 17 2020 Vitaly Chikunov <vt@altlinux.org> 0.11.0-alt1 - Update to v0.11.0. * Sat Jul 04 2020 Vitaly Chikunov <vt@altlinux.org> 0.10.0-alt2 - Fix build with libbcc-devel-0.15.0. * Wed Apr 15 2020 Vitaly Chikunov <vt@altlinux.org> 0.10.0-alt1 - Update to v0.10.0 released at 2020-04-12. New features: kfuncs, C++ Symbol demangling, if-else control flow. * Sat Mar 28 2020 Vitaly Chikunov <vt@altlinux.org> 0.9.4-alt2 - spec: Rework BuildRequires. * Sat Mar 14 2020 Vitaly Chikunov <vt@altlinux.org> 0.9.4-alt1 - Update to v0.9.4. - Update license tag from ASL 2.0 to Apache-2.0. - Add %%check with some tests. * Fri May 17 2019 Vitaly Chikunov <vt@altlinux.org> 0.9.0.0.169.ga4bf870-alt1 - First import v0.9-169-ga4bf870. |