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