From c5127dac67b0064cfbfa60224db17450653954fa Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Jan 10 2017 15:38:08 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore index e69de29..9ad667f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/v0.2.0.tar.gz diff --git a/bcc-0.2.0-explicit-static.patch b/bcc-0.2.0-explicit-static.patch new file mode 100644 index 0000000..da2cdaf --- /dev/null +++ b/bcc-0.2.0-explicit-static.patch @@ -0,0 +1,28 @@ +--- bcc-0.2.0/src/cc/CMakeLists.txt 2017-01-05 16:01:59.069871274 +0100 ++++ bcc-0.2.0/src/cc/CMakeLists.txt 2017-01-05 16:01:36.782847428 +0100 +@@ -39,7 +39,7 @@ + set_target_properties(bcc-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0) + set_target_properties(bcc-shared PROPERTIES OUTPUT_NAME bcc) + +-add_library(bcc-loader-static libbpf.c perf_reader.c bcc_elf.c bcc_perf_map.c bcc_proc.c) ++add_library(bcc-loader-static STATIC libbpf.c perf_reader.c bcc_elf.c bcc_perf_map.c bcc_proc.c) + add_library(bcc-static STATIC bpf_common.cc bpf_module.cc shared_table.cc exported_files.cc bcc_syms.cc usdt_args.cc usdt.cc) + set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc) + +--- bcc-0.2.0/src/cc/frontends/b/CMakeLists.txt 2017-01-05 16:02:17.133890595 +0100 ++++ bcc-0.2.0/src/cc/frontends/b/CMakeLists.txt 2017-01-05 16:01:22.954832633 +0100 +@@ -11,5 +11,5 @@ + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lexer.ll.cc PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register") + endif() + +-add_library(b_frontend loader.cc codegen_llvm.cc node.cc parser.cc printer.cc ++add_library(b_frontend STATIC loader.cc codegen_llvm.cc node.cc parser.cc printer.cc + type_check.cc ${BISON_Parser_OUTPUTS} ${FLEX_Lexer_OUTPUTS}) +--- bcc-0.2.0/src/cc/frontends/clang/CMakeLists.txt 2017-01-05 16:02:48.788924466 +0100 ++++ bcc-0.2.0/src/cc/frontends/clang/CMakeLists.txt 2017-01-05 16:02:36.038910825 +0100 +@@ -4,4 +4,4 @@ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL_MODULES_DIR='\"${BCC_KERNEL_MODULES_DIR}\"'") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL_MODULES_SUFFIX='\"${BCC_KERNEL_MODULES_SUFFIX}\"'") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL_HAS_SOURCE_DIR=${BCC_KERNEL_HAS_SOURCE_DIR}") +-add_library(clang_frontend loader.cc b_frontend_action.cc tp_frontend_action.cc kbuild_helper.cc) ++add_library(clang_frontend STATIC loader.cc b_frontend_action.cc tp_frontend_action.cc kbuild_helper.cc) diff --git a/bcc.spec b/bcc.spec new file mode 100644 index 0000000..47d1f5f --- /dev/null +++ b/bcc.spec @@ -0,0 +1,155 @@ +Name: bcc +Version: 0.2.0 +Release: 1%{?dist} +Summary: BPF Compiler Collection (BCC) +License: ASL 2.0 +URL: https://github.com/iovisor/bcc +Source0: https://github.com/iovisor/%{name}/archive/v%{version}.tar.gz + +# https://github.com/iovisor/bcc/issues/841 +Patch0: %{name}-0.2.0-explicit-static.patch + +# Arches will be included as upstream support is added and dependencies are +# satisfied in the respective arches +ExclusiveArch: x68_64 + +BuildRequires: bison, cmake >= 2.8.7, flex, libxml2-devel +BuildRequires: python3-devel +BuildRequires: elfutils-libelf-devel-static +BuildRequires: llvm-devel llvm-static clang-devel +BuildRequires: ncurses-devel +BuildRequires: pkgconfig(luajit) + +Requires: %{name}-tools = %{version}-%{release} + +%description +BCC is a toolkit for creating efficient kernel tracing and manipulation +programs, and includes several useful tools and examples. It makes use of +extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature +that was first added to Linux 3.15. BCC makes BPF programs easier to write, +with kernel instrumentation in C (and includes a C wrapper around LLVM), and +front-ends in Python and lua. It is suited for many tasks, including +performance analysis and network traffic control. + + +%package devel +Summary: Shared library for BPF Compiler Collection (BCC) +Requires: elfutils-libelf +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for developing +application that use BPF Compiler Collection (BCC). + + +%package doc +Summary: Examples for BPF Compiler Collection (BCC) +Requires: python3-%{name} = %{version}-%{release} +Requires: %{name}-lua = %{version}-%{release} +BuildArch: noarch + +%description doc +Examples for BPF Compiler Collection (BCC) + + +%package -n python3-%{name} +Summary: Python3 bindings for BPF Compiler Collection (BCC) +Requires: %{name}%{?_isa} = %{version}-%{release} +%{?python_provide:%python_provide python3-%{srcname}} + +%description -n python3-%{name} +Python3 bindings for BPF Compiler Collection (BCC) + + +%package lua +Summary: Standalone tool to run BCC tracers written in Lua +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description lua +Standalone tool to run BCC tracers written in Lua + +%package tools +Summary: Command line tools for BPF Compiler Collection (BCC) +Requires: python3-%{name} = %{version}-%{release} +BuildArch: noarch + +%description tools +Command line tools for BPF Compiler Collection (BCC) + +%prep +%autosetup -p1 + + +%build +%cmake . -DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 \ + -DLUAJIT_INCLUDE_DIR=`pkg-config --variable=includedir luajit` \ + -DLUAJIT_LIBRARIES=`pkg-config --variable=libdir luajit`/lib`pkg-config --variable=libname luajit`.so +make %{?_smp_mflags} + + +%install +%make_install + +# Fix python shebangs +for i in `find %{buildroot}/usr/share/%{name}/tools/ -type f`; do + sed -i 's/\/usr\/bin\/env python\>/\/usr\/bin\/python3/' $i + sed -i 's/\/usr\/bin\/python\>/&3/' $i +done + +for i in `find %{buildroot}/usr/share/%{name}/examples/ -type f`; do + sed -i 's/\/usr\/bin\/env python\>/\/usr\/bin\/python3/' $i + sed -i 's/\/usr\/bin\/python\>/&3/' $i + sed -i 's/\/usr\/bin\/env bcc-lua\>/\/usr\/bin\/bcc-lua/' $i +done + +# Compress man pages +find %{buildroot}/usr/share/%{name}/man/man8/ -name "*.8" -exec gzip {} \; + +# We cannot run the test suit since it requires root and it makes changes to +# the machine (e.g, IP address) +#%check + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%doc README.md +%license LICENSE.txt COPYRIGHT.txt +%{_libdir}/lib%{name}.so.* + +%files devel +%{_libdir}/lib%{name}.so +%{_libdir}/pkgconfig/lib%{name}.pc +%dir %{_includedir}/%{name} +%{_includedir}/%{name}/* + +%files -n python3-%{name} +%{python3_sitelib}/%{name}* + +%files doc +%dir %{_datadir}/%{name} +%doc %{_datadir}/%{name}/examples/ +%exclude %{_datadir}/%{name}/examples/*.pyc +%exclude %{_datadir}/%{name}/examples/*.pyo +%exclude %{_datadir}/%{name}/examples/*/*.pyc +%exclude %{_datadir}/%{name}/examples/*/*.pyo +%exclude %{_datadir}/%{name}/examples/*/*/*.pyc +%exclude %{_datadir}/%{name}/examples/*/*/*.pyo + +%files tools +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/tools +%{_datadir}/%{name}/tools/* +%exclude %{_datadir}/%{name}/tools/old/ +%dir %{_datadir}/%{name}/man +%{_datadir}/%{name}/man/* + +%files lua +%{_bindir}/bcc-lua + + +%changelog +* Tue Nov 29 2016 Rafael Fonseca - 0.2.0-1 +- Initial import diff --git a/sources b/sources index e69de29..2070e2d 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (v0.2.0.tar.gz) = edb696a5382e2f56d06e6b8b65c37b50e719da944fbce43cbad116c773e759fb51837d57ae3d159d83a489dfd0254b9f50b97dab7116465d57f787cf50d58808