47a11ce
# luajit is not available for some architectures
47a11ce
%ifarch ppc64 ppc64le
59c0211
%bcond_with lua
47a11ce
%else
59c0211
%bcond_without lua
47a11ce
%endif
47a11ce
72619e0
Name:           bcc
47a11ce
Version:        0.4.0
268f16b
Release:        3%{?dist}
72619e0
Summary:        BPF Compiler Collection (BCC)
72619e0
License:        ASL 2.0
72619e0
URL:            https://github.com/iovisor/bcc
72619e0
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
47a11ce
# https://github.com/iovisor/bcc/pull/1426
47a11ce
Patch0:         0001-set-SOVERSION-for-bpf-shared.patch
c5127da
c5127da
# Arches will be included as upstream support is added and dependencies are
c5127da
# satisfied in the respective arches
d4390b5
ExclusiveArch:  x86_64 %{power64}
c5127da
72619e0
BuildRequires:  bison, cmake >= 2.8.7, flex, libxml2-devel
72619e0
BuildRequires:  python3-devel
47a11ce
BuildRequires:  elfutils-libelf-devel
72619e0
BuildRequires:  llvm-devel llvm-static clang-devel
72619e0
BuildRequires:  ncurses-devel
59c0211
%if %{with lua}
47a11ce
BuildRequires: pkgconfig(luajit)
47a11ce
%endif
c5127da
72619e0
Requires:       %{name}-tools = %{version}-%{release}
c5127da
c5127da
%description
c5127da
BCC is a toolkit for creating efficient kernel tracing and manipulation
c5127da
programs, and includes several useful tools and examples. It makes use of
c5127da
extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
c5127da
that was first added to Linux 3.15. BCC makes BPF programs easier to write,
c5127da
with kernel instrumentation in C (and includes a C wrapper around LLVM), and
c5127da
front-ends in Python and lua. It is suited for many tasks, including
c5127da
performance analysis and network traffic control.
c5127da
c5127da
c5127da
%package devel
72619e0
Summary:        Shared library for BPF Compiler Collection (BCC)
72619e0
Requires:       %{name}%{?_isa} = %{version}-%{release}
c5127da
c5127da
%description devel
c5127da
The %{name}-devel package contains libraries and header files for developing
c5127da
application that use BPF Compiler Collection (BCC).
c5127da
c5127da
c5127da
%package doc
72619e0
Summary:        Examples for BPF Compiler Collection (BCC)
268f16b
Recommends:     python3-%{name} = %{version}-%{release}
268f16b
Recommends:     %{name}-lua = %{version}-%{release}
72619e0
BuildArch:      noarch
c5127da
c5127da
%description doc
c5127da
Examples for BPF Compiler Collection (BCC)
c5127da
c5127da
c5127da
%package -n python3-%{name}
72619e0
Summary:        Python3 bindings for BPF Compiler Collection (BCC)
72619e0
Requires:       %{name}%{?_isa} = %{version}-%{release}
c5127da
%{?python_provide:%python_provide python3-%{srcname}}
c5127da
c5127da
%description -n python3-%{name}
c5127da
Python3 bindings for BPF Compiler Collection (BCC)
c5127da
c5127da
59c0211
%if %{with lua}
c5127da
%package lua
72619e0
Summary:        Standalone tool to run BCC tracers written in Lua
72619e0
Requires:       %{name}%{?_isa} = %{version}-%{release}
c5127da
c5127da
%description lua
c5127da
Standalone tool to run BCC tracers written in Lua
47a11ce
%endif
c5127da
0734d68
c5127da
%package tools
72619e0
Summary:        Command line tools for BPF Compiler Collection (BCC)
72619e0
Requires:       python3-%{name} = %{version}-%{release}
72619e0
Requires:       python3-netaddr
47a11ce
Requires:       kernel-devel
72619e0
BuildArch:      noarch
c5127da
c5127da
%description tools
c5127da
Command line tools for BPF Compiler Collection (BCC)
c5127da
0734d68
c5127da
%prep
c5127da
%autosetup -p1
c5127da
c5127da
c5127da
%build
47a11ce
%cmake . \
8f89be5
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
47a11ce
        -DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3
Igor Gnatenko 5ce4a19
%make_build
c5127da
c5127da
c5127da
%install
c5127da
%make_install
c5127da
c5127da
# Fix python shebangs
dd5e038
for i in `find %{buildroot}%{_datadir}/%{name}/tools/ -type f`; do
47a11ce
  sed -i '1s=^#!/usr/bin/\(python\|env python\)[0-9.]*=#!%{__python3}=' $i
c5127da
done
c5127da
dd5e038
for i in `find %{buildroot}%{_datadir}/%{name}/examples/ -type f`; do
47a11ce
  sed -i '1s=^#!/usr/bin/\(python\|env python\)[0-9.]*=#!%{__python3}=' $i
47a11ce
  sed -i '1s=^#!/usr/bin/env bcc-lua.*=#!/usr/bin/bcc-lua=' $i
c5127da
done
c5127da
47a11ce
# Move man pages to the right location
dd5e038
mkdir -p %{buildroot}%{_mandir}
ef3ab8c
mv %{buildroot}%{_datadir}/%{name}/man/* %{buildroot}%{_mandir}/
dd5e038
mkdir -p %{buildroot}%{_docdir}/%{name}
dd5e038
mv %{buildroot}%{_datadir}/%{name}/examples %{buildroot}%{_docdir}/%{name}/
c5127da
c5127da
# We cannot run the test suit since it requires root and it makes changes to
c5127da
# the machine (e.g, IP address)
c5127da
#%check
c5127da
c5127da
%post -p /sbin/ldconfig
c5127da
c5127da
%postun -p /sbin/ldconfig
c5127da
c5127da
c5127da
%files
c5127da
%doc README.md
c5127da
%license LICENSE.txt COPYRIGHT.txt
c5127da
%{_libdir}/lib%{name}.so.*
47a11ce
%{_libdir}/libbpf.so.*
c5127da
c5127da
%files devel
c5127da
%{_libdir}/lib%{name}.so
47a11ce
%{_libdir}/libbpf.so
c5127da
%{_libdir}/pkgconfig/lib%{name}.pc
Igor Gnatenko 5ce4a19
%{_includedir}/%{name}/
c5127da
c5127da
%files -n python3-%{name}
c5127da
%{python3_sitelib}/%{name}*
c5127da
c5127da
%files doc
47a11ce
%dir %{_docdir}/%{name}
47a11ce
%doc %{_docdir}/%{name}/examples/
c5127da
c5127da
%files tools
c5127da
%dir %{_datadir}/%{name}
c5127da
%dir %{_datadir}/%{name}/tools
c5127da
%{_datadir}/%{name}/tools/*
c5127da
%exclude %{_datadir}/%{name}/tools/old/
47a11ce
%{_mandir}/man8/*
c5127da
59c0211
%if %{with lua}
c5127da
%files lua
c5127da
%{_bindir}/bcc-lua
47a11ce
%endif
c5127da
c5127da
c5127da
%changelog
268f16b
* Thu Nov 02 2017 Rafael Santos <rdossant@redhat.com> - 0.4.0-3
268f16b
- Use weak deps to not require lua subpkg on ppc64(le)
268f16b
0fdf98e
* Wed Nov 01 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4.0-2
0fdf98e
- Rebuild for LLVM5
0fdf98e
47a11ce
* Wed Nov 01 2017 Rafael Fonseca <rdossant@redhat.com> - 0.4.0-1
47a11ce
- Resolves #1460482 - rebase to new release
47a11ce
- Resolves #1505506 - add support for LLVM 5.0
47a11ce
- Resolves #1460482 - BPF module compilation issue
47a11ce
- Partially address #1479990 - location of man pages
47a11ce
- Enable ppc64(le) support without lua
47a11ce
- Soname versioning for libbpf by ignatenkobrain
47a11ce
94635fa
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-4
94635fa
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
94635fa
e45c818
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-3
e45c818
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
e45c818
Igor Gnatenko 5ce4a19
* Thu Mar 30 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.3.0-2
Igor Gnatenko 5ce4a19
- Rebuild for LLVM4
Igor Gnatenko 5ce4a19
- Trivial fixes in spec
Igor Gnatenko 5ce4a19
0734d68
* Fri Mar 10 2017 Rafael Fonseca <rdossant@redhat.com> - 0.3.0-1
0734d68
- Rebase to new release.
0734d68
cf8b71f
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-3
cf8b71f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
cf8b71f
1f36ce9
* Tue Jan 10 2017 Rafael Fonseca <rdossant@redhat.com> - 0.2.0-2
1f36ce9
- Fix typo
1f36ce9
c5127da
* Tue Nov 29 2016 Rafael Fonseca <rdossant@redhat.com> - 0.2.0-1
c5127da
- Initial import