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