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
92%package -n libbcc
93Summary: Shared Library for BPF Compiler Collection (BCC)
94Requires: elfutils-libelf
95%description -n libbcc
96Shared Library for BPF Compiler Collection (BCC)
97
98%package -n python2-bcc
99Summary: Python2 bindings for BPF Compiler Collection (BCC)
100Requires: libbcc = %{version}-%{release}
101%{?python_provide:%python_provide python2-bcc}
102%description -n python2-bcc
103Python bindings for BPF Compiler Collection (BCC)
104
105%if %{with python3}
106%package -n python3-bcc
107Summary: Python3 bindings for BPF Compiler Collection (BCC)
108Requires: libbcc = %{version}-%{release}
109%{?python_provide:%python_provide python3-bcc}
110%description -n python3-bcc
111Python bindings for BPF Compiler Collection (BCC)
112%endif
113
114%if %{with_lua}
115%package -n bcc-lua
116Summary: Standalone tool to run BCC tracers written in Lua
117Requires: libbcc = %{version}-%{release}
118%description -n bcc-lua
119Standalone tool to run BCC tracers written in Lua
120%endif
121
122%package -n libbcc-examples
123Summary: Examples for BPF Compiler Collection (BCC)
124Requires: %{python_bcc} = %{version}-%{release}
125%if %{with_lua}
126Requires: bcc-lua = %{version}-%{release}
127%endif
128%description -n libbcc-examples
129Examples for BPF Compiler Collection (BCC)
130
131%package -n bcc-tools
132Summary: Command line tools for BPF Compiler Collection (BCC)
133Requires: %{python_bcc} = %{version}-%{release}
134%description -n bcc-tools
135Command line tools for BPF Compiler Collection (BCC)
136
137%files -n libbcc
138/usr/lib64/*
139/usr/include/bcc/*
140
141%files -n python2-bcc
142%{python2_sitelib}/bcc*
143
144%if %{with python3}
145%files -n python3-bcc
146%{python3_sitelib}/bcc*
147%endif
148
149%if %{with_lua}
150%files -n bcc-lua
151/usr/bin/bcc-lua
152%endif
153
154%files -n libbcc-examples
155/usr/share/bcc/examples/*
156%exclude /usr/share/bcc/examples/*.pyc
157%exclude /usr/share/bcc/examples/*.pyo
158%exclude /usr/share/bcc/examples/*/*.pyc
159%exclude /usr/share/bcc/examples/*/*.pyo
160%exclude /usr/share/bcc/examples/*/*/*.pyc
161%exclude /usr/share/bcc/examples/*/*/*.pyo
162
163%files -n bcc-tools
164/usr/share/bcc/introspection/*
165/usr/share/bcc/tools/*
166/usr/share/bcc/man/*
167
168%post -n libbcc -p /sbin/ldconfig
169
170%postun -n libbcc -p /sbin/ldconfig
171
172%changelog
173* Wed Jul 18 2018 Brenden Blanco <bblanco@gmail.com> - 0.6.0-1
174- Make python3 the default when possible
175- Add with llvm_shared conditional
176- Add python2/python3 package targets
177
178* Mon Nov 21 2016 William Cohen <wcohen@redhat.com> - 0.2.0-1
179- Revise bcc.spec to address rpmlint issues and build properly in Fedora koji.
180
181* Mon Apr 04 2016 Vicent Marti <vicent@github.com> - 0.1.4-1
182- Add bcc-lua package
183
184* Sun Nov 29 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.3-1
185- Add bcc-tools package
186
187* Mon Oct 12 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.2-1
188- Add better version numbering into libbcc.so
189
190* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2
191- Initial RPM Release
192