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