c5127da
Name:		bcc
308ca18
Version:	0.3.0
308ca18
Release:	1%{?dist}
c5127da
Summary:	BPF Compiler Collection (BCC)
c5127da
License:	ASL 2.0
c5127da
URL:		https://github.com/iovisor/bcc
c5127da
Source0:	https://github.com/iovisor/%{name}/archive/v%{version}.tar.gz
c5127da
c5127da
# Arches will be included as upstream support is added and dependencies are
c5127da
# satisfied in the respective arches
1f36ce9
ExclusiveArch:	x86_64
c5127da
c5127da
BuildRequires:	bison, cmake >= 2.8.7, flex, libxml2-devel
c5127da
BuildRequires:	python3-devel
c5127da
BuildRequires:	elfutils-libelf-devel-static
c5127da
BuildRequires:	llvm-devel llvm-static clang-devel
c5127da
BuildRequires:	ncurses-devel
c5127da
BuildRequires:	pkgconfig(luajit)
c5127da
c5127da
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
c5127da
Summary:	Shared library for BPF Compiler Collection (BCC)
c5127da
Requires:	elfutils-libelf
c5127da
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
c5127da
Summary:	Examples for BPF Compiler Collection (BCC)
c5127da
Requires:	python3-%{name} = %{version}-%{release}
c5127da
Requires:	%{name}-lua = %{version}-%{release}
c5127da
BuildArch:	noarch
c5127da
c5127da
%description doc
c5127da
Examples for BPF Compiler Collection (BCC)
c5127da
c5127da
c5127da
%package -n python3-%{name}
c5127da
Summary:	Python3 bindings for BPF Compiler Collection (BCC)
c5127da
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
c5127da
%package lua
c5127da
Summary:	Standalone tool to run BCC tracers written in Lua
c5127da
Requires:	%{name}%{?_isa} = %{version}-%{release}
c5127da
c5127da
%description lua
c5127da
Standalone tool to run BCC tracers written in Lua
c5127da
308ca18
c5127da
%package tools
c5127da
Summary:	Command line tools for BPF Compiler Collection (BCC)
c5127da
Requires:	python3-%{name} = %{version}-%{release}
308ca18
Requires:	python3-netaddr
c5127da
BuildArch:	noarch
c5127da
c5127da
%description tools
c5127da
Command line tools for BPF Compiler Collection (BCC)
c5127da
308ca18
c5127da
%prep
c5127da
%autosetup -p1
c5127da
c5127da
c5127da
%build
c5127da
%cmake . -DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 \
c5127da
	-DLUAJIT_INCLUDE_DIR=`pkg-config --variable=includedir luajit` \
c5127da
	-DLUAJIT_LIBRARIES=`pkg-config --variable=libdir luajit`/lib`pkg-config --variable=libname luajit`.so
c5127da
make %{?_smp_mflags}
c5127da
c5127da
c5127da
%install
c5127da
%make_install
c5127da
c5127da
# Fix python shebangs
c5127da
for i in `find %{buildroot}/usr/share/%{name}/tools/ -type f`; do
c5127da
	sed -i 's/\/usr\/bin\/env python\>/\/usr\/bin\/python3/' $i
c5127da
	sed -i 's/\/usr\/bin\/python\>/&3/' $i
c5127da
done
c5127da
308ca18
# Examples in /usr/share shouldn't contain binaries according to FHS
308ca18
rm -rf %{buildroot}/usr/share/%{name}/examples/cpp
c5127da
for i in `find %{buildroot}/usr/share/%{name}/examples/ -type f`; do
c5127da
	sed -i 's/\/usr\/bin\/env python\>/\/usr\/bin\/python3/' $i
c5127da
	sed -i 's/\/usr\/bin\/python\>/&3/' $i
c5127da
	sed -i 's/\/usr\/bin\/env bcc-lua\>/\/usr\/bin\/bcc-lua/' $i
308ca18
	chmod -x $i
c5127da
done
c5127da
c5127da
# Compress man pages
c5127da
find %{buildroot}/usr/share/%{name}/man/man8/ -name "*.8" -exec gzip {} \;
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.*
c5127da
c5127da
%files devel
c5127da
%{_libdir}/lib%{name}.so
c5127da
%{_libdir}/pkgconfig/lib%{name}.pc
c5127da
%dir %{_includedir}/%{name}
c5127da
%{_includedir}/%{name}/*
c5127da
c5127da
%files -n python3-%{name}
c5127da
%{python3_sitelib}/%{name}*
c5127da
c5127da
%files doc
c5127da
%dir %{_datadir}/%{name}
c5127da
%doc %{_datadir}/%{name}/examples/
c5127da
%exclude %{_datadir}/%{name}/examples/*.pyc
c5127da
%exclude %{_datadir}/%{name}/examples/*.pyo
c5127da
%exclude %{_datadir}/%{name}/examples/*/*.pyc
c5127da
%exclude %{_datadir}/%{name}/examples/*/*.pyo
c5127da
%exclude %{_datadir}/%{name}/examples/*/*/*.pyc
c5127da
%exclude %{_datadir}/%{name}/examples/*/*/*.pyo
c5127da
c5127da
%files tools
c5127da
%dir %{_datadir}/%{name}
c5127da
%dir %{_datadir}/%{name}/tools
c5127da
%{_datadir}/%{name}/tools/*
c5127da
%exclude %{_datadir}/%{name}/tools/old/
c5127da
%dir %{_datadir}/%{name}/man
c5127da
%{_datadir}/%{name}/man/*
c5127da
c5127da
%files lua
c5127da
%{_bindir}/bcc-lua
c5127da
c5127da
c5127da
%changelog
308ca18
* Thu Mar 09 2017 Rafael Fonseca <rdossant@redhat.com> - 0.3.0-1
308ca18
- Bump version to incorporate upstream fixes.
308ca18
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