Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 1 | # |
| 2 | # spec file for package vpp |
| 3 | # |
| 4 | # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. |
| 5 | # |
Laszlo Kiraly | bf91b48 | 2022-04-06 16:25:32 +0200 | [diff] [blame] | 6 | # Copyright (c) 2022 Nordix Foundation. |
| 7 | # |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 8 | # All modifications and additions to the file contributed by third parties |
| 9 | # remain the property of their copyright owners, unless otherwise agreed |
| 10 | # upon. The license for this file, and modifications and additions to the |
| 11 | # file, is the same license as for the pristine package itself (unless the |
| 12 | # license for the pristine package is not an Open Source License, in which |
| 13 | # case the license is the MIT License). An "Open Source License" is a |
| 14 | # license that conforms to the Open Source Definition (Version 1.9) |
| 15 | # published by the Open Source Initiative. |
| 16 | |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 17 | %define _vpp_build_dir %{buildroot}/../../BUILD/vpp-%{version}/build-root |
| 18 | %define _vpp_install_dir %{_vpp_build_dir}/install-vpp-native/ |
| 19 | %define _vpp_plugins_lib_dir %{_vpp_install_dir}/vpp/lib64 |
| 20 | |
| 21 | %define lname libvpp0 |
| 22 | |
| 23 | Name: vpp |
| 24 | Version: %{_version} |
| 25 | Release: %{_release} |
| 26 | Summary: Set of libraries and drivers for fast packet processing |
| 27 | License: Apache-2.0 |
| 28 | Group: Productivity/Networking/Routing |
| 29 | Url: https://wiki.fd.io/view/VPP |
| 30 | Source0: %{name}-%{version}-%{_release}.tar.xz |
| 31 | BuildRequires: autoconf |
| 32 | BuildRequires: automake |
| 33 | BuildRequires: bison |
| 34 | BuildRequires: ccache |
Laszlo Kiraly | bf91b48 | 2022-04-06 16:25:32 +0200 | [diff] [blame] | 35 | BuildRequires: clang |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 36 | BuildRequires: check-devel |
| 37 | BuildRequires: chrpath |
| 38 | BuildRequires: distribution-release |
| 39 | BuildRequires: gcc |
| 40 | BuildRequires: gcc-c++ |
| 41 | BuildRequires: glibc-devel |
| 42 | BuildRequires: glibc-devel-static |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 43 | BuildRequires: libnuma-devel |
| 44 | BuildRequires: libopenssl-devel |
| 45 | BuildRequires: libtool |
| 46 | BuildRequires: lsb-release |
| 47 | BuildRequires: make |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 48 | BuildRequires: openssl-devel |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 49 | BuildRequires: python-rpm-macros |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 50 | BuildRequires: python3-devel |
| 51 | BuildRequires: python3-pip |
Laszlo Kiraly | 987318e | 2022-09-02 14:08:36 +0200 | [diff] [blame] | 52 | BuildRequires: python3-ply |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 53 | BuildRequires: shadow |
| 54 | Conflicts: otherproviders(vpp-any) |
| 55 | Provides: %{name}-any = %{version} |
| 56 | ExclusiveArch: x86_64 aarch64 |
| 57 | %if 0%{?suse_version} >= 1210 |
| 58 | BuildRequires: systemd-rpm-macros |
| 59 | %endif |
| 60 | |
| 61 | %description |
| 62 | The Vector Packet Processing platform is a framework that provides |
| 63 | switch/router functionality. It is based on Cisco's packet processing |
| 64 | stack that can run on commodity CPUs. |
| 65 | This package provides VPP executables: vpp, vpp_api_test, vpp_json_test |
| 66 | vpp - the vector packet engine |
| 67 | vpp_api_test - vector packet engine API test tool |
| 68 | vpp_json_test - vector packet engine JSON test tool |
| 69 | |
| 70 | %package -n %{lname} |
| 71 | Summary: VPP libraries |
| 72 | Group: System/Libraries |
| 73 | Provides: %{lname}-any = %{version} |
| 74 | |
| 75 | %description -n %{lname} |
| 76 | This package contains the VPP shared libraries, including: |
| 77 | vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting. |
| 78 | svm - vm library |
| 79 | vlib - vector processing library |
| 80 | vlib-api - binary API library |
| 81 | vnet - network stack library |
| 82 | |
| 83 | %package devel |
| 84 | Summary: VPP header files, static libraries |
| 85 | Group: Development/Libraries/C and C++ |
| 86 | Requires: %{lname} = %{version} |
| 87 | Conflicts: otherproviders(%{name}-any-devel) |
| 88 | Provides: %{name}-any-devel = %{version} |
| 89 | |
| 90 | %description devel |
| 91 | This package contains the header files for VPP. |
| 92 | Install this package if you want to write a |
| 93 | program for compilation and linking with vpp lib. |
| 94 | vlib |
| 95 | vlibmemory |
| 96 | vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc. |
| 97 | vpp-api |
| 98 | vppinfra |
| 99 | |
| 100 | %package plugins |
| 101 | Summary: Vector Packet Processing--runtime plugins |
| 102 | Group: Productivity/Networking/Routing |
| 103 | Conflicts: otherproviders(%{name}-any-plugins) |
| 104 | Provides: %{name}-any-plugins = %{version} |
| 105 | |
| 106 | %description plugins |
| 107 | This package contains the VPP plugins which are loaded by VPP at startup |
| 108 | |
| 109 | %package api-lua |
| 110 | Summary: VPP api lua bindings |
| 111 | Group: Development/Libraries/Other |
| 112 | Requires: %{lname} = %{version} |
| 113 | Requires: %{name} = %{version} |
| 114 | Requires: %{name}-devel = %{version} |
| 115 | Conflicts: otherproviders(%{name}-any-api-lua) |
| 116 | Provides: %{name}-any-api-lua = %{version} |
| 117 | |
| 118 | %description api-lua |
| 119 | This package contains the lua bindings for the vpp api |
| 120 | |
| 121 | %package api-python |
| 122 | Summary: VPP api python bindings |
| 123 | Group: Development/Libraries/Python |
| 124 | Requires: %{lname} = %{version} |
| 125 | Requires: %{name} = %{version} |
| 126 | Requires: %{name}-devel = %{version} |
Laszlo Kiraly | 987318e | 2022-09-02 14:08:36 +0200 | [diff] [blame] | 127 | Requires: python3-setuptools |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 128 | Conflicts: otherproviders(%{name}-any-python-api) |
| 129 | Provides: %{name}-any-python-api = %{version} |
| 130 | |
| 131 | %description api-python |
| 132 | This package contains the python bindings for the vpp api |
| 133 | |
| 134 | %prep |
| 135 | %setup -q -n %{name}-%{version} |
| 136 | |
| 137 | %build |
| 138 | export VPP_BUILD_USER=suse |
| 139 | export VPP_BUILD_HOST=SUSE |
| 140 | |
Laszlo Kiraly | bf91b48 | 2022-04-06 16:25:32 +0200 | [diff] [blame] | 141 | make -C build-root V=1 PLATFORM=vpp TAG=vpp install-packages |
Laszlo Kiraly | e560085 | 2021-11-02 11:07:19 +0100 | [diff] [blame] | 142 | |
| 143 | cd %{_vpp_build_dir}/../src/vpp-api/python && %{py3_build} |
| 144 | |
| 145 | %pre |
| 146 | # Add the vpp group |
| 147 | getent group vpp >/dev/null || groupadd -r vpp |
| 148 | %service_add_pre vpp.service |
| 149 | |
| 150 | %install |
| 151 | # |
| 152 | # binaries |
| 153 | # |
| 154 | mkdir -p -m755 %{buildroot}%{_bindir} |
| 155 | mkdir -p -m755 %{buildroot}%{_unitdir} |
| 156 | install -m 755 %{_vpp_install_dir}/*/bin/* %{buildroot}%{_bindir} |
| 157 | |
| 158 | # api |
| 159 | mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api |
| 160 | |
| 161 | # |
| 162 | # core api |
| 163 | # |
| 164 | mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api |
| 165 | install -p -m 644 %{_vpp_install_dir}/vpp/share/vpp/api/core/*.api.json %{buildroot}%{_datadir}/vpp/api |
| 166 | |
| 167 | # |
| 168 | # configs |
| 169 | # |
| 170 | mkdir -p -m755 %{buildroot}%{_sysconfdir}/vpp |
| 171 | mkdir -p -m755 %{buildroot}%{_sysconfdir}/sysctl.d |
| 172 | install -p -m 644 %{_vpp_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir} |
| 173 | install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/startup.conf %{buildroot}%{_sysconfdir}/vpp/startup.conf |
| 174 | sed -i -e "s|^\(\s*\)api-trace {|plugin_path /usr/lib64/vpp_plugins\n\napi-trace {|" %{buildroot}%{_sysconfdir}/vpp/startup.conf |
| 175 | install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}%{_sysconfdir}/sysctl.d |
| 176 | # |
| 177 | # libraries |
| 178 | # |
| 179 | mkdir -p -m755 %{buildroot}%{_libdir} |
| 180 | mkdir -p -m755 %{buildroot}%{_sysconfdir}/bash_completion.d |
| 181 | mkdir -p -m755 %{buildroot}%{_datadir}/vpp |
| 182 | for file in $(find %{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print ) |
| 183 | do |
| 184 | install -p -m 755 $file %{buildroot}%{_libdir} |
| 185 | done |
| 186 | for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///') |
| 187 | do |
| 188 | # make lib symlinks |
| 189 | ( cd %{buildroot}%{_libdir} && |
| 190 | ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') ) |
| 191 | ( cd %{buildroot}%{_libdir} && |
| 192 | ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') ) |
| 193 | done |
| 194 | for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api -type f -name '*.api.json' -print ) |
| 195 | do |
| 196 | install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api |
| 197 | done |
| 198 | |
| 199 | # Lua bindings |
| 200 | mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/cli |
| 201 | mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/lute |
| 202 | for file in $(cd %{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .) |
| 203 | do |
| 204 | install -p -m 644 %{_vpp_install_dir}/../../src/vpp-api/lua/$file \ |
| 205 | %{buildroot}%{_datadir}/doc/vpp/examples/lua/$file |
| 206 | done |
| 207 | |
| 208 | # Python bindings |
| 209 | cd %{_vpp_build_dir}/../src/vpp-api/python && %{py3_install} |
| 210 | |
| 211 | # |
| 212 | # devel |
| 213 | # |
| 214 | for dir in %{_vpp_install_dir}/vpp/include/ |
| 215 | do |
| 216 | for subdir in $(cd ${dir} && find . -type d -print) |
| 217 | do |
| 218 | mkdir -p -m755 %{buildroot}%{_includedir}/${subdir} |
| 219 | done |
| 220 | for file in $(cd ${dir} && find . -type f -print) |
| 221 | do |
| 222 | install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file |
| 223 | done |
| 224 | done |
| 225 | |
| 226 | # sample plugin |
| 227 | mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/sample |
| 228 | for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print) |
| 229 | do |
| 230 | install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \ |
| 231 | %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/$file |
| 232 | done |
| 233 | |
| 234 | # |
| 235 | # vpp-plugins |
| 236 | # |
| 237 | mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins |
| 238 | mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins |
| 239 | for file in $(cd %{_vpp_plugins_lib_dir}/vpp_plugins && find -type f -print) |
| 240 | do |
| 241 | install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_plugins/$file \ |
| 242 | %{buildroot}/%{_libdir}/vpp_plugins/$file |
| 243 | done |
| 244 | |
| 245 | for file in $(cd %{_vpp_plugins_lib_dir}/vpp_api_test_plugins && find -type f -print) |
| 246 | do |
| 247 | install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_api_test_plugins/$file \ |
| 248 | %{buildroot}/%{_libdir}/vpp_api_test_plugins/$file |
| 249 | done |
| 250 | |
| 251 | for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print ) |
| 252 | do |
| 253 | install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api |
| 254 | done |
| 255 | |
| 256 | # |
| 257 | # remove RPATH from ELF binaries |
| 258 | # |
| 259 | %{_vpp_build_dir}/scripts/remove-rpath %{buildroot} |
| 260 | |
| 261 | export NO_BRP_CHECK_RPATH=true |
| 262 | |
| 263 | %post |
| 264 | %service_add_post vpp.service |
| 265 | |
| 266 | %post -n %{lname} -p /sbin/ldconfig |
| 267 | |
| 268 | %preun |
| 269 | %service_del_preun vpp.service |
| 270 | |
| 271 | %postun |
| 272 | %service_del_postun vpp.service |
| 273 | |
| 274 | %postun -n %{lname} -p /sbin/ldconfig |
| 275 | |
| 276 | %files |
| 277 | %{_unitdir}/vpp.service |
| 278 | %{_bindir}/vpp* |
| 279 | %{_bindir}/svm* |
| 280 | %{_bindir}/vat2* |
| 281 | %dir %{_sysconfdir}/vpp |
| 282 | %config %{_sysconfdir}/sysctl.d/80-vpp.conf |
| 283 | %config %{_sysconfdir}/vpp/startup.conf |
| 284 | %license LICENSE |
| 285 | |
| 286 | %files -n %{lname} |
| 287 | %exclude %{_libdir}/vpp_plugins |
| 288 | %exclude %{_libdir}/vpp_api_test_plugins |
| 289 | %{_libdir}/*.so.* |
| 290 | |
| 291 | %files api-lua |
| 292 | %{_datadir}/doc/vpp/examples/lua |
| 293 | |
| 294 | %files api-python |
| 295 | %dir %{python3_sitelib}/vpp_* |
| 296 | %{python3_sitelib}/vpp_* |
| 297 | |
| 298 | %files devel |
| 299 | %dir %{_datadir}/doc/vpp |
| 300 | %dir %{_datadir}/doc/vpp/examples |
| 301 | /usr/bin/vppapigen |
| 302 | /usr/bin/vapi_c_gen.py |
| 303 | /usr/bin/vapi_cpp_gen.py |
| 304 | /usr/bin/vapi_json_parser.py |
| 305 | %{_libdir}/*.so |
| 306 | %{_includedir}/* |
| 307 | %{_datadir}/doc/vpp/examples/sample-plugin |
| 308 | %dir %{_datadir}/vpp |
| 309 | %dir %{_datadir}/vpp/api |
| 310 | %{_datadir}/vpp/api/* |
| 311 | |
| 312 | %files plugins |
| 313 | %dir %{_libdir}/vpp_plugins |
| 314 | %dir %{_libdir}/vpp_api_test_plugins |
| 315 | %{_libdir}/vpp_plugins/*.so* |
| 316 | %{_libdir}/vpp_api_test_plugins/*.so* |
| 317 | |
| 318 | %changelog |