From 4fb18607312d810f26cea2273c59a221708116d5 Mon Sep 17 00:00:00 2001 From: Brenden Blanco <bblanco@plumgrid.com> Date: Fri, 19 Feb 2016 14:42:22 -0800 Subject: [PATCH] Update rpm build scripts and README Remove the unused Dockerfiles. Create two flavors of spec files, one which includes steps to build clang from source and link against it, and one which assumes clang is already available and just builds bcc. The former is more appropriate for official packaging, the latter for nightly and quick builds. Also, introduce a numbering scheme for nightly rpm files. The format will be: `libbcc-$latest_git_tag-g$latest_git_hash.x86_64.rpm` as in: `libbcc-0.1.7-g73c4d1a.x86_64.rpm` Update the INSTALL.md to mention the RPMs Signed-off-by: Brenden Blanco <bblanco@plumgrid.com> --- INSTALL.md | 26 +++-- SPECS/Dockerfile.el6 | 21 ---- SPECS/Dockerfile.el6.in | 21 ---- SPECS/Dockerfile.el7 | 19 ---- SPECS/Dockerfile.el7.in | 19 ---- SPECS/Dockerfile.f22 | 20 ---- SPECS/Dockerfile.f22.in | 20 ---- SPECS/Dockerfile.fedora | 20 ++++ SPECS/{bcc.f22.spec.in => bcc+clang.spec} | 43 +++++--- SPECS/bcc.el6.spec | 113 ---------------------- SPECS/bcc.el6.spec.in | 113 ---------------------- SPECS/bcc.el7.spec | 82 ---------------- SPECS/bcc.el7.spec.in | 82 ---------------- SPECS/bcc.f22.spec | 82 ---------------- SPECS/bcc.spec | 6 +- scripts/build-release-rpm.sh | 38 ++++++++ scripts/build-rpm.sh | 18 +++- 17 files changed, 120 insertions(+), 623 deletions(-) delete mode 100644 SPECS/Dockerfile.el6 delete mode 100644 SPECS/Dockerfile.el6.in delete mode 100644 SPECS/Dockerfile.el7 delete mode 100644 SPECS/Dockerfile.el7.in delete mode 100644 SPECS/Dockerfile.f22 delete mode 100644 SPECS/Dockerfile.f22.in create mode 100644 SPECS/Dockerfile.fedora rename SPECS/{bcc.f22.spec.in => bcc+clang.spec} (57%) delete mode 100644 SPECS/bcc.el6.spec delete mode 100644 SPECS/bcc.el6.spec.in delete mode 100644 SPECS/bcc.el7.spec delete mode 100644 SPECS/bcc.el7.spec.in delete mode 100644 SPECS/bcc.f22.spec create mode 100755 scripts/build-release-rpm.sh diff --git a/INSTALL.md b/INSTALL.md index 2ff9b23b..d144d05d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -36,9 +36,9 @@ Install a 4.3+ kernel from http://kernel.ubuntu.com/~kernel-ppa/mainline, for example: ```bash -VER=4.3.0-040300 +VER=4.4.2-040402 PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-wily/ -REL=201511020949 +REL=201602171633 wget ${PREFIX}/linux-headers-${VER}-generic_${VER}.${REL}_amd64.deb wget ${PREFIX}/linux-headers-${VER}_${VER}.${REL}_all.deb wget ${PREFIX}/linux-image-${VER}-generic_${VER}.${REL}_amd64.deb @@ -48,8 +48,8 @@ sudo dpkg -i linux-*${VER}.${REL}*.deb Update PREFIX to the latest date, and you can browse the files in the PREFIX url to find the REL number. -Tagged bcc binary packages are built for Ubuntu Trusty (14.04) and hosted at -http://52.8.15.63/apt/. +Tagged and signed bcc binary packages are built for Ubuntu Trusty (14.04) and +hosted at http://52.8.15.63/apt/. To install: ```bash @@ -76,18 +76,18 @@ Install a 4.2+ kernel from http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug, for example: ```bash -sudo wget http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo -O /etc/yum.repos.d/fedora-rawhide-kernel-nodebug.repo -sudo dnf install -y kernel-core-4.2.0-1.fc24.x86_64 kernel-4.2.0-1.fc24.x86_64 kernel-devel-4.2.0-1.fc24.x86_64 kernel-modules-4.2.0-1.fc24.x86_64 kernel-headers-4.2.0-1.fc24.x86_64 +sudo dnf config-manager --add-repo=http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo +sudo dnf update # reboot ``` -Tagged bcc binary packages are built for Fedora 22 and hosted at -http://52.8.15.63/yum/. +Nightly bcc binary packages are built for Fedora 23 and 24, hosted at +`http://52.8.15.63/yum/nightly/f{23,24}`. -To install: +To install (change 'f23' to 'f24' for rawhide): ```bash -sudo wget http://52.8.15.63/yum/main/f22/iovisor.repo -O /etc/yum.repos.d/iovisor.repo -sudo dnf install -y libbcc libbcc-examples python-bcc +echo -e '[iovisor]\nbaseurl=http://52.8.15.63/yum/nightly/f23/$basearch\nenabled=1\ngpgcheck=0' | sudo tee /etc/yum.repos.d/iovisor.repo +sudo dnf install bcc-tools ``` ## Arch - AUR @@ -157,8 +157,6 @@ sudo tar xf clang+llvm-3.7.0-x86_64-fedora22.tar.xz -C /usr/local --strip 1 ``` git clone https://github.com/iovisor/bcc.git mkdir bcc/build; cd bcc/build -# optional -export CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++ cmake .. -DCMAKE_INSTALL_PREFIX=/usr make sudo make install @@ -174,7 +172,7 @@ cd llvm/tools; git clone http://llvm.org/git/clang.git cd ..; mkdir -p build/install; cd build cmake -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install .. -make -j4 +make make install export PATH=$PWD/install/bin:$PATH ``` diff --git a/SPECS/Dockerfile.el6 b/SPECS/Dockerfile.el6 deleted file mode 100644 index 184fe24b..00000000 --- a/SPECS/Dockerfile.el6 +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -FROM centos:6 - -MAINTAINER Brenden Blanco <bblanco@plumgrid.com> - -RUN yum -y install bison cmake flex gcc gcc-c++ git glibc-devel glibc-utils python2-devel rpm-build svn tar texinfo-tex wget zip zlib-devel - -WORKDIR /root -RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} -RUN cd SOURCES && wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz -RUN cd SOURCES && wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.gz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz -RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.7.tar.gz - -RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.7/SPECS/bcc.el6.spec -#COPY SPECS/bcc.el6.spec SPECS/ - -RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el6.spec diff --git a/SPECS/Dockerfile.el6.in b/SPECS/Dockerfile.el6.in deleted file mode 100644 index 87933204..00000000 --- a/SPECS/Dockerfile.el6.in +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -FROM centos:6 - -MAINTAINER Brenden Blanco <bblanco@plumgrid.com> - -RUN yum -y install bison cmake flex gcc gcc-c++ git glibc-devel glibc-utils python2-devel rpm-build svn tar texinfo-tex wget zip zlib-devel - -WORKDIR /root -RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} -RUN cd SOURCES && wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz -RUN cd SOURCES && wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.gz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz -RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@REVISION_LAST@.tar.gz - -RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v@REVISION_LAST@/SPECS/bcc.el6.spec -#COPY SPECS/bcc.el6.spec SPECS/ - -RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el6.spec diff --git a/SPECS/Dockerfile.el7 b/SPECS/Dockerfile.el7 deleted file mode 100644 index d6f5114a..00000000 --- a/SPECS/Dockerfile.el7 +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -FROM centos:7 - -MAINTAINER Brenden Blanco <bblanco@plumgrid.com> - -RUN yum -y install bison cmake flex gcc gcc-c++ make python2-devel rpm-build wget zlib-devel - -WORKDIR /root -RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz -RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.7.tar.gz - -RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.7/SPECS/bcc.el7.spec -#COPY SPECS/bcc.el7.spec SPECS/ - -RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el7.spec diff --git a/SPECS/Dockerfile.el7.in b/SPECS/Dockerfile.el7.in deleted file mode 100644 index 5a82058d..00000000 --- a/SPECS/Dockerfile.el7.in +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -FROM centos:7 - -MAINTAINER Brenden Blanco <bblanco@plumgrid.com> - -RUN yum -y install bison cmake flex gcc gcc-c++ make python2-devel rpm-build wget zlib-devel - -WORKDIR /root -RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz -RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@REVISION_LAST@.tar.gz - -RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v@REVISION_LAST@/SPECS/bcc.el7.spec -#COPY SPECS/bcc.el7.spec SPECS/ - -RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el7.spec diff --git a/SPECS/Dockerfile.f22 b/SPECS/Dockerfile.f22 deleted file mode 100644 index c4c996b8..00000000 --- a/SPECS/Dockerfile.f22 +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -FROM fedora:22 - -MAINTAINER Brenden Blanco <bblanco@plumgrid.com> - -RUN dnf -y install bison cmake flex gcc gcc-c++ libstdc++-static make python2-devel rpm-build wget zlib-devel - -WORKDIR /root -RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} - -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz -RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.7.tar.gz - -RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.7/SPECS/bcc.f22.spec -#COPY SPECS/bcc.f22.spec SPECS/ - -RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.f22.spec diff --git a/SPECS/Dockerfile.f22.in b/SPECS/Dockerfile.f22.in deleted file mode 100644 index 5b32d4d1..00000000 --- a/SPECS/Dockerfile.f22.in +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -FROM fedora:22 - -MAINTAINER Brenden Blanco <bblanco@plumgrid.com> - -RUN dnf -y install bison cmake flex gcc gcc-c++ libstdc++-static make python2-devel rpm-build wget zlib-devel - -WORKDIR /root -RUN mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS} - -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz -RUN cd SOURCES && wget http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz -RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@REVISION_LAST@.tar.gz - -RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v@REVISION_LAST@/SPECS/bcc.f22.spec -#COPY SPECS/bcc.f22.spec SPECS/ - -RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.f22.spec diff --git a/SPECS/Dockerfile.fedora b/SPECS/Dockerfile.fedora new file mode 100644 index 00000000..2ecbb0b6 --- /dev/null +++ b/SPECS/Dockerfile.fedora @@ -0,0 +1,20 @@ +# Copyright (c) PLUMgrid, Inc. +# Licensed under the Apache License, Version 2.0 (the "License") + +FROM fedora:rawhide + +MAINTAINER Brenden Blanco <bblanco@plumgrid.com> + +RUN dnf -y install bison cmake flex gcc gcc-c++ git libxml2-devel make python2-devel rpm-build wget zlib-devel + +WORKDIR /root + +RUN wget http://llvm.org/releases/3.7.1/{cfe,llvm}-3.7.1.src.tar.xz + +RUN tar -xf llvm-3.7.1.src.tar.xz && mkdir llvm-3.7.1.src/tools/clang && tar -xf cfe-3.7.1.src.tar.xz -C llvm-3.7.1.src/tools/clang --strip 1 && mkdir llvm-3.7.1.src/build +RUN cd llvm-3.7.1.src/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF" -DCMAKE_INSTALL_PREFIX=/usr +RUN cd llvm-3.7.1.src/build && make -j8 + +COPY . bcc +WORKDIR /root/bcc +RUN PATH=/root/llvm-3.7.1.src/build/bin:$PATH ./scripts/build-rpm.sh diff --git a/SPECS/bcc.f22.spec.in b/SPECS/bcc+clang.spec similarity index 57% rename from SPECS/bcc.f22.spec.in rename to SPECS/bcc+clang.spec index 32cd9a48..e73c43e4 100644 --- a/SPECS/bcc.f22.spec.in +++ b/SPECS/bcc+clang.spec @@ -1,20 +1,20 @@ %define debug_package %{nil} -%define llvmver 3.7.0 +%define llvmver 3.7.1 Name: bcc -Version: @REVISION_LAST@ -Release: 1%{?dist} +Version: @REVISION@ +Release: @GIT_REV_COUNT@ Summary: BPF Compiler Collection (BCC) Group: Development/Languages License: ASL 2.0 URL: https://github.com/iovisor/bcc Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz -Source1: http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz -Source2: http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz +Source1: http://llvm.org/releases/%{llvmver}/llvm-%{llvmver}.src.tar.xz +Source2: http://llvm.org/releases/%{llvmver}/cfe-%{llvmver}.src.tar.xz BuildArch: x86_64 -BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel +BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, libxml2-devel, python2-devel %description Python bindings for BPF Compiler Collection (BCC). Control a BPF program from @@ -25,7 +25,7 @@ userspace. %setup -T -b 1 -n llvm-%{llvmver}.src mkdir tools/clang tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 -%setup -D -n bcc-%{version} +%setup -D -n bcc %build @@ -36,15 +36,15 @@ export PATH="%{_builddir}/usr/bin":$PATH pushd %{_builddir}/llvm-%{llvmver}.src mkdir build cd build -../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install +cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;BPF" -DCMAKE_INSTALL_PREFIX=/usr +make %{?_smp_mflags} +make install DESTDIR="%{_builddir}" popd mkdir build pushd build -cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -make -j`grep -c ^process /proc/cpuinfo` +cmake .. -DREVISION_LAST=%{version} -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr +make %{?_smp_mflags} popd %install @@ -62,17 +62,24 @@ Shared Library for BPF Compiler Collection (BCC) %package -n libbcc-examples Summary: Examples for BPF Compiler Collection (BCC) +Requires: libbcc %description -n libbcc-examples Examples for BPF Compiler Collection (BCC) %package -n python-bcc Summary: Python bindings for BPF Compiler Collection (BCC) +Requires: libbcc %description -n python-bcc Python bindings for BPF Compiler Collection (BCC) +%package -n bcc-tools +Summary: Command line tools for BPF Compiler Collection (BCC) +Requires: python-bcc +%description -n bcc-tools +Command line tools for BPF Compiler Collection (BCC) + %files -n python-bcc %{python_sitelib}/bcc* -%exclude %{python_sitelib}/*.egg-info %files -n libbcc /usr/lib64/* @@ -80,3 +87,13 @@ Python bindings for BPF Compiler Collection (BCC) %files -n libbcc-examples /usr/share/bcc/examples/* +%exclude /usr/share/bcc/examples/*.pyc +%exclude /usr/share/bcc/examples/*.pyo +%exclude /usr/share/bcc/examples/*/*.pyc +%exclude /usr/share/bcc/examples/*/*.pyo +%exclude /usr/share/bcc/examples/*/*/*.pyc +%exclude /usr/share/bcc/examples/*/*/*.pyo + +%files -n bcc-tools +/usr/share/bcc/tools/* +/usr/share/bcc/man/* diff --git a/SPECS/bcc.el6.spec b/SPECS/bcc.el6.spec deleted file mode 100644 index f25e34ab..00000000 --- a/SPECS/bcc.el6.spec +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -%define debug_package %{nil} -%define llvmver 3.7.0 -%define gccver 5.1.0 -%define pythonver 2.7.10 - -Name: bcc -Version: 0.1.7 -Release: 1%{?dist} -Summary: BPF Compiler Collection (BCC) - -Group: Development/Languages -License: ASL 2.0 -URL: https://github.com/iovisor/bcc -Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz -Source1: https://ftp.gnu.org/gnu/gcc/gcc-%{gccver}/gcc-%{gccver}.tar.gz -Source2: https://www.python.org/ftp/python/%{pythonver}/Python-%{pythonver}.tgz -Source3: http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz -Source4: http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz - -BuildArch: x86_64 -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 - -%description -Python bindings for BPF Compiler Collection (BCC). Control a BPF program -from userspace. - - -%prep -%setup -T -b 1 -n gcc-%{gccver} -%setup -T -D -b 2 -n Python-%{pythonver} -%setup -T -D -b 3 -n llvm-%{llvmver}.src -mkdir tools/clang -tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 -%setup -D -n bcc-%{version} - -%build - -export LD_LIBRARY_PATH="%{_builddir}/usr/lib64" -export PATH="%{_builddir}/usr/bin":$PATH - -# build gcc to bootstrap llvm build -pushd %{_builddir}/gcc-%{gccver} -./contrib/download_prerequisites -mkdir build -cd build -../configure --disable-multilib --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -echo "%{_builddir}/usr/lib64" > /etc/ld.so.conf.d/usrLocalLib64.conf -ldconfig - -# build newer python for llvm -pushd %{_builddir}/Python-%{pythonver} -./configure --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -# build llvm with local gcc -pushd %{_builddir}/llvm-%{llvmver}.src -mkdir build -cd build -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" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -rm /etc/ld.so.conf.d/usrLocalLib64.conf -ldconfig - -mkdir build -cd build -cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++" -make -j`grep -c ^process /proc/cpuinfo` - -%install -cd build -make install/strip DESTDIR=%{buildroot} - -%changelog -* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2 -- Initial RPM Release - -%package -n libbcc -Summary: Shared Library for BPF Compiler Collection (BCC) -%description -n libbcc -Shared Library for BPF Compiler Collection (BCC) - -%package -n libbcc-examples -Summary: Examples for BPF Compiler Collection (BCC) -%description -n libbcc-examples -Examples for BPF Compiler Collection (BCC) - -%package -n python-bcc -Summary: Python bindings for BPF Compiler Collection (BCC) -%description -n python-bcc -Python bindings for BPF Compiler Collection (BCC) - -%files -n python-bcc -%{python_sitelib}/bcc* -%exclude %{python_sitelib}/*.egg-info - -%files -n libbcc -/usr/lib64/* -/usr/include/bcc/* - -%files -n libbcc-examples -/usr/share/bcc/examples/* diff --git a/SPECS/bcc.el6.spec.in b/SPECS/bcc.el6.spec.in deleted file mode 100644 index 4493f9ff..00000000 --- a/SPECS/bcc.el6.spec.in +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (c) PLUMgrid, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") - -%define debug_package %{nil} -%define llvmver 3.7.0 -%define gccver 5.1.0 -%define pythonver 2.7.10 - -Name: bcc -Version: @REVISION_LAST@ -Release: 1%{?dist} -Summary: BPF Compiler Collection (BCC) - -Group: Development/Languages -License: ASL 2.0 -URL: https://github.com/iovisor/bcc -Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz -Source1: https://ftp.gnu.org/gnu/gcc/gcc-%{gccver}/gcc-%{gccver}.tar.gz -Source2: https://www.python.org/ftp/python/%{pythonver}/Python-%{pythonver}.tgz -Source3: http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz -Source4: http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz - -BuildArch: x86_64 -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 - -%description -Python bindings for BPF Compiler Collection (BCC). Control a BPF program -from userspace. - - -%prep -%setup -T -b 1 -n gcc-%{gccver} -%setup -T -D -b 2 -n Python-%{pythonver} -%setup -T -D -b 3 -n llvm-%{llvmver}.src -mkdir tools/clang -tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 -%setup -D -n bcc-%{version} - -%build - -export LD_LIBRARY_PATH="%{_builddir}/usr/lib64" -export PATH="%{_builddir}/usr/bin":$PATH - -# build gcc to bootstrap llvm build -pushd %{_builddir}/gcc-%{gccver} -./contrib/download_prerequisites -mkdir build -cd build -../configure --disable-multilib --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -echo "%{_builddir}/usr/lib64" > /etc/ld.so.conf.d/usrLocalLib64.conf -ldconfig - -# build newer python for llvm -pushd %{_builddir}/Python-%{pythonver} -./configure --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -# build llvm with local gcc -pushd %{_builddir}/llvm-%{llvmver}.src -mkdir build -cd build -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" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -rm /etc/ld.so.conf.d/usrLocalLib64.conf -ldconfig - -mkdir build -cd build -cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER="%{_builddir}/usr/bin/gcc" -DCMAKE_CXX_COMPILER="%{_builddir}/usr/bin/g++" -make -j`grep -c ^process /proc/cpuinfo` - -%install -cd build -make install/strip DESTDIR=%{buildroot} - -%changelog -* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2 -- Initial RPM Release - -%package -n libbcc -Summary: Shared Library for BPF Compiler Collection (BCC) -%description -n libbcc -Shared Library for BPF Compiler Collection (BCC) - -%package -n libbcc-examples -Summary: Examples for BPF Compiler Collection (BCC) -%description -n libbcc-examples -Examples for BPF Compiler Collection (BCC) - -%package -n python-bcc -Summary: Python bindings for BPF Compiler Collection (BCC) -%description -n python-bcc -Python bindings for BPF Compiler Collection (BCC) - -%files -n python-bcc -%{python_sitelib}/bcc* -%exclude %{python_sitelib}/*.egg-info - -%files -n libbcc -/usr/lib64/* -/usr/include/bcc/* - -%files -n libbcc-examples -/usr/share/bcc/examples/* diff --git a/SPECS/bcc.el7.spec b/SPECS/bcc.el7.spec deleted file mode 100644 index 6a99d624..00000000 --- a/SPECS/bcc.el7.spec +++ /dev/null @@ -1,82 +0,0 @@ -%define debug_package %{nil} -%define llvmver 3.7.0 - -Name: bcc -Version: 0.1.7 -Release: 1%{?dist} -Summary: BPF Compiler Collection (BCC) - -Group: Development/Languages -License: ASL 2.0 -URL: https://github.com/iovisor/bcc -Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz -Source1: http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz -Source2: http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz - -BuildArch: x86_64 -BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel - -%description -Python bindings for BPF Compiler Collection (BCC). Control a BPF program from -userspace. - - -%prep -%setup -T -b 1 -n llvm-%{llvmver}.src -mkdir tools/clang -tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 -%setup -D -n bcc-%{version} - -%build - -export LD_LIBRARY_PATH="%{_builddir}/usr/lib64" -export PATH="%{_builddir}/usr/bin":$PATH - -# build llvm -pushd %{_builddir}/llvm-%{llvmver}.src -mkdir build -cd build -../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -mkdir build -pushd build -cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -make -j`grep -c ^process /proc/cpuinfo` -popd - -%install -pushd build -make install/strip DESTDIR=%{buildroot} - -%changelog -* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2 -- Initial RPM Release - -%package -n libbcc -Summary: Shared Library for BPF Compiler Collection (BCC) -%description -n libbcc -Shared Library for BPF Compiler Collection (BCC) - -%package -n libbcc-examples -Summary: Examples for BPF Compiler Collection (BCC) -%description -n libbcc-examples -Examples for BPF Compiler Collection (BCC) - -%package -n python-bcc -Summary: Python bindings for BPF Compiler Collection (BCC) -%description -n python-bcc -Python bindings for BPF Compiler Collection (BCC) - -%files -n python-bcc -%{python_sitelib}/bcc* -%exclude %{python_sitelib}/*.egg-info - -%files -n libbcc -/usr/lib64/* -/usr/include/bcc/* - -%files -n libbcc-examples -/usr/share/bcc/examples/* diff --git a/SPECS/bcc.el7.spec.in b/SPECS/bcc.el7.spec.in deleted file mode 100644 index 32cd9a48..00000000 --- a/SPECS/bcc.el7.spec.in +++ /dev/null @@ -1,82 +0,0 @@ -%define debug_package %{nil} -%define llvmver 3.7.0 - -Name: bcc -Version: @REVISION_LAST@ -Release: 1%{?dist} -Summary: BPF Compiler Collection (BCC) - -Group: Development/Languages -License: ASL 2.0 -URL: https://github.com/iovisor/bcc -Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz -Source1: http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz -Source2: http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz - -BuildArch: x86_64 -BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel - -%description -Python bindings for BPF Compiler Collection (BCC). Control a BPF program from -userspace. - - -%prep -%setup -T -b 1 -n llvm-%{llvmver}.src -mkdir tools/clang -tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 -%setup -D -n bcc-%{version} - -%build - -export LD_LIBRARY_PATH="%{_builddir}/usr/lib64" -export PATH="%{_builddir}/usr/bin":$PATH - -# build llvm -pushd %{_builddir}/llvm-%{llvmver}.src -mkdir build -cd build -../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -mkdir build -pushd build -cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -make -j`grep -c ^process /proc/cpuinfo` -popd - -%install -pushd build -make install/strip DESTDIR=%{buildroot} - -%changelog -* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2 -- Initial RPM Release - -%package -n libbcc -Summary: Shared Library for BPF Compiler Collection (BCC) -%description -n libbcc -Shared Library for BPF Compiler Collection (BCC) - -%package -n libbcc-examples -Summary: Examples for BPF Compiler Collection (BCC) -%description -n libbcc-examples -Examples for BPF Compiler Collection (BCC) - -%package -n python-bcc -Summary: Python bindings for BPF Compiler Collection (BCC) -%description -n python-bcc -Python bindings for BPF Compiler Collection (BCC) - -%files -n python-bcc -%{python_sitelib}/bcc* -%exclude %{python_sitelib}/*.egg-info - -%files -n libbcc -/usr/lib64/* -/usr/include/bcc/* - -%files -n libbcc-examples -/usr/share/bcc/examples/* diff --git a/SPECS/bcc.f22.spec b/SPECS/bcc.f22.spec deleted file mode 100644 index 6a99d624..00000000 --- a/SPECS/bcc.f22.spec +++ /dev/null @@ -1,82 +0,0 @@ -%define debug_package %{nil} -%define llvmver 3.7.0 - -Name: bcc -Version: 0.1.7 -Release: 1%{?dist} -Summary: BPF Compiler Collection (BCC) - -Group: Development/Languages -License: ASL 2.0 -URL: https://github.com/iovisor/bcc -Source0: https://github.com/iovisor/bcc/archive/v%{version}.tar.gz -Source1: http://llvm.org/releases/3.7.0/llvm-%{llvmver}.src.tar.xz -Source2: http://llvm.org/releases/3.7.0/cfe-%{llvmver}.src.tar.xz - -BuildArch: x86_64 -BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, python2-devel - -%description -Python bindings for BPF Compiler Collection (BCC). Control a BPF program from -userspace. - - -%prep -%setup -T -b 1 -n llvm-%{llvmver}.src -mkdir tools/clang -tar -xvvJf %{_sourcedir}/cfe-%{llvmver}.src.tar.xz -C tools/clang --strip 1 -%setup -D -n bcc-%{version} - -%build - -export LD_LIBRARY_PATH="%{_builddir}/usr/lib64" -export PATH="%{_builddir}/usr/bin":$PATH - -# build llvm -pushd %{_builddir}/llvm-%{llvmver}.src -mkdir build -cd build -../configure --disable-assertions --enable-optimized --prefix="%{_builddir}/usr" -make -j`grep -c ^process /proc/cpuinfo` -make install -popd - -mkdir build -pushd build -cmake .. -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -make -j`grep -c ^process /proc/cpuinfo` -popd - -%install -pushd build -make install/strip DESTDIR=%{buildroot} - -%changelog -* Fri Jul 03 2015 Brenden Blanco <bblanco@plumgrid.com> - 0.1.1-2 -- Initial RPM Release - -%package -n libbcc -Summary: Shared Library for BPF Compiler Collection (BCC) -%description -n libbcc -Shared Library for BPF Compiler Collection (BCC) - -%package -n libbcc-examples -Summary: Examples for BPF Compiler Collection (BCC) -%description -n libbcc-examples -Examples for BPF Compiler Collection (BCC) - -%package -n python-bcc -Summary: Python bindings for BPF Compiler Collection (BCC) -%description -n python-bcc -Python bindings for BPF Compiler Collection (BCC) - -%files -n python-bcc -%{python_sitelib}/bcc* -%exclude %{python_sitelib}/*.egg-info - -%files -n libbcc -/usr/lib64/* -/usr/include/bcc/* - -%files -n libbcc-examples -/usr/share/bcc/examples/* diff --git a/SPECS/bcc.spec b/SPECS/bcc.spec index 08e13feb..8937def3 100644 --- a/SPECS/bcc.spec +++ b/SPECS/bcc.spec @@ -1,8 +1,8 @@ %define debug_package %{nil} Name: bcc -Version: 0.1.7 -Release: 1%{?dist} +Version: @REVISION@ +Release: @GIT_REV_COUNT@ Summary: BPF Compiler Collection (BCC) Group: Development/Languages @@ -26,7 +26,7 @@ userspace. mkdir build pushd build cmake .. -DREVISION_LAST=%{version} -DREVISION=%{version} -DCMAKE_INSTALL_PREFIX=/usr -make -j`grep -c ^process /proc/cpuinfo` +make %{?_smp_mflags} popd %install diff --git a/scripts/build-release-rpm.sh b/scripts/build-release-rpm.sh new file mode 100755 index 00000000..26a039a4 --- /dev/null +++ b/scripts/build-release-rpm.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -x +set -e + +TMP=$(mktemp -d /tmp/rpmbuild.XXXXXX) + +function cleanup() { + [[ -d $TMP ]] && rm -rf $TMP +} +trap cleanup EXIT + +mkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + +llvmver=3.7.1 +# only the most recent tag +git_tag_latest=$(git describe --abbrev=0) +git_rev_count=$(git rev-list $git_tag_latest.. --count) +release=0 +if [[ "$git_rev_count" != "0" ]]; then + release=$(git log --pretty='g%h' -n 1) +fi +revision=${git_tag_latest:1} + +git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/SOURCES/$git_tag_latest.tar.gz +wget -P $TMP/SOURCES http://llvm.org/releases/$llvmver/{cfe,llvm}-$llvmver.src.tar.xz + +sed \ + -e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \ + -e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \ + SPECS/bcc+clang.spec > $TMP/SPECS/bcc.spec + +pushd $TMP +rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec +popd + +cp $TMP/RPMS/*/*.rpm . +cp $TMP/SRPMS/*.rpm . diff --git a/scripts/build-rpm.sh b/scripts/build-rpm.sh index 1f8728b6..a6678fdf 100755 --- a/scripts/build-rpm.sh +++ b/scripts/build-rpm.sh @@ -11,8 +11,24 @@ function cleanup() { trap cleanup EXIT mkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + +llvmver=3.7.1 +# only the most recent tag +git_tag_latest=$(git describe --abbrev=0) +git_rev_count=$(git rev-list $git_tag_latest.. --count) +release=0 +if [[ "$git_rev_count" != "0" ]]; then + release=$(git log --pretty='g%h' -n 1) +fi +revision=${git_tag_latest:1} + git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/SOURCES/bcc.tar.gz -cp SPECS/bcc.spec $TMP/SPECS/ + +sed \ + -e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \ + -e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \ + SPECS/bcc.spec > $TMP/SPECS/bcc.spec + pushd $TMP rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec popd -- 2.30.9