File bcc.spec of Package bcc
#
# spec file for package bcc
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define libversion 0.1.8
Name: bcc
Version: 0.1.8
Release: 0
Summary: BPF Compiler Collection (BCC)
License: Apache-2.0
Group: Development/Languages
Url: https://github.com/iovisor/bcc
Source: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz
Patch1: bcc-kernel-header-search.patch
ExclusiveArch: x86_64
BuildRequires: bison
BuildRequires: cmake >= 2.8.7
BuildRequires: flex
BuildRequires: llvm-clang-devel >= 3.7.0
BuildRequires: llvm-devel >= 3.7.0
BuildRequires: libstdc++-devel
BuildRequires: pkg-config
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%description
BCC is a toolkit for creating efficient kernel tracing and manipulation
programs, and includes several useful tools and examples. It makes use
of eBPF (Extended Berkeley Packet Filters), a new feature that was first
added to Linux 3.15. Much of what BCC uses requires Linux 4.1 and above.
%package -n libbcc0
Summary: Shared Library for BPF Compiler Collection
Group: System/Libraries
%description -n libbcc0
Shared Library for BPF Compiler Collection (BCC)
%package devel
Summary: BPF Compiler Collection (BCC) (devel package)
Group: Development/Languages
Requires: libbcc0 = %{version}
%description devel
Shared library and pkg-config for developing BCC programs
%package -n python-bcc
Summary: Python bindings for BPF Compiler Collection
Group: Development/Languages
Requires: kernel >= 4.1.0
Requires: kernel-devel >= 4.1.0
Requires: libbcc0 = %{version}
%description -n python-bcc
Python bindings for BPF Compiler Collection (BCC)
%package -n python3-bcc
Summary: Python3 bindings for BPF Compiler Collection
Group: Development/Languages
Requires: kernel >= 4.1.0
Requires: kernel-devel >= 4.1.0
Requires: libbcc0 = %{version}
%description -n python3-bcc
Python3 bindings for BPF Compiler Collection (BCC)
%package examples
Summary: Examples for BPF Compiler Collection (BCC)
Group: Development/Languages
Requires: python-bcc = %{version}
Requires: python-future
Recommends: python-pyroute2
Recommends: python-netaddr
Recommends: netperf
%description examples
Python and C examples for BPF Compiler Collection (BCC)
%package tools
Summary: Tracing tools of BPF Compiler Collection (BCC)
Group: Development/Languages
Requires: python-bcc = %{version}
Requires: python-future
%description tools
Python tracing scripts of BPF Compiler Collection (BCC)
%prep
%setup -D -n %{name}-%{version}
%patch1 -p1
%build
export LD_LIBRARY_PATH="%{_builddir}/usr/lib64"
export PATH="%{_builddir}/usr/bin":$PATH
# To work around the c++11 tag support (bsc#935533)
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
mkdir build
pushd build
CFLAGS=$RPM_OPT_FLAGS CXXFLAGS=$RPM_OPT_FLAGS cmake \
-DREVISION_LAST=%{libversion} \
-DREVISION=%{libversion} \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBCC_KERNEL_HAS_SOURCE_DIR=1 \
..
make %{?_smp_mflags} VERBOSE=1
popd
%install
pushd build
make install DESTDIR=%{buildroot}
# For python3-bcc
cmake -DPYTHON_CMD=python3 ..
pushd src/python/
make %{?_smp_mflags} VERBOSE=1
make install DESTDIR=%{buildroot}
popd
popd
%post -n libbcc0 -p /sbin/ldconfig
%postun -n libbcc0 -p /sbin/ldconfig
%files -n bcc-devel
%{_libdir}/libbcc.so
%dir %{_includedir}/bcc/
%{_includedir}/bcc/*
%{_libdir}/pkgconfig/libbcc.pc
%files -n libbcc0
%{_libdir}/libbcc.so.*
%files -n python-bcc
%{python_sitelib}/bcc*
%files -n python3-bcc
%{python3_sitelib}/bcc*
%files examples
%dir %{_datadir}/bcc/
%dir %{_datadir}/bcc/examples/
%{_datadir}/bcc/examples/*
%files tools
%dir %{_datadir}/bcc/
%dir %{_datadir}/bcc/tools/
%{_datadir}/bcc/tools/*
%dir %{_datadir}/bcc/man/
%{_datadir}/bcc/man/*
%changelog