xref: /aosp_15_r20/external/bcc/SPECS/bcc.spec (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1%bcond_with local_clang_static
2#lua jit not available for some architectures
3%ifarch ppc64 aarch64 ppc64le
4%{!?with_lua: %global with_lua 0}
5%else
6%{!?with_lua: %global with_lua 1}
7%endif
8
9# use --with shared to only link against libLLVM.so
10%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
11%bcond_without llvm_shared
12%else
13%bcond_with llvm_shared
14%endif
15
16# Build python3 support for distributions that have it
17%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
18%bcond_without python3
19%else
20%bcond_with python3
21%endif
22
23# Build with debuginfod support for Fedora >= 32
24%if 0%{?fedora} >= 32
25%bcond_without libdebuginfod
26%else
27%bcond_with libdebuginfod
28%endif
29
30%if %{with python3}
31%global __python %{__python3}
32%global python_bcc python3-bcc
33%global python_cmds python2;python3
34%else
35%global __python %{__python2}
36%global python_bcc python2-bcc
37%global python_cmds python2
38%endif
39
40%define debug_package %{nil}
41%define _unpackaged_files_terminate_build 0
42
43
44Name:           bcc
45Version:        @REVISION@
46Release:        @GIT_REV_COUNT@
47Summary:        BPF Compiler Collection (BCC)
48
49Group:          Development/Languages
50License:        ASL 2.0
51URL:            https://github.com/iovisor/bcc
52Source0:        bcc.tar.gz
53
54ExclusiveArch: x86_64 ppc64 aarch64 ppc64le
55BuildRequires: bison cmake >= 2.8.7 flex make
56BuildRequires: gcc gcc-c++ elfutils-libelf-devel-static
57%if %{with libdebuginfod}
58BuildRequires: elfutils-debuginfod-client-devel
59%endif
60%if %{with python3}
61BuildRequires: python3-devel
62%else
63BuildRequires: python2-devel
64%endif
65%if %{with_lua}
66BuildRequires: luajit luajit-devel
67%endif
68%if %{without local_clang_static}
69BuildRequires: llvm-devel
70BuildRequires: clang-devel
71%if %{without llvm_shared}
72BuildRequires: llvm-static
73%endif
74%endif
75BuildRequires: pkgconfig ncurses-devel
76
77%description
78Python bindings for BPF Compiler Collection (BCC). Control a BPF program from
79userspace.
80
81%if %{with_lua}
82%global lua_include `pkg-config --variable=includedir luajit`
83%global lua_libs `pkg-config --variable=libdir luajit`/lib`pkg-config --variable=libname luajit`.so
84%global lua_config -DLUAJIT_INCLUDE_DIR=%{lua_include} -DLUAJIT_LIBRARIES=%{lua_libs}
85%endif
86
87%prep
88%setup -q -n bcc
89
90%build
91
92mkdir build
93pushd build
94cmake .. -DREVISION_LAST=%{version} -DREVISION=%{version} \
95      -DCMAKE_INSTALL_PREFIX=/usr \
96      %{?lua_config} \
97      -DPYTHON_CMD="%{python_cmds}" \
98      %{?with_llvm_shared:-DENABLE_LLVM_SHARED=1}
99make %{?_smp_mflags}
100popd
101
102%install
103pushd build
104make install/strip DESTDIR=%{buildroot}
105# mangle shebangs
106find %{buildroot}/usr/share/bcc/{tools,examples} -type f -exec \
107    sed -i -e '1 s|^#!/usr/bin/python$|#!'%{__python}'|' \
108           -e '1 s|^#!/usr/bin/env python$|#!'%{__python}'|' {} \;
109
110%package -n libbcc
111Summary: Shared Library for BPF Compiler Collection (BCC)
112Requires: elfutils-libelf
113%if %{with libdebuginfod}
114Requires: elfutils-debuginfod-client
115%endif
116%description -n libbcc
117Shared Library for BPF Compiler Collection (BCC)
118
119%package -n python2-bcc
120Summary: Python2 bindings for BPF Compiler Collection (BCC)
121Requires: libbcc = %{version}-%{release}
122%{?python_provide:%python_provide python2-bcc}
123%description -n python2-bcc
124Python bindings for BPF Compiler Collection (BCC)
125
126%if %{with python3}
127%package -n python3-bcc
128Summary: Python3 bindings for BPF Compiler Collection (BCC)
129Requires: libbcc = %{version}-%{release}
130%{?python_provide:%python_provide python3-bcc}
131%description -n python3-bcc
132Python bindings for BPF Compiler Collection (BCC)
133%endif
134
135%if %{with_lua}
136%package -n bcc-lua
137Summary: Standalone tool to run BCC tracers written in Lua
138Requires: libbcc = %{version}-%{release}
139%description -n bcc-lua
140Standalone tool to run BCC tracers written in Lua
141%endif
142
143%package -n libbcc-examples
144Summary: Examples for BPF Compiler Collection (BCC)
145Requires: %{python_bcc} = %{version}-%{release}
146%if %{with_lua}
147Requires: bcc-lua = %{version}-%{release}
148%endif
149%description -n libbcc-examples
150Examples for BPF Compiler Collection (BCC)
151
152%package -n bcc-tools
153Summary: Command line tools for BPF Compiler Collection (BCC)
154Requires: %{python_bcc} = %{version}-%{release}
155%description -n bcc-tools
156Command line tools for BPF Compiler Collection (BCC)
157
158%files -n libbcc
159/usr/lib64/*
160/usr/include/bcc/*
161
162%files -n python2-bcc
163%{python2_sitelib}/bcc*
164
165%if %{with python3}
166%files -n python3-bcc
167%{python3_sitelib}/bcc*
168%endif
169
170%if %{with_lua}
171%files -n bcc-lua
172/usr/bin/bcc-lua
173%endif
174
175%files -n libbcc-examples
176/usr/share/bcc/examples/*
177%exclude /usr/share/bcc/examples/*.pyc
178%exclude /usr/share/bcc/examples/*.pyo
179%exclude /usr/share/bcc/examples/*/*.pyc
180%exclude /usr/share/bcc/examples/*/*.pyo
181%exclude /usr/share/bcc/examples/*/*/*.pyc
182%exclude /usr/share/bcc/examples/*/*/*.pyo
183
184%files -n bcc-tools
185/usr/share/bcc/introspection/*
186/usr/share/bcc/tools/*
187/usr/share/bcc/man/*
188
189%post -n libbcc -p /sbin/ldconfig
190
191%postun -n libbcc -p /sbin/ldconfig
192
193%changelog
194* Wed Jul 18 2018 Brenden Blanco <bblanco@gmail.com> - 0.6.0-1
195- Make python3 the default when possible
196- Add with llvm_shared conditional
197- Add python2/python3 package targets
198
199* Mon Nov 21 2016 William Cohen <wcohen@redhat.com> - 0.2.0-1
200- Revise bcc.spec to address rpmlint issues and build properly in Fedora koji.
201
202* Mon Apr 04 2016 Vicent Marti <vicent@github.com> - 0.1.4-1
203- Add bcc-lua package
204
205* Sun Nov 29 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.3-1
206- Add bcc-tools package
207
208* Mon Oct 12 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.2-1
209- Add better version numbering into libbcc.so
210
211* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
212- Initial RPM Release
213