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