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