|
| 1 | +# Copyright (c) PLUMgrid, Inc. |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License") |
| 3 | + |
| 4 | +%define debug_package %{nil} |
| 5 | +%define llvmver 3.7.0rc3 |
| 6 | +%define gccver 5.1.0 |
| 7 | +%define pythonver 2.7.10 |
| 8 | + |
| 9 | +Name: bcc |
| 10 | +Version: 0.1.5 |
| 11 | +Release: 1%{?dist} |
| 12 | +Summary: BPF Compiler Collection (BCC) |
| 13 | + |
| 14 | +Group: Development/Languages |
| 15 | +License: ASL 2.0 |
| 16 | +URL: https://github.com/iovisor/bcc |
| 17 | +Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz |
| 18 | +Source1: https://ftp.gnu.org/gnu/gcc/gcc-%{gccver}/gcc-%{gccver}.tar.gz |
| 19 | +Source2: https://www.python.org/ftp/python/%{pythonver}/Python-%{pythonver}.tgz |
| 20 | +Source3: http://llvm.org/pre-releases/3.7.0/rc3/llvm-%{llvmver}.src.tar.xz |
| 21 | +Source4: http://llvm.org/pre-releases/3.7.0/rc3/cfe-%{llvmver}.src.tar.xz |
| 22 | + |
| 23 | +BuildArch: x86_64 |
| 24 | +BuildRequires: bison, bzip2, cmake >= 2.8.7, file, flex, gcc, gcc-c++, git, glibc-devel, glibc-utils, python2-devel, rpm-build, svn, tar, texinfo-tex, wget, zip, zlib-devel |
| 25 | + |
| 26 | +%description |
| 27 | +Python bindings for BPF Compiler Collection (BCC). Control a BPF program |
| 28 | +from userspace. |
| 29 | + |
| 30 | + |
| 31 | +%prep |
| 32 | +%setup -T -b 1 -n gcc-%{gccver} |
| 33 | +%setup -T -D -b 2 -n Python-%{pythonver} |
| 34 | +%setup -T -D -b 3 -n llvm-%{llvmver}.src |
| 35 | +mkdir tools/clang |
| 36 | +tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 |
| 37 | +%setup -D -n bcc-%{version} |
| 38 | + |
| 39 | +%build |
| 40 | + |
| 41 | +export LD_LIBRARY_PATH="%{_builddir}/usr/lib64" |
| 42 | +export PATH="%{_builddir}/usr/bin":$PATH |
| 43 | + |
| 44 | +# build gcc to bootstrap llvm build |
| 45 | +pushd %{_builddir}/gcc-%{gccver} |
| 46 | +./contrib/download_prerequisites |
| 47 | +mkdir build |
| 48 | +cd build |
| 49 | +../configure --disable-multilib --prefix="%{_builddir}/usr" |
| 50 | +make -j`grep -c ^process /proc/cpuinfo` |
| 51 | +make install |
| 52 | +popd |
| 53 | + |
| 54 | +echo "%{_builddir}/usr/lib64" > /etc/ld.so.conf.d/usrLocalLib64.conf |
| 55 | +ldconfig |
| 56 | + |
| 57 | +# build newer python for llvm |
| 58 | +pushd %{_builddir}/Python-%{pythonver} |
| 59 | +./configure --prefix="%{_builddir}/usr" |
| 60 | +make -j`grep -c ^process /proc/cpuinfo` |
| 61 | +make install |
| 62 | +popd |
| 63 | + |
| 64 | +# build llvm with local gcc |
| 65 | +pushd %{_builddir}/llvm-%{llvmver}.src |
| 66 | +mkdir build |
| 67 | +cd build |
| 68 | +cmake .. -DCMAKE_INSTALL_PREFIX="%{_builddir}/usr" -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF" |
| 69 | +make -j`grep -c ^process /proc/cpuinfo` |
| 70 | +make install |
| 71 | +popd |
| 72 | + |
| 73 | +rm /etc/ld.so.conf.d/usrLocalLib64.conf |
| 74 | +ldconfig |
| 75 | + |
| 76 | +mkdir build |
| 77 | +cd build |
| 78 | +cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++" |
| 79 | +make -j`grep -c ^process /proc/cpuinfo` |
| 80 | + |
| 81 | +%install |
| 82 | +cd build |
| 83 | +make install/strip DESTDIR=%{buildroot} |
| 84 | + |
| 85 | +%changelog |
| 86 | +* Fri Jul 03 2015 Brenden Blanco <[email protected]> - 0.1.1-2 |
| 87 | +- Initial RPM Release |
| 88 | + |
| 89 | +%package -n libbcc |
| 90 | +Summary: Shared Library for BPF Compiler Collection (BCC) |
| 91 | +%description -n libbcc |
| 92 | +Shared Library for BPF Compiler Collection (BCC) |
| 93 | + |
| 94 | +%package -n libbcc-examples |
| 95 | +Summary: Examples for BPF Compiler Collection (BCC) |
| 96 | +%description -n libbcc-examples |
| 97 | +Examples for BPF Compiler Collection (BCC) |
| 98 | + |
| 99 | +%package -n python-bpf |
| 100 | +Summary: Python bindings for BPF Compiler Collection (BCC) |
| 101 | +%description -n python-bpf |
| 102 | +Python bindings for BPF Compiler Collection (BCC) |
| 103 | + |
| 104 | +%files -n python-bpf |
| 105 | +%{python_sitelib}/bpf* |
| 106 | +%exclude %{python_sitelib}/*.egg-info |
| 107 | +/usr/bin/bpf-run |
| 108 | + |
| 109 | +%files -n libbcc |
| 110 | +/usr/lib64/* |
| 111 | +/usr/share/bcc/include/* |
| 112 | +/usr/include/bcc/* |
| 113 | + |
| 114 | +%files -n libbcc-examples |
| 115 | +/usr/share/bcc/examples/* |
0 commit comments