forked from namhyung/uftrace
/
uftrace.spec
105 lines (93 loc) · 2.81 KB
/
uftrace.spec
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
%bcond_without check
%bcond_without python
Name: uftrace
Version: 0.13.2
Release: 9%{?dist}
Summary: Function graph tracer for C/C++/Rust with many features
# https://github.com/namhyung/uftrace/issues/1343
%global _lto_cflags %nil
# These flags cause bugs (detected by the test suite):
%undefine _fortify_level
%undefine _hardened_build
%undefine _include_frame_pointers
License: GPL-2.0
Url: https://github.com/bernhardkaindl/uftrace
Source: https://github.com/bernhardkaindl/%{name}/archive/v${version}/%{name}-%{version}.tar.gz
ExclusiveArch: x86_64 %ix86 %arm aarch64
BuildRequires: elfutils-devel
%if "%{?toolchain}" == "clang"
BuildRequires: clang compiler-rt
%else
BuildRequires: gcc-c++
%endif
BuildRequires: libstdc++-devel
BuildRequires: make
BuildRequires: ncurses-devel
%if 0%{?centos} > 8 || 0%{?rhel} > 8 || 0%{?fedora} > 35
BuildRequires: capstone-devel
%endif
%if 0%{?fedora} > 35
BuildRequires: luajit-devel
BuildRequires: libunwind-devel
BuildRequires: pandoc
%global have_pandoc 1
%endif
%if %{with python}
BuildRequires: python3-devel
%else
BuildRequires: python3
%endif
%if %{with check}
# segfaults without /proc
BuildRequires: /proc
%endif
%description
The uftrace tool is to trace and analyze execution of a program written in
C/C++/Rust. It was heavily inspired by the ftrace framework of the Linux kernel
(especially function graph tracer) and supports userspace programs. It supports
various kind of commands and filters to help analysis of the program execution
and performance.
%prep
%setup -q
# build only tests
sed -i 's|test_unit|unittest|' Makefile
sed -i 's|python$|python3|' tests/runtest.py
%build
%if %{without python}
conf_flags="--without-libpython"
%endif
%configure $conf_flags
%make_build
%if %{with check}
# build only here
%make_build unittest
%endif
%install
%make_install V=1
%if %{with check}
unset CFLAGS CXXFLAGS LDFLAGS
make test V=1 2>&1 | tee test-report.txt
%endif
cd %{buildroot}
mkdir -p .%{_datadir}/bash_completion
mv .%{_sysconfdir}/bash_completion.d .%{_datadir}/bash_completion/completions
%check
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
%{buildroot}%{_bindir}/uftrace --version
%{buildroot}%{_bindir}/uftrace record -A . -R . -P main ./uftrace
%{buildroot}%{_bindir}/uftrace replay
%{buildroot}%{_bindir}/uftrace dump
%{buildroot}%{_bindir}/uftrace info
%files
%{_bindir}/%{name}
%{_libdir}/libmcount*.so
# man pages needs pandoc, which plain centos and rhel don't have:
%if 0%{?have_pandoc}
%{_mandir}/man1/*.1*
%endif
%{_datadir}/bash_completion/completions/%{name}
%doc README.md test-report.txt
%license COPYING
%changelog
* Wed Mar 22 2023 Bernhard Kaindl <contact@bernhard.kaindl.dev> 0.13.2-9
- Initial rpm for Fedora/CentOS/EPEL