80cbd0
# luajit is not available for some architectures and not at all on RHEL7
80cbd0
%if 0%{?rhel} <= 7
80cbd0
%bcond_with lua
80cbd0
%else
80cbd0
%ifarch ppc64 ppc64le s390x
80cbd0
%bcond_with lua
80cbd0
%else
80cbd0
%bcond_without lua
80cbd0
%endif
80cbd0
%endif
80cbd0
80cbd0
Name:           bcc
88a1ed
Version:        0.10.0
2a0312
Release:        1%{?dist}
80cbd0
Summary:        BPF Compiler Collection (BCC)
80cbd0
License:        ASL 2.0
80cbd0
URL:            https://github.com/iovisor/bcc
88a1ed
# Generate source tarball until upstream bug is fixed
88a1ed
# See https://github.com/iovisor/bcc/issues/2261
88a1ed
# To generate the tarball, use the following commands
88a1ed
# git clone -b "v0.10.0" --single-branch --depth 1 url bcc-0.10.0
88a1ed
# pushd bcc-0.10.0
88a1ed
# git submodule update --init
88a1ed
# popd
88a1ed
# tar zcvf bcc-0.10.0.tar.gz bcc-0.10.0/
88a1ed
#Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
88a1ed
Source0:        %{name}-%{version}.tar.gz
80cbd0
Patch0:         link-against-libLLVM.so-instead-of-static-libs.patch
80cbd0
Patch1:         Fix-tools-for-RHEL-7.patch
88a1ed
Patch2:         %{name}-%{version}-tools-fix-vfscount-output-when-no-duration-is-specif.patch
80cbd0
80cbd0
# Arches will be included as upstream support is added and dependencies are
80cbd0
# satisfied in the respective arches
80cbd0
ExcludeArch: i686 ppc s390
80cbd0
80cbd0
BuildRequires:  bison, cmake >= 2.8.7, flex, libxml2-devel
80cbd0
BuildRequires:  python-devel
80cbd0
BuildRequires:  elfutils-libelf-devel
80cbd0
BuildRequires:  ncurses-devel
80cbd0
%if %{with lua}
80cbd0
BuildRequires: pkgconfig(luajit)
80cbd0
%endif
80cbd0
BuildRequires: llvm-private-devel >= 6.0.1-0.3
80cbd0
80cbd0
Requires:       %{name}-tools = %{version}-%{release}
80cbd0
Requires:       llvm-private >= 6.0.1-0.3
80cbd0
80cbd0
%description
80cbd0
BCC is a toolkit for creating efficient kernel tracing and manipulation
80cbd0
programs, and includes several useful tools and examples. It makes use of
80cbd0
extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
80cbd0
that was first added to Linux 3.15. BCC makes BPF programs easier to write,
80cbd0
with kernel instrumentation in C (and includes a C wrapper around LLVM), and
80cbd0
front-ends in Python and lua. It is suited for many tasks, including
80cbd0
performance analysis and network traffic control.
80cbd0
80cbd0
80cbd0
%package devel
80cbd0
Summary:        Shared library for BPF Compiler Collection (BCC)
80cbd0
Requires:       %{name}%{?_isa} = %{version}-%{release}
80cbd0
80cbd0
%description devel
80cbd0
The %{name}-devel package contains libraries and header files for developing
80cbd0
application that use BPF Compiler Collection (BCC).
80cbd0
80cbd0
80cbd0
%package doc
80cbd0
Summary:        Examples for BPF Compiler Collection (BCC)
80cbd0
BuildArch:      noarch
80cbd0
80cbd0
%description doc
80cbd0
Examples for BPF Compiler Collection (BCC)
80cbd0
80cbd0
80cbd0
%package -n python-%{name}
80cbd0
Summary:        Python bindings for BPF Compiler Collection (BCC)
80cbd0
Requires:       %{name}%{?_isa} = %{version}-%{release}
80cbd0
%{?python_provide:%python_provide python-%{srcname}}
80cbd0
80cbd0
%description -n python-%{name}
80cbd0
Python bindings for BPF Compiler Collection (BCC)
80cbd0
80cbd0
80cbd0
%if %{with lua}
80cbd0
%package lua
80cbd0
Summary:        Standalone tool to run BCC tracers written in Lua
80cbd0
Requires:       %{name}%{?_isa} = %{version}-%{release}
80cbd0
80cbd0
%description lua
80cbd0
Standalone tool to run BCC tracers written in Lua
80cbd0
%endif
80cbd0
80cbd0
80cbd0
%package tools
80cbd0
Summary:        Command line tools for BPF Compiler Collection (BCC)
80cbd0
Requires:       python-%{name} = %{version}-%{release}
80cbd0
Requires:       python-netaddr
80cbd0
Requires:       kernel-devel
80cbd0
80cbd0
%description tools
80cbd0
Command line tools for BPF Compiler Collection (BCC)
80cbd0
80cbd0
%prep
88a1ed
%autosetup -p1
80cbd0
80cbd0
%build
80cbd0
%cmake . \
80cbd0
        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
80cbd0
        -DCMAKE_CXX_FLAGS='-std=c++11 -I/usr/include/llvm-private/'\
80cbd0
        -DREVISION_LAST=%{version} -DREVISION=%{version}\
80cbd0
        -DCMAKE_LIBRARY_PATH=/usr/lib64/clang-private/\
80cbd0
	-DCMAKE_INSTALL_RPATH=/usr/lib64/clang-private/
80cbd0
%make_build
80cbd0
80cbd0
%install
80cbd0
%make_install
80cbd0
80cbd0
# Move man pages to the right location
80cbd0
mkdir -p %{buildroot}%{_mandir}
80cbd0
mv %{buildroot}%{_datadir}/%{name}/man/* %{buildroot}%{_mandir}/
80cbd0
# Avoid conflict with other manpages
80cbd0
# https://bugzilla.redhat.com/show_bug.cgi?id=1517408
80cbd0
for i in `find %{buildroot}%{_mandir} -name "*.gz"`; do
80cbd0
  tname=$(basename $i)
80cbd0
  rename $tname %{name}-$tname $i
80cbd0
done
80cbd0
# Fix the symlink too
80cbd0
for i in `find %{buildroot}%{_mandir} -lname \*.gz` ; do
80cbd0
    target=`readlink $i`;
80cbd0
    ln -sf bcc-$target $i;
80cbd0
done
80cbd0
mkdir -p %{buildroot}%{_docdir}/%{name}
80cbd0
mv %{buildroot}%{_datadir}/%{name}/examples %{buildroot}%{_docdir}/%{name}/
80cbd0
80cbd0
# We cannot run the test suit since it requires root and it makes changes to
80cbd0
# the machine (e.g, IP address)
80cbd0
#%check
80cbd0
80cbd0
%post -p /sbin/ldconfig
80cbd0
%postun -p /sbin/ldconfig
80cbd0
80cbd0
%files
80cbd0
%doc README.md
80cbd0
%license LICENSE.txt
80cbd0
%{_libdir}/lib%{name}.so.*
88a1ed
%{_libdir}/libbcc_bpf.so.*
80cbd0
80cbd0
%files devel
80cbd0
%{_libdir}/lib%{name}.so
88a1ed
%{_libdir}/libbcc_bpf.so
80cbd0
%{_libdir}/pkgconfig/lib%{name}.pc
80cbd0
%{_includedir}/%{name}/
80cbd0
80cbd0
%files -n python-%{name}
80cbd0
%{python_sitelib}/%{name}*
80cbd0
80cbd0
%files doc
80cbd0
%dir %{_docdir}/%{name}
80cbd0
%doc %{_docdir}/%{name}/examples/
80cbd0
80cbd0
%files tools
80cbd0
%dir %{_datadir}/%{name}
80cbd0
%dir %{_datadir}/%{name}/tools
80cbd0
%dir %{_datadir}/%{name}/introspection
80cbd0
%{_datadir}/%{name}/tools/*
80cbd0
%{_datadir}/%{name}/introspection/*
80cbd0
%exclude %{_datadir}/%{name}/tools/old/
80cbd0
# inject relies on BPF_KPROBE_OVERRIDE which is absent on RHEL 7
80cbd0
%exclude %{_datadir}/%{name}/tools/inject
88a1ed
%exclude %{_datadir}/%{name}/tools/doc/inject_example.txt
88a1ed
%exclude %{_mandir}/man8/inject.8
80cbd0
# ZFS isn't available on RHEL
80cbd0
%exclude %{_datadir}/%{name}/tools/zfs*
88a1ed
%exclude %{_datadir}/%{name}/tools/doc/zfs*
88a1ed
%exclude %{_mandir}/man8/zfs*
88a1ed
# criticalstat relies on CONFIG_PREEMPTIRQ_EVENTS which is absent on RHEL 7
88a1ed
%exclude %{_datadir}/%{name}/tools/criticalstat
88a1ed
%exclude %{_datadir}/%{name}/tools/doc/criticalstat_example.txt
88a1ed
%exclude %{_mandir}/man8/criticalstat.8
88a1ed
# tcpstates relies on sock:inet_sock_set_state which is absent on RHEL 7
88a1ed
%exclude %{_datadir}/%{name}/tools/tcpstates
88a1ed
%exclude %{_datadir}/%{name}/tools/doc/tcpstates_example.txt
88a1ed
%exclude %{_mandir}/man8/tcpstates.8
80cbd0
%{_mandir}/man8/*
80cbd0
80cbd0
%if %{with lua}
80cbd0
%files lua
80cbd0
%{_bindir}/bcc-lua
80cbd0
%endif
80cbd0
80cbd0
80cbd0
%changelog
88a1ed
* Tue Aug 06 2019 Jerome Marchand <jmarchan@redhat.com> - 0.10.0-1
88a1ed
- Rebase on bcc-0.10.0
88a1ed
- Fix regression of vfscount
88a1ed
- Drop tools that relies on features unavailable on RHEL 7
88a1ed
2a0312
* Mon Jan 28 2019 Jerome Marchand <jmarchan@redhat.com> - 0.8.0-1
2a0312
- Rebase on bcc-8.0.0
2a0312
- Update libLLVM.so name for 7.0
2a0312
80cbd0
* Fri Sep 21 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.1-2
80cbd0
- Set a minimal version for llvm-private(-devel)
80cbd0
80cbd0
* Thu Aug 16 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.1-1
80cbd0
- Rebase on v0.6.1
80cbd0
- Fix tcpsubnet
80cbd0
- Reinstate llcstat tool
80cbd0
- Remove inject tool
80cbd0
- Add NSS support to sslsniff
80cbd0
- Fixes miscellaneous error uncovered by covscan
80cbd0
80cbd0
* Wed Jul 04 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-3
80cbd0
- Fix tools on RHEL 7
80cbd0
- Remove llcstat and ZFS tools.
80cbd0
80cbd0
* Tue Jun 26 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-2
80cbd0
- Add llvm-private requirement
80cbd0
- Fix manpages symlinks
80cbd0
80cbd0
* Tue Jun 19 2018 Jerome Marchand <jmarchan@redhat.com> - 0.6.0-1
80cbd0
- Rebase on bcc-0.6.0
80cbd0
80cbd0
* Thu Jun 07 2018 Jerome Marchand <jmarchan@redhat.com> - 0.5.0-6
80cbd0
- Enables build on RHEL 7
80cbd0
80cbd0
* Thu May 24 2018 Jerome Marchand <jmarchan@redhat.com> - 0.5.0-5
80cbd0
- Enables build on ppc64(le) and s390x arches
80cbd0
80cbd0
* Thu Apr 05 2018 Rafael Santos <rdossant@redhat.com> - 0.5.0-4
80cbd0
- Resolves #1555627 - fix compilation error with latest llvm/clang
80cbd0
80cbd0
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-3
80cbd0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
80cbd0
80cbd0
* Fri Feb 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.5.0-2
80cbd0
- Switch to %%ldconfig_scriptlets
80cbd0
80cbd0
* Wed Jan 03 2018 Rafael Santos <rdossant@redhat.com> - 0.5.0-1
80cbd0
- Rebase to new released version
80cbd0
80cbd0
* Thu Nov 16 2017 Rafael Santos <rdossant@redhat.com> - 0.4.0-4
80cbd0
- Resolves #1517408 - avoid conflict with other manpages
80cbd0
80cbd0
* Thu Nov 02 2017 Rafael Santos <rdossant@redhat.com> - 0.4.0-3
80cbd0
- Use weak deps to not require lua subpkg on ppc64(le)
80cbd0
80cbd0
* Wed Nov 01 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4.0-2
80cbd0
- Rebuild for LLVM5
80cbd0
80cbd0
* Wed Nov 01 2017 Rafael Fonseca <rdossant@redhat.com> - 0.4.0-1
80cbd0
- Resolves #1460482 - rebase to new release
80cbd0
- Resolves #1505506 - add support for LLVM 5.0
80cbd0
- Resolves #1460482 - BPF module compilation issue
80cbd0
- Partially address #1479990 - location of man pages
80cbd0
- Enable ppc64(le) support without lua
80cbd0
- Soname versioning for libbpf by ignatenkobrain
80cbd0
80cbd0
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-4
80cbd0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
80cbd0
80cbd0
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-3
80cbd0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
80cbd0
80cbd0
* Thu Mar 30 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.3.0-2
80cbd0
- Rebuild for LLVM4
80cbd0
- Trivial fixes in spec
80cbd0
80cbd0
* Fri Mar 10 2017 Rafael Fonseca <rdossant@redhat.com> - 0.3.0-1
80cbd0
- Rebase to new release.
80cbd0
80cbd0
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-3
80cbd0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
80cbd0
80cbd0
* Tue Jan 10 2017 Rafael Fonseca <rdossant@redhat.com> - 0.2.0-2
80cbd0
- Fix typo
80cbd0
80cbd0
* Tue Nov 29 2016 Rafael Fonseca <rdossant@redhat.com> - 0.2.0-1
80cbd0
- Initial import