blob: cbe68607eb889c730f74bd2b33ac6e7513512b61 [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/
Damjan Marion79dcbc72018-09-12 14:01:10 +020021%define _vpp_plugins_lib_dir %{_vpp_install_dir}/vpp/lib
Marco Varlese34acce22017-10-10 12:23:03 +020022
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: libboost_headers-devel
45BuildRequires: libboost_thread-devel
Marco Varlese34acce22017-10-10 12:23:03 +020046BuildRequires: libnuma-devel
47BuildRequires: libopenssl-devel
48BuildRequires: libtool
49BuildRequires: lsb-release
50BuildRequires: make
Marco Varleseabec9422018-07-04 14:31:10 +020051BuildRequires: mbedtls-devel
Marco Varlese34acce22017-10-10 12:23:03 +020052BuildRequires: openssl-devel
53BuildRequires: python-devel
54BuildRequires: python-pip
55BuildRequires: python-rpm-macros
Marco Varleseabec9422018-07-04 14:31:10 +020056BuildRequires: python2-ply
Marco Varlese34acce22017-10-10 12:23:03 +020057BuildRequires: 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}
Marco Varleseabec9422018-07-04 14:31:10 +0200120Requires: %{name}-devel = %{version}
Marco Varlese34acce22017-10-10 12:23:03 +0200121Conflicts: 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
Marco Varlese34acce22017-10-10 12:23:03 +0200127%package api-python
128Summary: VPP api python bindings
129Group: Development/Libraries/Python
130Requires: %{lname} = %{version}
131Requires: %{name} = %{version}
Marco Varleseabec9422018-07-04 14:31:10 +0200132Requires: %{name}-devel = %{version}
Marco Varlese34acce22017-10-10 12:23:03 +0200133Requires: 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
Marco Varlese70fee2d2018-08-30 14:57:05 +0200147make -C build-root V=1 CC=gcc-7 CXX=g++-7 PLATFORM=vpp TAG=vpp install-packages
Marco Varlese34acce22017-10-10 12:23:03 +0200148
149cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_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
Mohsin Kazmi7b2017d2018-09-26 10:49:41 +0200172
Marco Varlese34acce22017-10-10 12:23:03 +0200173#
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
180install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}%{_sysconfdir}/sysctl.d
181#
182# libraries
183#
184mkdir -p -m755 %{buildroot}%{_libdir}
185mkdir -p -m755 %{buildroot}%{_sysconfdir}/bash_completion.d
186mkdir -p -m755 %{buildroot}%{_datadir}/vpp
Mohsin Kazmi7b2017d2018-09-26 10:49:41 +0200187for file in $(find %{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print )
Marco Varlese34acce22017-10-10 12:23:03 +0200188do
189 install -p -m 755 $file %{buildroot}%{_libdir}
190done
191for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///')
192do
193 # make lib symlinks
194 ( cd %{buildroot}%{_libdir} &&
195 ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') )
196 ( cd %{buildroot}%{_libdir} &&
197 ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') )
198done
199for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api -type f -name '*.api.json' -print )
200do
201 install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
202done
Marco Varlese34acce22017-10-10 12:23:03 +0200203
204# Lua bindings
205mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/cli
206mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/lute
207for file in $(cd %{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .)
208do
209 install -p -m 644 %{_vpp_install_dir}/../../src/vpp-api/lua/$file \
210 %{buildroot}%{_datadir}/doc/vpp/examples/lua/$file
211done
212
Marco Varlese34acce22017-10-10 12:23:03 +0200213# Python bindings
214cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_install}
215
216mkdir -p -m755 %{buildroot}%{python_sitelib}/vpp_papi
217for file in $(find %{_vpp_install_dir}/*/lib/python2.7/site-packages/ -type f -print | grep -v pyc | grep -v pyo)
218do
219 install -p -m755 $file %{buildroot}%{python_sitelib}/vpp_papi/
220done
221chmod -x %{buildroot}%{python_sitelib}/vpp_papi/*.txt
222
223#
224# devel
225#
226for dir in $(find %{_vpp_install_dir}/*/include/ -maxdepth 0 -type d -print | grep -v dpdk)
227do
228 for subdir in $(cd ${dir} && find . -type d -print)
229 do
230 mkdir -p -m755 %{buildroot}%{_includedir}/${subdir}
231 done
232 for file in $(cd ${dir} && find . -type f -print)
233 do
234 install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file
235 done
236done
237
Marco Varlese34acce22017-10-10 12:23:03 +0200238# sample plugin
239mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/sample
240for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print)
241do
242 install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \
243 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/$file
244done
245
246#
247# vpp-plugins
248#
249mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins
250mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins
251for file in $(cd %{_vpp_plugins_lib_dir}/vpp_plugins && find -type f -print)
252do
253 install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_plugins/$file \
254 %{buildroot}/%{_libdir}/vpp_plugins/$file
255done
256
257for file in $(cd %{_vpp_plugins_lib_dir}/vpp_api_test_plugins && find -type f -print)
258do
259 install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_api_test_plugins/$file \
260 %{buildroot}/%{_libdir}/vpp_api_test_plugins/$file
261done
262
Mohsin Kazmi7b2017d2018-09-26 10:49:41 +0200263for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print )
Marco Varlese34acce22017-10-10 12:23:03 +0200264do
265 install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
266done
267
268#
269# remove RPATH from ELF binaries
270#
271%{_vpp_build_dir}/scripts/remove-rpath %{buildroot}
272
273export NO_BRP_CHECK_RPATH=true
274
275%post
276%service_add_post vpp.service
277
278%post -n %{lname} -p /sbin/ldconfig
279
280%preun
281%service_del_preun vpp.service
282
283%postun
284%service_del_postun vpp.service
285
286%postun -n %{lname} -p /sbin/ldconfig
287
288%files
289%{_unitdir}/vpp.service
290%{_bindir}/vpp*
291%{_bindir}/svm*
292%{_bindir}/elftool
293%dir %{_sysconfdir}/vpp
294%config %{_sysconfdir}/sysctl.d/80-vpp.conf
295%config %{_sysconfdir}/vpp/startup.conf
Marco Varleseabec9422018-07-04 14:31:10 +0200296%license LICENSE
Marco Varlese34acce22017-10-10 12:23:03 +0200297
298%files -n %{lname}
299%exclude %{_libdir}/vpp_plugins
300%exclude %{_libdir}/vpp_api_test_plugins
301%{_libdir}/*.so.*
302
303%files api-lua
304%{_datadir}/doc/vpp/examples/lua
305
Marco Varlese34acce22017-10-10 12:23:03 +0200306%files api-python
307%dir %{python_sitelib}/vpp_papi*
Marco Varleseabec9422018-07-04 14:31:10 +0200308%{python_sitelib}/vpp_papi*
Marco Varlese34acce22017-10-10 12:23:03 +0200309
310%files devel
Marco Varlese34acce22017-10-10 12:23:03 +0200311%dir %{_datadir}/doc/vpp
312%dir %{_datadir}/doc/vpp/examples
313%{_libdir}/*.so
Marco Varlese34acce22017-10-10 12:23:03 +0200314%{_includedir}/*
315%{_datadir}/doc/vpp/examples/sample-plugin
316%dir %{_datadir}/vpp
317%dir %{_datadir}/vpp/api
318%{_datadir}/vpp/api/*
319
320%files plugins
321%dir %{_libdir}/vpp_plugins
322%dir %{_libdir}/vpp_api_test_plugins
323%{_libdir}/vpp_plugins/*.so*
324%{_libdir}/vpp_api_test_plugins/*.so*
325
326%changelog