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