github.com/fafucoder/cilium@v1.6.11/contrib/packaging/rpm/cilium.spec.envsubst (about)

     1  # vim:set ft=spec et:
     2  
     3  %if 0%{?fedora} || 0%{?rhel} == 6
     4  # Not all devel deps exist in Fedora so you can't
     5  # install the devel rpm so we need to build without
     6  # devel or unit_test for now
     7  # Generate devel rpm
     8  %global with_devel 1
     9  # Build project from bundled dependencies
    10  %global with_bundled 1
    11  # Build with debug info rpm
    12  %global with_debug 0
    13  # Run tests in check section
    14  %global with_check 1
    15  # Generate unit-test rpm
    16  %global with_unit_test 0
    17  %else
    18  %global with_devel 1
    19  %global with_bundled 1
    20  %global with_debug 0
    21  %global with_check 0
    22  %global with_unit_test 0
    23  %endif
    24  
    25  # https://fedoraproject.org/wiki/PackagingDrafts/Go#Debuginfo
    26  # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
    27  %if 0%{?with_debug}
    28  %global _dwz_low_mem_die_limit 0
    29  %else
    30  %global debug_package   %{nil}
    31  %endif
    32  
    33  %global provider        github
    34  %global provider_tld    com
    35  %global project         cilium
    36  %global repo            cilium
    37  # https://github.com/cilium/cilium
    38  %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
    39  %global import_path     %{provider_prefix}
    40  %global commit0         ${COMMIT}
    41  %global shortcommit0    %(c=%{commit0}; echo ${c:0:7})
    42  
    43  Name:          cilium
    44  Version:       ${VERSION}
    45  Release:       ${RELEASE}.git%{shortcommit0}%{?dist}
    46  Summary:       BPF & XDP for containers
    47  License:       Apache
    48  URL:           https://%{provider_prefix}
    49  Source0:       https://%{provider_prefix}/archive/%{commit0}/%{repo}-%{shortcommit0}.tar.gz
    50  
    51  ExclusiveArch: x86_64
    52  
    53  Requires:      git
    54  Requires:      llvm
    55  Requires:      docker-engine >= 1.12, glibc-devel(x86-32), iproute >= 4.10, clang
    56  %{?fc25:Requires: clang >= 5.0}
    57  
    58  # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
    59  BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
    60  
    61  BuildRequires: golang
    62  BuildRequires: go-bindata
    63  BuildRequires: glibc-devel(x86-32)
    64  BuildRequires: cmake
    65  BuildRequires: bazel
    66  BuildRequires: ninja-build
    67  BuildRequires: systemd
    68  BuildRequires: gcc-c++
    69  BuildRequires: elfutils-libelf-devel
    70  BuildRequires: libstdc++-static
    71  BuildRequires: libtool
    72  BuildRequires: wget
    73  
    74  %description
    75  Cilium provides fast in-kernel networking and security policy enforcement
    76  for containers based on eBPF programs generated on the fly. It is an
    77  experimental project aiming at enabling emerging kernel technologies such
    78  as BPF and XDP for containers.
    79  
    80  %pre
    81  getent group cilium >/dev/null || groupadd -f -r cilium
    82  exit 0
    83  
    84  %prep
    85  %setup -q -n %{name}-%{commit0}
    86  
    87  %build
    88  mkdir -p src/github.com/cilium
    89  ln -s ../../../ src/%{import_path}
    90  
    91  mkdir -p vendor/src
    92  for v in vendor/*; do
    93      test -z "$v" -o "$v" = "vendor/src" && continue
    94      if test -d "$v"; then
    95          mv -fv "$v" vendor/src/
    96      fi
    97  done
    98  
    99  %if ! 0%{?with_bundled}
   100  rm -rf vendor/
   101  export GOPATH=$(pwd):%{gopath}
   102  %else
   103  export GOPATH=$(pwd):$(pwd)/vendor:%{gopath}
   104  %endif
   105  
   106  echo "%{version}.%{release}" > VERSION
   107  
   108  export PKG_BUILD=1
   109  
   110  make -C daemon apply-bindata
   111  make V=1 proxylib plugins bpf cilium daemon monitor cilium-health bugtool tools operator
   112  
   113  %install
   114  export PKG_BUILD=1
   115  
   116  %{__make} DESTDIR=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} install
   117  
   118  cp envoy/cilium-envoy %{buildroot}%{_bindir}
   119  
   120  mkdir -p %{buildroot}%{_unitdir}
   121  mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
   122  mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
   123  
   124  cp contrib/systemd/*.service %{buildroot}%{_unitdir}
   125  cp contrib/systemd/*.mount %{buildroot}%{_unitdir}
   126  chmod 644 %{buildroot}%{_unitdir}/*.{service,mount}
   127  
   128  cp contrib/systemd/cilium %{buildroot}%{_sysconfdir}/sysconfig
   129  chmod 644 %{buildroot}%{_sysconfdir}/sysconfig/cilium
   130  
   131  exec %{buildroot}/%{_bindir}/cilium completion > \
   132       %{buildroot}/%{_sysconfdir}/bash_completion.d/cilium
   133  
   134  %files
   135  %{_sysconfdir}/bash_completion.d/cilium
   136  %{_sysconfdir}/cni/net.d/05-cilium-cni.conf
   137  %{_sysconfdir}/sysconfig/cilium
   138  %{_unitdir}/cilium-consul.service
   139  %{_unitdir}/cilium-docker.service
   140  %{_unitdir}/cilium-etcd.service
   141  %{_unitdir}/cilium.service
   142  %{_unitdir}/sys-fs-bpf.mount
   143  %{_libdir}/libcilium.so
   144  /opt/cni/bin/cilium-cni
   145  %{_bindir}/cilium
   146  %{_bindir}/cilium-agent
   147  %{_bindir}/cilium-docker
   148  %{_bindir}/cilium-node-monitor
   149  %{_bindir}/cilium-bugtool
   150  %{_bindir}/cilium-health
   151  %{_bindir}/cilium-envoy
   152  %{_bindir}/cilium-map-migrate
   153  %{_bindir}/cilium-ring-dump
   154  %{_bindir}/cilium-operator
   155  
   156  %changelog
   157  * Thu Mar 29 2018 Tony Lambiris <tony@criticalstack.com> - 1.0.0rc8-0.git${SHORTCOMMIT}
   158  - Added cilium-envoy and cilium-map-migrate to %files
   159  
   160  * Wed Dec 20 2017 Tony Lambiris <tony@criticalstack.com> - 0.13.90-0.git${SHORTCOMMIT}
   161  - Added cilium-bugtool, cilium-bugtool and sys-fs-bpf.mount to %files
   162  
   163  * Thu Mar 23 2017 Marcin Skarbek <rpm@skarbek.name> - 0.1.0-0.git${SHORTCOMMIT}
   164  - Updated spec file
   165  
   166  * Wed Oct 12 2016 Andre Martins <andre@cilium.io> - 0.1.0-0
   167  - Initial version of the package