blob: 22420fa154c23eb678c3a65ba80db823ea18469d [file] [log] [blame]
Marco Varlese34acce22017-10-10 12:23:03 +02001#
2# spec file for package vpp
3#
Marco Varleseabec9422018-07-04 14:31:10 +02004# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
Marco Varlese34acce22017-10-10 12:23:03 +02005#
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
25Name: vpp
26Version: %{_version}
27Release: %{_release}
28Summary: Set of libraries and drivers for fast packet processing
29License: Apache-2.0
30Group: Productivity/Networking/Routing
31Url: https://wiki.fd.io/view/VPP
32Source0: %{name}-%{version}-%{_release}.tar.xz
33BuildRequires: autoconf
34BuildRequires: automake
35BuildRequires: bison
36BuildRequires: ccache
37BuildRequires: check-devel
38BuildRequires: chrpath
39BuildRequires: distribution-release
40BuildRequires: gcc
Marco Varleseabec9422018-07-04 14:31:10 +020041BuildRequires: gcc-c++
42BuildRequires: glibc-devel
Marco Varlese34acce22017-10-10 12:23:03 +020043BuildRequires: glibc-devel-static
Marco Varleseabec9422018-07-04 14:31:10 +020044BuildRequires: java-devel >= 1.8
45BuildRequires: libboost_headers-devel
46BuildRequires: libboost_thread-devel
Marco Varlese34acce22017-10-10 12:23:03 +020047BuildRequires: libnuma-devel
48BuildRequires: libopenssl-devel
49BuildRequires: libtool
50BuildRequires: lsb-release
51BuildRequires: make
Marco Varleseabec9422018-07-04 14:31:10 +020052BuildRequires: mbedtls-devel
Marco Varlese34acce22017-10-10 12:23:03 +020053BuildRequires: openssl-devel
54BuildRequires: python-devel
55BuildRequires: python-pip
56BuildRequires: python-rpm-macros
Marco Varleseabec9422018-07-04 14:31:10 +020057BuildRequires: python2-ply
Marco Varlese34acce22017-10-10 12:23:03 +020058BuildRequires: python3-devel
59BuildRequires: python3-pip
60BuildRequires: shadow
61Conflicts: otherproviders(vpp-any)
62Provides: %{name}-any = %{version}
63ExclusiveArch: x86_64 aarch64
64%if 0%{?suse_version} >= 1210
65BuildRequires: systemd-rpm-macros
66%endif
67
68%description
69The Vector Packet Processing platform is a framework that provides
70switch/router functionality. It is based on Cisco's packet processing
71stack that can run on commodity CPUs.
72This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
73vpp - the vector packet engine
74vpp_api_test - vector packet engine API test tool
75vpp_json_test - vector packet engine JSON test tool
76
77%package -n %{lname}
78Summary: VPP libraries
79Group: System/Libraries
80Provides: %{lname}-any = %{version}
81
82%description -n %{lname}
83This package contains the VPP shared libraries, including:
84vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
85svm - vm library
86vlib - vector processing library
87vlib-api - binary API library
88vnet - network stack library
89
90%package devel
91Summary: VPP header files, static libraries
92Group: Development/Libraries/C and C++
93Requires: %{lname} = %{version}
94Conflicts: otherproviders(%{name}-any-devel)
95Provides: %{name}-any-devel = %{version}
96
97%description devel
98This package contains the header files for VPP.
99Install this package if you want to write a
100program for compilation and linking with vpp lib.
101vlib
102vlibmemory
103vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc.
104vpp-api
105vppinfra
106
107%package plugins
108Summary: Vector Packet Processing--runtime plugins
109Group: Productivity/Networking/Routing
110Conflicts: otherproviders(%{name}-any-plugins)
111Provides: %{name}-any-plugins = %{version}
112
113%description plugins
114This package contains the VPP plugins which are loaded by VPP at startup
115
116%package api-lua
117Summary: VPP api lua bindings
118Group: Development/Libraries/Other
119Requires: %{lname} = %{version}
120Requires: %{name} = %{version}
Marco Varleseabec9422018-07-04 14:31:10 +0200121Requires: %{name}-devel = %{version}
Marco Varlese34acce22017-10-10 12:23:03 +0200122Conflicts: otherproviders(%{name}-any-api-lua)
123Provides: %{name}-any-api-lua = %{version}
124
125%description api-lua
126This package contains the lua bindings for the vpp api
127
Marco Varlese70fee2d2018-08-30 14:57:05 +0200128%package api-java
129Summary: VPP api java bindings
130Group: Development/Libraries/Java
131Requires: %{lname} = %{version}
132Requires: %{name} = %{version}
133Requires: %{name}-devel = %{version}
134Conflicts: otherproviders(%{name}-any-api-java)
135Provides: %{name}-any-api-java = %{version}
Marco Varlese34acce22017-10-10 12:23:03 +0200136
Marco Varlese70fee2d2018-08-30 14:57:05 +0200137%description api-java
138This package contains the java bindings for the vpp api
Marco Varlese34acce22017-10-10 12:23:03 +0200139
140%package api-python
141Summary: VPP api python bindings
142Group: Development/Libraries/Python
143Requires: %{lname} = %{version}
144Requires: %{name} = %{version}
Marco Varleseabec9422018-07-04 14:31:10 +0200145Requires: %{name}-devel = %{version}
Marco Varlese34acce22017-10-10 12:23:03 +0200146Requires: python-setuptools
147Conflicts: otherproviders(%{name}-any-python-api)
148Provides: %{name}-any-python-api = %{version}
149
150%description api-python
151This package contains the python bindings for the vpp api
152
153%prep
154%setup -q -n %{name}-%{version}
155
156%build
157export VPP_BUILD_USER=suse
158export VPP_BUILD_HOST=SUSE
159
Marco Varlese70fee2d2018-08-30 14:57:05 +0200160make -C build-root V=1 CC=gcc-7 CXX=g++-7 PLATFORM=vpp TAG=vpp install-packages
Marco Varlese34acce22017-10-10 12:23:03 +0200161
162cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_build}
163
164%pre
165# Add the vpp group
166getent group vpp >/dev/null || groupadd -r vpp
167%service_add_pre vpp.service
168
169%install
170#
171# binaries
172#
173mkdir -p -m755 %{buildroot}%{_bindir}
174mkdir -p -m755 %{buildroot}%{_unitdir}
175install -m 755 %{_vpp_install_dir}/*/bin/* %{buildroot}%{_bindir}
176
177# api
178mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api
179
180#
181# core api
182#
183mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api
184install -p -m 644 %{_vpp_install_dir}/vpp/share/vpp/api/core/*.api.json %{buildroot}%{_datadir}/vpp/api
185install -p -m 644 %{_vpp_install_dir}/vpp/share/vpp/api/plugins/*.api.json %{buildroot}%{_datadir}/vpp/api
186#
187# configs
188#
189mkdir -p -m755 %{buildroot}%{_sysconfdir}/vpp
190mkdir -p -m755 %{buildroot}%{_sysconfdir}/sysctl.d
191install -p -m 644 %{_vpp_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir}
192install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/startup.conf %{buildroot}%{_sysconfdir}/vpp/startup.conf
193install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}%{_sysconfdir}/sysctl.d
194#
195# libraries
196#
197mkdir -p -m755 %{buildroot}%{_libdir}
198mkdir -p -m755 %{buildroot}%{_sysconfdir}/bash_completion.d
199mkdir -p -m755 %{buildroot}%{_datadir}/vpp
200for file in $(find %{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*.*' -print )
201do
202 install -p -m 755 $file %{buildroot}%{_libdir}
203done
204for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///')
205do
206 # make lib symlinks
207 ( cd %{buildroot}%{_libdir} &&
208 ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') )
209 ( cd %{buildroot}%{_libdir} &&
210 ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') )
211done
212for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api -type f -name '*.api.json' -print )
213do
214 install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
215done
Marco Varlese34acce22017-10-10 12:23:03 +0200216
217# Lua bindings
218mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/cli
219mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/lute
220for file in $(cd %{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .)
221do
222 install -p -m 644 %{_vpp_install_dir}/../../src/vpp-api/lua/$file \
223 %{buildroot}%{_datadir}/doc/vpp/examples/lua/$file
224done
225
226# Java bindings
Marco Varlese70fee2d2018-08-30 14:57:05 +0200227mkdir -p -m755 %{buildroot}%{_datadir}/java
228for file in $(find %{_vpp_install_dir}/japi/share/java -type f -name '*.jar' -print )
229do
230 install -p -m 644 $file %{buildroot}%{_datadir}/java
231done
Marco Varlese34acce22017-10-10 12:23:03 +0200232
233# Python bindings
234cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_install}
235
236mkdir -p -m755 %{buildroot}%{python_sitelib}/vpp_papi
237for file in $(find %{_vpp_install_dir}/*/lib/python2.7/site-packages/ -type f -print | grep -v pyc | grep -v pyo)
238do
239 install -p -m755 $file %{buildroot}%{python_sitelib}/vpp_papi/
240done
241chmod -x %{buildroot}%{python_sitelib}/vpp_papi/*.txt
242
243#
244# devel
245#
246for dir in $(find %{_vpp_install_dir}/*/include/ -maxdepth 0 -type d -print | grep -v dpdk)
247do
248 for subdir in $(cd ${dir} && find . -type d -print)
249 do
250 mkdir -p -m755 %{buildroot}%{_includedir}/${subdir}
251 done
252 for file in $(cd ${dir} && find . -type f -print)
253 do
254 install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file
255 done
256done
257
Marco Varlese70fee2d2018-08-30 14:57:05 +0200258mkdir -p -m755 %{buildroot}%{python_sitelib}/jvppgen
259install -p -m755 %{_vpp_build_dir}/../extras/japi/java/jvpp/gen/jvpp_gen.py %{buildroot}%{_prefix}/bin
260for i in $(ls %{_vpp_build_dir}/../extras/japi/java/jvpp/gen/jvppgen/*.py); do
261 install -p -m755 ${i} %{buildroot}%{python_sitelib}/jvppgen
262done;
Marco Varlese34acce22017-10-10 12:23:03 +0200263
264# sample plugin
265mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/sample
266for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print)
267do
268 install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \
269 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/$file
270done
271
272#
273# vpp-plugins
274#
275mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins
276mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins
277for file in $(cd %{_vpp_plugins_lib_dir}/vpp_plugins && find -type f -print)
278do
279 install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_plugins/$file \
280 %{buildroot}/%{_libdir}/vpp_plugins/$file
281done
282
283for file in $(cd %{_vpp_plugins_lib_dir}/vpp_api_test_plugins && find -type f -print)
284do
285 install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_api_test_plugins/$file \
286 %{buildroot}/%{_libdir}/vpp_api_test_plugins/$file
287done
288
289for file in $(find %{_vpp_install_dir}/plugins -type f -name '*.api.json' -print )
290do
291 install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
292done
293
294#
295# remove RPATH from ELF binaries
296#
297%{_vpp_build_dir}/scripts/remove-rpath %{buildroot}
298
299export NO_BRP_CHECK_RPATH=true
300
301%post
302%service_add_post vpp.service
303
304%post -n %{lname} -p /sbin/ldconfig
305
306%preun
307%service_del_preun vpp.service
308
309%postun
310%service_del_postun vpp.service
311
312%postun -n %{lname} -p /sbin/ldconfig
313
314%files
315%{_unitdir}/vpp.service
316%{_bindir}/vpp*
317%{_bindir}/svm*
318%{_bindir}/elftool
319%dir %{_sysconfdir}/vpp
320%config %{_sysconfdir}/sysctl.d/80-vpp.conf
321%config %{_sysconfdir}/vpp/startup.conf
Marco Varleseabec9422018-07-04 14:31:10 +0200322%license LICENSE
Marco Varlese34acce22017-10-10 12:23:03 +0200323
324%files -n %{lname}
325%exclude %{_libdir}/vpp_plugins
326%exclude %{_libdir}/vpp_api_test_plugins
327%{_libdir}/*.so.*
328
329%files api-lua
330%{_datadir}/doc/vpp/examples/lua
331
Marco Varlese70fee2d2018-08-30 14:57:05 +0200332%files api-java
333%{_datadir}/java/*
Marco Varlese34acce22017-10-10 12:23:03 +0200334
335%files api-python
336%dir %{python_sitelib}/vpp_papi*
Marco Varleseabec9422018-07-04 14:31:10 +0200337%{python_sitelib}/vpp_papi*
Marco Varlese34acce22017-10-10 12:23:03 +0200338
339%files devel
Marco Varlese70fee2d2018-08-30 14:57:05 +0200340%dir %{python_sitelib}/jvppgen
341%{python_sitelib}/jvppgen/*
Marco Varlese34acce22017-10-10 12:23:03 +0200342%dir %{_datadir}/doc/vpp
343%dir %{_datadir}/doc/vpp/examples
344%{_libdir}/*.so
Marco Varlese70fee2d2018-08-30 14:57:05 +0200345%{_bindir}/jvpp_gen.py
Marco Varlese34acce22017-10-10 12:23:03 +0200346%{_includedir}/*
347%{_datadir}/doc/vpp/examples/sample-plugin
348%dir %{_datadir}/vpp
349%dir %{_datadir}/vpp/api
350%{_datadir}/vpp/api/*
351
352%files plugins
353%dir %{_libdir}/vpp_plugins
354%dir %{_libdir}/vpp_api_test_plugins
355%{_libdir}/vpp_plugins/*.so*
356%{_libdir}/vpp_api_test_plugins/*.so*
357
358%changelog