Thomas F Herbert | 4b0ac82 | 2017-08-29 16:07:51 -0400 | [diff] [blame] | 1 | %bcond_without aesni |
Renato Botelho do Couto | e266ea3 | 2017-11-30 15:41:22 -0600 | [diff] [blame] | 2 | %{!?_topdir:%define _topdir %(pwd)} |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 3 | %define _vpp_build_dir build-tool-native |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 4 | %define _unitdir /lib/systemd/system |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 5 | %define _builddir %{_topdir} |
Thomas F Herbert | b42b77b | 2018-04-06 15:13:41 -0400 | [diff] [blame] | 6 | %define _mu_build_dir %{_topdir}/%{name}-%{_version}/build-root |
Igor Mikhailov (imichail) | c442e61 | 2017-05-18 19:46:17 -0700 | [diff] [blame] | 7 | %define _vpp_tag %{getenv:TAG} |
| 8 | %if "%{_vpp_tag}" == "" |
| 9 | %define _vpp_tag vpp |
| 10 | %endif |
| 11 | %define _vpp_install_dir install-%{_vpp_tag}-native |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 12 | |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 13 | # Failsafe backport of Python2-macros for RHEL <= 6 |
| 14 | %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} |
| 15 | %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} |
| 16 | %{!?python_version: %global python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")} |
| 17 | %{!?__python2: %global __python2 %{__python}} |
| 18 | %{!?python2_sitelib: %global python2_sitelib %{python_sitelib}} |
| 19 | %{!?python2_sitearch: %global python2_sitearch %{python_sitearch}} |
| 20 | %{!?python2_version: %global python2_version %{python_version}} |
| 21 | |
| 22 | %{!?python2_minor_version: %define python2_minor_version %(%{__python} -c "import sys ; print sys.version[2:3]")} |
| 23 | |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 24 | %{?systemd_requires} |
| 25 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 26 | |
| 27 | # SELinux Related definitions |
| 28 | %global selinuxtype targeted |
| 29 | %global moduletype services |
| 30 | %global modulenames vpp-custom |
| 31 | |
| 32 | # Usage: _format var format |
| 33 | # Expand 'modulenames' into various formats as needed |
| 34 | # Format must contain '$x' somewhere to do anything useful |
| 35 | %global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done; |
| 36 | |
| 37 | # Relabel files |
| 38 | %global relabel_files() \ # ADD files in *.fc file |
| 39 | |
| 40 | # Version of distribution SELinux policy package |
| 41 | %global selinux_policyver 3.13.1-128.6.fc22 |
| 42 | |
| 43 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 44 | Name: vpp |
| 45 | Summary: Vector Packet Processing |
Billy McFall | f6e3ad0 | 2017-07-05 09:33:30 -0400 | [diff] [blame] | 46 | License: ASL 2.0 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 47 | Version: %{_version} |
| 48 | Release: %{_release} |
Damjan Marion | a1bd023 | 2016-12-19 19:08:11 +0100 | [diff] [blame] | 49 | BuildRequires: systemd, chrpath |
Thomas F Herbert | e412891 | 2017-10-09 15:03:55 -0400 | [diff] [blame] | 50 | BuildRequires: check, check-devel |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 51 | BuildRequires: mbedtls-devel mbedtls |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 52 | %if 0%{?fedora} |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 53 | Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 54 | Requires: compat-openssl10 |
| 55 | Requires: boost-filesystem mbedtls libffi-devel |
Thomas F Herbert | 6673178 | 2018-03-05 17:21:56 -0500 | [diff] [blame] | 56 | BuildRequires: subunit, subunit-devel |
Thomas F Herbert | 440751b | 2017-09-11 08:58:23 -0400 | [diff] [blame] | 57 | BuildRequires: compat-openssl10-devel |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 58 | BuildRequires: python, python-devel, python-virtualenv, python-ply |
| 59 | BuildRequires: python3, python36-devel, python3-virtualenv |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 60 | BuildRequires: cmake |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 61 | %else |
Renato Botelho do Couto | c025329 | 2019-11-07 06:10:34 -0600 | [diff] [blame] | 62 | %if 0%{rhel} >= 7 |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 63 | Requires: epel-release |
| 64 | Requires: vpp-lib = %{_version}-%{_release}, vpp-selinux-policy = %{_version}-%{_release}, net-tools, pciutils, python36 |
| 65 | Requires: boost-filesystem mbedtls libffi-devel |
| 66 | BuildRequires: epel-release |
| 67 | BuildRequires: mbedtls-devel mbedtls |
Thomas F Herbert | 440751b | 2017-09-11 08:58:23 -0400 | [diff] [blame] | 68 | BuildREquires: openssl-devel |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 69 | BuildRequires: python36-devel |
Renato Botelho do Couto | c025329 | 2019-11-07 06:10:34 -0600 | [diff] [blame] | 70 | %if 0%{rhel} == 7 |
| 71 | BuildRequires: devtoolset-7-toolchain |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 72 | BuildRequires: cmake3 |
Renato Botelho do Couto | c025329 | 2019-11-07 06:10:34 -0600 | [diff] [blame] | 73 | BuildRequires: glibc-static, yum-utils |
| 74 | %else |
| 75 | BuildRequires: cmake |
| 76 | BuildRequires: dnf-utils |
| 77 | %endif |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 78 | %endif |
| 79 | %endif |
Thomas F Herbert | 440751b | 2017-09-11 08:58:23 -0400 | [diff] [blame] | 80 | BuildRequires: libffi-devel |
Renato Botelho do Couto | c025329 | 2019-11-07 06:10:34 -0600 | [diff] [blame] | 81 | BuildRequires: redhat-lsb |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 82 | BuildRequires: apr-devel |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 83 | BuildRequires: numactl-devel |
| 84 | BuildRequires: autoconf automake libtool byacc bison flex |
Neale Ranns | 2ea2e42 | 2017-11-07 05:20:16 -0800 | [diff] [blame] | 85 | BuildRequires: boost boost-devel |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 86 | BuildRequires: selinux-policy selinux-policy-devel |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 87 | |
Thomas F Herbert | b60f496 | 2017-07-19 19:17:15 -0400 | [diff] [blame] | 88 | Source: %{name}-%{_version}-%{_release}.tar.xz |
| 89 | # Source: vpp-latest.tar.xz |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 90 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 91 | %description |
Damjan Marion | 08ff7e0 | 2016-01-20 13:45:36 +0100 | [diff] [blame] | 92 | This package provides VPP executables: vpp, vpp_api_test, vpp_json_test |
| 93 | vpp - the vector packet engine |
| 94 | vpp_api_test - vector packet engine API test tool |
| 95 | vpp_json_test - vector packet engine JSON test tool |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 96 | |
| 97 | %package lib |
| 98 | Summary: VPP libraries |
| 99 | Group: System Environment/Libraries |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 100 | Requires: vpp-selinux-policy = %{_version}-%{_release} |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 101 | |
| 102 | %description lib |
| 103 | This package contains the VPP shared libraries, including: |
| 104 | vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 105 | svm - vm library |
| 106 | vlib - vector processing library |
| 107 | vlib-api - binary API library |
| 108 | vnet - network stack library |
| 109 | |
| 110 | %package devel |
| 111 | Summary: VPP header files, static libraries |
| 112 | Group: Development/Libraries |
| 113 | Requires: vpp-lib |
| 114 | |
| 115 | %description devel |
Thomas F Herbert | 3977a21 | 2016-10-01 18:09:33 -0400 | [diff] [blame] | 116 | This package contains the header files for VPP. |
| 117 | Install this package if you want to write a |
| 118 | program for compilation and linking with vpp lib. |
| 119 | vlib |
| 120 | vlibmemory |
| 121 | vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc. |
| 122 | vpp-api |
| 123 | vppinfra |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 124 | |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 125 | %package plugins |
| 126 | Summary: Vector Packet Processing--runtime plugins |
| 127 | Group: System Environment/Libraries |
Gabriel Ganne | bf246df | 2018-01-18 11:00:17 +0100 | [diff] [blame] | 128 | Requires: vpp = %{_version}-%{_release} numactl-libs |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 129 | %description plugins |
| 130 | This package contains VPP plugins |
| 131 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 132 | %package api-lua |
| 133 | Summary: VPP api lua bindings |
| 134 | Group: Development/Libraries |
| 135 | Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release} |
| 136 | |
| 137 | %description api-lua |
| 138 | This package contains the lua bindings for the vpp api |
| 139 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 140 | %package api-python |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 141 | Summary: VPP api python bindings |
| 142 | Group: Development/Libraries |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 143 | Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}, libffi-devel |
| 144 | Requires: python-setuptools |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 145 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 146 | %description api-python |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 147 | This package contains the python bindings for the vpp api |
| 148 | |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 149 | %package api-python3 |
| 150 | Summary: VPP api python3 bindings |
| 151 | Group: Development/Libraries |
| 152 | Requires: vpp = %{_version}-%{_release}, vpp-lib = %{_version}-%{_release}, libffi-devel |
| 153 | Requires: python-setuptools |
| 154 | |
| 155 | %description api-python3 |
| 156 | This package contains the python3 bindings for the vpp api |
| 157 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 158 | %package selinux-policy |
| 159 | Summary: VPP Security-Enhanced Linux (SELinux) policy |
| 160 | Group: System Environment/Base |
Renato Botelho do Couto | 1d94ab5 | 2020-03-06 13:42:22 -0600 | [diff] [blame] | 161 | Requires(post): selinux-policy-base >= %{selinux_policyver}, selinux-policy-targeted >= %{selinux_policyver}, policycoreutils, libselinux-utils |
| 162 | %if 0%{rhel} < 8 |
| 163 | Requires(post): policycoreutils-python |
| 164 | %else |
| 165 | Requires(post): python3-policycoreutils |
| 166 | %endif |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 167 | |
| 168 | %description selinux-policy |
| 169 | This package contains a tailored VPP SELinux policy |
| 170 | |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 171 | %prep |
Thomas F Herbert | b42b77b | 2018-04-06 15:13:41 -0400 | [diff] [blame] | 172 | %setup -q -n %{name}-%{_version} |
Thomas F Herbert | 20a29c7 | 2016-10-13 18:36:50 -0400 | [diff] [blame] | 173 | |
Ed Warnicke | ec6290a | 2016-06-08 17:15:08 -0500 | [diff] [blame] | 174 | %pre |
| 175 | # Add the vpp group |
Ed Warnicke | b10427e | 2016-06-08 19:49:40 -0500 | [diff] [blame] | 176 | groupadd -f -r vpp |
Ed Warnicke | ec6290a | 2016-06-08 17:15:08 -0500 | [diff] [blame] | 177 | |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 178 | %build |
Renato Botelho do Couto | c025329 | 2019-11-07 06:10:34 -0600 | [diff] [blame] | 179 | %if 0%{rhel} < 8 |
Thomas F Herbert | 6eb6163 | 2018-11-27 15:57:30 -0500 | [diff] [blame] | 180 | . /opt/rh/devtoolset-7/enable |
| 181 | %endif |
Thomas F Herbert | 4b0ac82 | 2017-08-29 16:07:51 -0400 | [diff] [blame] | 182 | %if %{with aesni} |
| 183 | make bootstrap |
| 184 | make -C build-root PLATFORM=vpp TAG=%{_vpp_tag} install-packages |
| 185 | %else |
| 186 | make bootstrap AESNI=n |
| 187 | make -C build-root PLATFORM=vpp AESNI=n TAG=%{_vpp_tag} install-packages |
| 188 | %endif |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 189 | cd %{_mu_build_dir}/../src/vpp-api/python && %py2_build |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 190 | cd %{_mu_build_dir}/../src/vpp-api/python && %py3_build |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 191 | cd %{_mu_build_dir}/../extras/selinux && make -f %{_datadir}/selinux/devel/Makefile |
Ole Troan | c60f557 | 2017-03-17 09:54:51 +0100 | [diff] [blame] | 192 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 193 | %install |
| 194 | # |
| 195 | # binaries |
| 196 | # |
| 197 | mkdir -p -m755 %{buildroot}%{_bindir} |
| 198 | mkdir -p -m755 %{buildroot}%{_unitdir} |
Gabriel Ganne | 714968b | 2017-01-26 15:42:39 +0100 | [diff] [blame] | 199 | install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/bin/* %{buildroot}%{_bindir} |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 200 | |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 201 | # api |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 202 | mkdir -p -m755 %{buildroot}/usr/share/vpp/api |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 203 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 204 | # |
| 205 | # configs |
| 206 | # |
| 207 | mkdir -p -m755 %{buildroot}/etc/vpp |
Miroslav Miklus | 8e08e74 | 2016-10-11 13:35:26 +0200 | [diff] [blame] | 208 | mkdir -p -m755 %{buildroot}/etc/sysctl.d |
Thomas F Herbert | 5b75b6b | 2017-07-23 17:21:46 -0400 | [diff] [blame] | 209 | install -p -m 644 %{_mu_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir} |
Damjan Marion | d0f673e | 2017-01-31 17:29:33 +0100 | [diff] [blame] | 210 | install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/startup.conf %{buildroot}/etc/vpp/startup.conf |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 211 | install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 212 | # |
| 213 | # libraries |
| 214 | # |
| 215 | mkdir -p -m755 %{buildroot}%{_libdir} |
Padraig Connolly | 69915cb | 2017-01-10 17:10:39 +0000 | [diff] [blame] | 216 | mkdir -p -m755 %{buildroot}/etc/bash_completion.d |
| 217 | mkdir -p -m755 %{buildroot}/usr/share/vpp |
Matthew Smith | d790c7e | 2018-09-06 10:59:49 -0500 | [diff] [blame] | 218 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 219 | do |
| 220 | install -p -m 755 $file %{buildroot}%{_libdir} |
| 221 | done |
| 222 | for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///') |
| 223 | do |
| 224 | # make lib symlinks |
| 225 | ( cd %{buildroot}%{_libdir} && |
| 226 | ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') ) |
Ed Warnicke | f5a0e73 | 2016-09-07 17:12:52 +0000 | [diff] [blame] | 227 | ( cd %{buildroot}%{_libdir} && |
| 228 | ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 229 | done |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 230 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api -type f -name '*.api.json' -print ) |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 231 | do |
| 232 | install -p -m 644 $file %{buildroot}/usr/share/vpp/api |
| 233 | done |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 234 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 235 | # Lua bindings |
| 236 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/cli |
| 237 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/lute |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 238 | # for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .) |
| 239 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && find . -type f -regex '.*/*.[luteamd]' -print | sed -e 's/^\.\///') |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 240 | do |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 241 | ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/vpp-api/lua && install -p -m 644 $file \ |
| 242 | %{buildroot}/usr/share/doc/vpp/examples/lua/$file ) |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 243 | done |
| 244 | |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 245 | # Python bindings |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 246 | cd %{_mu_build_dir}/../src/vpp-api/python && %py2_install |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 247 | cd %{_mu_build_dir}/../src/vpp-api/python && %py3_install |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 248 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 249 | # SELinux Policy |
| 250 | # Install SELinux interfaces |
| 251 | %_format INTERFACES %{_mu_build_dir}/../extras/selinux/$x.if |
| 252 | install -d %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} |
| 253 | install -p -m 644 $INTERFACES \ |
| 254 | %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype} |
| 255 | |
| 256 | # Install policy modules |
| 257 | %_format MODULES %{_mu_build_dir}/../extras/selinux/$x.pp |
| 258 | install -d %{buildroot}%{_datadir}/selinux/packages |
| 259 | install -m 0644 $MODULES \ |
| 260 | %{buildroot}%{_datadir}/selinux/packages |
| 261 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 262 | # |
| 263 | # devel |
| 264 | # |
Benoît Ganne | f0917bd | 2019-05-14 11:11:16 +0200 | [diff] [blame] | 265 | for dir in %{_mu_build_dir}/%{_vpp_install_dir}/{vom,vpp}/include/ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 266 | do |
| 267 | for subdir in $(cd ${dir} && find . -type d -print) |
| 268 | do |
| 269 | mkdir -p -m755 %{buildroot}/usr/include/${subdir} |
| 270 | done |
| 271 | for file in $(cd ${dir} && find . -type f -print) |
| 272 | do |
| 273 | install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file |
| 274 | done |
| 275 | done |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 276 | |
Paul Vinciguerra | 9ce6a21 | 2018-09-12 13:40:13 -0700 | [diff] [blame] | 277 | install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/vppapigen_c.py %{buildroot}/usr/share/vpp |
| 278 | install -p -m 644 %{_mu_build_dir}/../src/tools/vppapigen/vppapigen_json.py %{buildroot}/usr/share/vpp |
Jon Loeliger | 190282c | 2018-01-31 09:45:11 -0600 | [diff] [blame] | 279 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 280 | # sample plugin |
| 281 | mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/sample |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 282 | #for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && git ls-files .) |
| 283 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && find . -type f -regex '.*/*.[acdhimp]' -print | sed -e 's/^\.\///') |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 284 | do |
Thomas F Herbert | bd8e242 | 2017-08-03 11:04:24 -0400 | [diff] [blame] | 285 | ( cd %{_mu_build_dir}/%{_vpp_install_dir}/../../src/examples/sample-plugin && install -p -m 644 $file \ |
| 286 | %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/$file ) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 287 | done |
| 288 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 289 | # vppctl sockfile directory |
| 290 | mkdir -p -m755 %{buildroot}%{_localstatedir}/run/vpp |
| 291 | # vpp.log directory |
| 292 | mkdir -p -m755 %{buildroot}%{_localstatedir}/log/vpp |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 293 | |
| 294 | # |
| 295 | # vpp-plugins |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 296 | # |
Ed Warnicke | e7637e7 | 2016-09-14 16:58:33 -0700 | [diff] [blame] | 297 | mkdir -p -m755 %{buildroot}/usr/lib/vpp_plugins |
| 298 | mkdir -p -m755 %{buildroot}/usr/lib/vpp_api_test_plugins |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 299 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_plugins && find -type f -print) |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 300 | do |
Matthew Smith | 4ed0039 | 2019-03-05 09:28:48 -0600 | [diff] [blame] | 301 | install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_plugins/$file \ |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 302 | %{buildroot}/usr/lib/vpp_plugins/$file |
| 303 | done |
| 304 | |
Damjan Marion | 79dcbc7 | 2018-09-12 14:01:10 +0200 | [diff] [blame] | 305 | for file in $(cd %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_api_test_plugins && find -type f -print) |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 306 | do |
Matthew Smith | 4ed0039 | 2019-03-05 09:28:48 -0600 | [diff] [blame] | 307 | install -p -m 755 %{_mu_build_dir}/%{_vpp_install_dir}/vpp/lib/vpp_api_test_plugins/$file \ |
Damjan Marion | 7cd468a | 2016-12-19 23:05:39 +0100 | [diff] [blame] | 308 | %{buildroot}/usr/lib/vpp_api_test_plugins/$file |
| 309 | done |
| 310 | |
Mohsin Kazmi | 7b2017d | 2018-09-26 10:49:41 +0200 | [diff] [blame] | 311 | for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print ) |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 312 | do |
Matthew Smith | 4ed0039 | 2019-03-05 09:28:48 -0600 | [diff] [blame] | 313 | install -p -m 755 $file %{buildroot}/usr/share/vpp/api |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 314 | done |
| 315 | |
Damjan Marion | a1bd023 | 2016-12-19 19:08:11 +0100 | [diff] [blame] | 316 | # |
| 317 | # remove RPATH from ELF binaries |
| 318 | # |
| 319 | %{_mu_build_dir}/scripts/remove-rpath %{buildroot} |
| 320 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 321 | %post |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 322 | if [ $1 -eq 1 ] ; then |
| 323 | sysctl --system |
| 324 | fi |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 325 | %systemd_post vpp.service |
| 326 | |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 327 | %preun |
| 328 | %systemd_preun vpp.service |
| 329 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 330 | %post selinux-policy |
| 331 | %_format MODULES %{_datadir}/selinux/packages/$x.pp |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 332 | if %{_sbindir}/selinuxenabled ; then |
Matthew Smith | 7c172cb | 2018-02-22 21:12:11 -0600 | [diff] [blame] | 333 | %{_sbindir}/semodule -n -X 400 -s %{selinuxtype} -i $MODULES |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 334 | %{_sbindir}/load_policy |
| 335 | %relabel_files |
| 336 | fi |
| 337 | |
| 338 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 339 | %postun |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 340 | %systemd_postun |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 341 | if [ $1 -eq 0 ] ; then |
| 342 | echo "Uninstalling, unbind user-mode PCI drivers" |
| 343 | # Unbind user-mode PCI drivers |
| 344 | removed= |
| 345 | pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci` |
| 346 | for d in $pci_dirs; do |
| 347 | for f in ${d}/*; do |
| 348 | [ -e "${f}/config" ] || continue |
| 349 | echo ${f##*/} > ${d}/unbind |
| 350 | basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}` |
| 351 | removed=y |
| 352 | done |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 353 | done |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 354 | if [ -n "${removed}" ]; then |
| 355 | echo "There are changes in PCI drivers, rescaning" |
| 356 | echo 1 > /sys/bus/pci/rescan |
| 357 | else |
| 358 | echo "There weren't PCI devices binded" |
| 359 | fi |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 360 | else |
Kristina Nevolnikova | 8ae1873 | 2017-06-21 14:20:42 +0200 | [diff] [blame] | 361 | echo "Upgrading package, dont' unbind interfaces" |
Peter Ginchev | dfa9c5b | 2016-10-11 15:34:24 +0300 | [diff] [blame] | 362 | fi |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 363 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 364 | %postun selinux-policy |
| 365 | if [ $1 -eq 0 ]; then |
| 366 | %{_sbindir}/semodule -n -r %{modulenames} |
| 367 | if %{_sbindir}/selinuxenabled ; then |
| 368 | %{_sbindir}/load_policy |
| 369 | %relabel_files |
| 370 | fi |
| 371 | fi |
| 372 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 373 | %files |
| 374 | %defattr(-,bin,bin) |
| 375 | %{_unitdir}/vpp.service |
Damjan Marion | 08ff7e0 | 2016-01-20 13:45:36 +0100 | [diff] [blame] | 376 | /usr/bin/vpp* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 377 | /usr/bin/svm* |
Dave Barach | 0e5e3c3 | 2016-01-25 08:28:22 -0500 | [diff] [blame] | 378 | /usr/bin/elftool |
Billy McFall | ce41a5c | 2017-09-08 20:11:58 +0000 | [diff] [blame] | 379 | %config(noreplace) /etc/sysctl.d/80-vpp.conf |
| 380 | %config(noreplace) /etc/vpp/startup.conf |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 381 | /usr/share/vpp/api/* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 382 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 383 | %defattr(-,root,vpp) |
| 384 | %{_localstatedir}/run/vpp* |
| 385 | |
| 386 | %defattr(-,root,root) |
| 387 | %{_localstatedir}/log/vpp* |
| 388 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 389 | %files lib |
| 390 | %defattr(-,bin,bin) |
Igor Mikhailov (imichail) | 3b854a5 | 2018-05-18 20:08:26 -0700 | [diff] [blame] | 391 | %global __requires_exclude_from %{_libdir}/librte_pmd_mlx[45]_glue\\.so.*$ |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 392 | %exclude %{_libdir}/vpp_plugins |
| 393 | %exclude %{_libdir}/vpp_api_test_plugins |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 394 | %{_libdir}/* |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 395 | /usr/share/vpp/api/* |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 396 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 397 | %files api-lua |
Gabriel Ganne | f3854e9 | 2017-01-17 10:00:54 +0100 | [diff] [blame] | 398 | %defattr(644,root,root,644) |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 399 | /usr/share/doc/vpp/examples/lua |
| 400 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 401 | %files api-python |
Onong Tayeng | 9b0ce02 | 2018-11-23 15:33:41 +0530 | [diff] [blame] | 402 | %defattr(644,root,root,755) |
Ian Wells | 13cef0c | 2019-08-09 17:27:19 -0700 | [diff] [blame] | 403 | %{python2_sitelib}/vpp_* |
| 404 | |
| 405 | %files api-python3 |
| 406 | %defattr(644,root,root,755) |
Thomas F Herbert | ca3d38a | 2019-04-22 17:35:03 -0400 | [diff] [blame] | 407 | %{python3_sitelib}/vpp_* |
Ole Troan | 57c3d66 | 2016-09-12 22:00:32 +0200 | [diff] [blame] | 408 | |
Billy McFall | 28cf3b7 | 2018-01-15 17:54:52 -0500 | [diff] [blame] | 409 | %files selinux-policy |
| 410 | %defattr(-,root,root,0755) |
| 411 | %attr(0644,root,root) %{_datadir}/selinux/packages/*.pp |
| 412 | %attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/*.if |
| 413 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 414 | %files devel |
| 415 | %defattr(-,bin,bin) |
| 416 | /usr/bin/vppapigen |
Oliver Giles | dc20371 | 2019-12-05 23:37:36 +0200 | [diff] [blame] | 417 | /usr/bin/vapi_c_gen.py |
| 418 | /usr/bin/vapi_cpp_gen.py |
| 419 | /usr/bin/vapi_json_parser.py |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 420 | %{_includedir}/* |
| 421 | /usr/share/doc/vpp/examples/sample-plugin |
Ole Troan | 9d42087 | 2017-10-12 13:06:35 +0200 | [diff] [blame] | 422 | /usr/share/vpp |
Ed Warnicke | 406ab9d | 2016-08-31 18:48:47 -0700 | [diff] [blame] | 423 | |
Ed Warnicke | f5a1436 | 2016-09-12 20:40:24 +0000 | [diff] [blame] | 424 | %files plugins |
| 425 | %defattr(-,bin,bin) |
Ed Warnicke | e7637e7 | 2016-09-14 16:58:33 -0700 | [diff] [blame] | 426 | /usr/lib/vpp_plugins/* |
| 427 | /usr/lib/vpp_api_test_plugins/* |
Ole Troan | f14e3bf | 2016-12-01 21:49:03 +0100 | [diff] [blame] | 428 | /usr/share/vpp/api/* |