Skip to content

Commit

Permalink
Add RPM packaging for el6,el7,fedora22
Browse files Browse the repository at this point in the history
Signed-off-by: Brenden Blanco <[email protected]>
  • Loading branch information
Brenden Blanco committed Sep 1, 2015
1 parent f52dc88 commit 3965a36
Show file tree
Hide file tree
Showing 16 changed files with 644 additions and 58 deletions.
24 changes: 0 additions & 24 deletions Dockerfile.centos6

This file was deleted.

21 changes: 0 additions & 21 deletions Dockerfile.fedora

This file was deleted.

21 changes: 21 additions & 0 deletions SPECS/Dockerfile.el6
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

FROM centos:6

MAINTAINER Brenden Blanco <[email protected]>

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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget http:https://llvm.org/pre-releases/3.7.0/rc3/cfe-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.5.tar.gz

RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.5/SPECS/bcc.el6.spec
#COPY SPECS/bcc.el6.spec SPECS/

RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el6.spec
21 changes: 21 additions & 0 deletions SPECS/Dockerfile.el6.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

FROM centos:6

MAINTAINER Brenden Blanco <[email protected]>

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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget http:https://llvm.org/pre-releases/3.7.0/rc3/cfe-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@[email protected]

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
19 changes: 19 additions & 0 deletions SPECS/Dockerfile.el7
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

FROM centos:7

MAINTAINER Brenden Blanco <[email protected]>

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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget http:https://llvm.org/pre-releases/3.7.0/rc3/cfe-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.5.tar.gz

RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.5/SPECS/bcc.el7.spec
#COPY SPECS/bcc.el7.spec SPECS/

RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.el7.spec
19 changes: 19 additions & 0 deletions SPECS/Dockerfile.el7.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

FROM centos:7

MAINTAINER Brenden Blanco <[email protected]>

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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget http:https://llvm.org/pre-releases/3.7.0/rc3/cfe-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@[email protected]

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
20 changes: 20 additions & 0 deletions SPECS/Dockerfile.f22
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

FROM fedora:22

MAINTAINER Brenden Blanco <[email protected]>

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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget http:https://llvm.org/pre-releases/3.7.0/rc3/cfe-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v0.1.5.tar.gz

RUN cd SPECS && wget https://raw.githubusercontent.com/iovisor/bcc/v0.1.5/SPECS/bcc.f22.spec
#COPY SPECS/bcc.f22.spec SPECS/

RUN rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.f22.spec
20 changes: 20 additions & 0 deletions SPECS/Dockerfile.f22.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

FROM fedora:22

MAINTAINER Brenden Blanco <[email protected]>

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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget http:https://llvm.org/pre-releases/3.7.0/rc3/cfe-3.7.0rc3.src.tar.xz
RUN cd SOURCES && wget https://github.com/iovisor/bcc/archive/v@[email protected]

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
115 changes: 115 additions & 0 deletions SPECS/bcc.el6.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

%define debug_package %{nil}
%define llvmver 3.7.0rc3
%define gccver 5.1.0
%define pythonver 2.7.10

Name: bcc
Version: 0.1.5
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:https://llvm.org/pre-releases/3.7.0/rc3/llvm-%{llvmver}.src.tar.xz
Source4: http:https://llvm.org/pre-releases/3.7.0/rc3/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 <[email protected]> - 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-bpf
Summary: Python bindings for BPF Compiler Collection (BCC)
%description -n python-bpf
Python bindings for BPF Compiler Collection (BCC)

%files -n python-bpf
%{python_sitelib}/bpf*
%exclude %{python_sitelib}/*.egg-info
/usr/bin/bpf-run

%files -n libbcc
/usr/lib64/*
/usr/share/bcc/include/*
/usr/include/bcc/*

%files -n libbcc-examples
/usr/share/bcc/examples/*
Loading

0 comments on commit 3965a36

Please sign in to comment.