blob: e1b9bd73c9b468cfc3c3dbd0d6f4fafb5c402f9a [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
Damjan Marionc76d6e22018-08-02 22:19:21 +0200128#%package api-java
129#Summary: VPP api java bindings
130#Group: Development/Libraries/Java
131#Requires: %%{lname} = %%{version}
132#Requires: %%{name} = %%{version}
133#Requires: %%{name}-devel = %%{version}
134#Conflicts: otherproviders(%%{name}-any-api-java)
135#Provides: %%{name}-any-api-java = %%{version}
Marco Varlese34acce22017-10-10 12:23:03 +0200136
Damjan Marionc76d6e22018-08-02 22:19:21 +0200137#%description api-java
138#This 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 Varleseaa839ca2018-08-21 11:51:19 +0200160make V=1 PLATFORM=vpp vpp_uses_cmake=no build-release
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
216install -p -m 644 %{_vpp_build_dir}/../src/scripts/vppctl_completion %{buildroot}%{_sysconfdir}/bash_completion.d
217install -p -m 644 %{_vpp_build_dir}/../src/scripts/vppctl-cmd-list %{buildroot}%{_datadir}/vpp
218
219# Lua bindings
220mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/cli
221mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/lute
222for file in $(cd %{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .)
223do
224 install -p -m 644 %{_vpp_install_dir}/../../src/vpp-api/lua/$file \
225 %{buildroot}%{_datadir}/doc/vpp/examples/lua/$file
226done
227
228# Java bindings
Damjan Marionc76d6e22018-08-02 22:19:21 +0200229#mkdir -p -m755 %{buildroot}%{_datadir}/java
230#for file in $(find %{_vpp_install_dir}/japi/share/java -type f -name '*.jar' -print )
231#do
232# install -p -m 644 $file %{buildroot}%{_datadir}/java
233#done
Marco Varlese34acce22017-10-10 12:23:03 +0200234
235# Python bindings
236cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_install}
237
238mkdir -p -m755 %{buildroot}%{python_sitelib}/vpp_papi
239for file in $(find %{_vpp_install_dir}/*/lib/python2.7/site-packages/ -type f -print | grep -v pyc | grep -v pyo)
240do
241 install -p -m755 $file %{buildroot}%{python_sitelib}/vpp_papi/
242done
243chmod -x %{buildroot}%{python_sitelib}/vpp_papi/*.txt
244
245#
246# devel
247#
248for dir in $(find %{_vpp_install_dir}/*/include/ -maxdepth 0 -type d -print | grep -v dpdk)
249do
250 for subdir in $(cd ${dir} && find . -type d -print)
251 do
252 mkdir -p -m755 %{buildroot}%{_includedir}/${subdir}
253 done
254 for file in $(cd ${dir} && find . -type f -print)
255 do
256 install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file
257 done
258done
259
Damjan Marionc76d6e22018-08-02 22:19:21 +0200260#mkdir -p -m755 %{buildroot}%{python_sitelib}/jvppgen
261#install -p -m755 %{_vpp_build_dir}/../extras/japi/java/jvpp/gen/jvpp_gen.py %{buildroot}%{_prefix}/bin
262#for i in $(ls %{_vpp_build_dir}/../extras/japi/java/jvpp/gen/jvppgen/*.py); do
263# install -p -m755 ${i} %{buildroot}%{python_sitelib}/jvppgen
264#done;
Marco Varlese34acce22017-10-10 12:23:03 +0200265
266# sample plugin
267mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/sample
268for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print)
269do
270 install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \
271 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/$file
272done
273
274#
275# vpp-plugins
276#
277mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins
278mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins
279for file in $(cd %{_vpp_plugins_lib_dir}/vpp_plugins && find -type f -print)
280do
281 install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_plugins/$file \
282 %{buildroot}/%{_libdir}/vpp_plugins/$file
283done
284
285for file in $(cd %{_vpp_plugins_lib_dir}/vpp_api_test_plugins && find -type f -print)
286do
287 install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_api_test_plugins/$file \
288 %{buildroot}/%{_libdir}/vpp_api_test_plugins/$file
289done
290
291for file in $(find %{_vpp_install_dir}/plugins -type f -name '*.api.json' -print )
292do
293 install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
294done
295
296#
297# remove RPATH from ELF binaries
298#
299%{_vpp_build_dir}/scripts/remove-rpath %{buildroot}
300
301export NO_BRP_CHECK_RPATH=true
302
303%post
304%service_add_post vpp.service
305
306%post -n %{lname} -p /sbin/ldconfig
307
308%preun
309%service_del_preun vpp.service
310
311%postun
312%service_del_postun vpp.service
313
314%postun -n %{lname} -p /sbin/ldconfig
315
316%files
317%{_unitdir}/vpp.service
318%{_bindir}/vpp*
319%{_bindir}/svm*
320%{_bindir}/elftool
321%dir %{_sysconfdir}/vpp
322%config %{_sysconfdir}/sysctl.d/80-vpp.conf
323%config %{_sysconfdir}/vpp/startup.conf
324%{_sysconfdir}/bash_completion.d/vppctl_completion
325%{_datadir}/vpp/vppctl-cmd-list
Marco Varleseabec9422018-07-04 14:31:10 +0200326%license LICENSE
Marco Varlese34acce22017-10-10 12:23:03 +0200327
328%files -n %{lname}
329%exclude %{_libdir}/vpp_plugins
330%exclude %{_libdir}/vpp_api_test_plugins
331%{_libdir}/*.so.*
332
333%files api-lua
334%{_datadir}/doc/vpp/examples/lua
335
Damjan Marionc76d6e22018-08-02 22:19:21 +0200336#%files api-java
337#%%{_datadir}/java/*
Marco Varlese34acce22017-10-10 12:23:03 +0200338
339%files api-python
340%dir %{python_sitelib}/vpp_papi*
Marco Varleseabec9422018-07-04 14:31:10 +0200341%{python_sitelib}/vpp_papi*
Marco Varlese34acce22017-10-10 12:23:03 +0200342
343%files devel
Damjan Marionc76d6e22018-08-02 22:19:21 +0200344#%dir %{python_sitelib}/jvppgen
345#%{python_sitelib}/jvppgen/*
Marco Varlese34acce22017-10-10 12:23:03 +0200346%dir %{_datadir}/doc/vpp
347%dir %{_datadir}/doc/vpp/examples
348%{_libdir}/*.so
Damjan Marionc76d6e22018-08-02 22:19:21 +0200349#%{_bindir}/jvpp_gen.py
Marco Varlese34acce22017-10-10 12:23:03 +0200350%{_includedir}/*
351%{_datadir}/doc/vpp/examples/sample-plugin
352%dir %{_datadir}/vpp
353%dir %{_datadir}/vpp/api
354%{_datadir}/vpp/api/*
355
356%files plugins
357%dir %{_libdir}/vpp_plugins
358%dir %{_libdir}/vpp_api_test_plugins
359%{_libdir}/vpp_plugins/*.so*
360%{_libdir}/vpp_api_test_plugins/*.so*
361
362%changelog