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