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