tls: remove pkg dependencies on mbedtls
[vpp.git] / extras / rpm / opensuse / vpp.spec
1 #
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
25 Name:           vpp
26 Version:        %{_version}
27 Release:        %{_release}
28 Summary:        Set of libraries and drivers for fast packet processing
29 License:        Apache-2.0
30 Group:          Productivity/Networking/Routing
31 Url:            https://wiki.fd.io/view/VPP
32 Source0:        %{name}-%{version}-%{_release}.tar.xz
33 BuildRequires:  autoconf
34 BuildRequires:  automake
35 BuildRequires:  bison
36 BuildRequires:  ccache
37 BuildRequires:  check-devel
38 BuildRequires:  chrpath
39 BuildRequires:  distribution-release
40 BuildRequires:  gcc
41 BuildRequires:  gcc-c++
42 BuildRequires:  glibc-devel
43 BuildRequires:  glibc-devel-static
44 BuildRequires:  libnuma-devel
45 BuildRequires:  libopenssl-devel
46 BuildRequires:  libtool
47 BuildRequires:  lsb-release
48 BuildRequires:  make
49 BuildRequires:  openssl-devel
50 BuildRequires:  python-devel
51 BuildRequires:  python-pip
52 BuildRequires:  python-rpm-macros
53 BuildRequires:  python2-ply
54 BuildRequires:  python3-devel
55 BuildRequires:  python3-pip
56 BuildRequires:  shadow
57 Conflicts:      otherproviders(vpp-any)
58 Provides:       %{name}-any = %{version}
59 ExclusiveArch:  x86_64 aarch64
60 %if 0%{?suse_version} >= 1210
61 BuildRequires:  systemd-rpm-macros
62 %endif
63
64 %description
65 The Vector Packet Processing platform is a framework that provides
66 switch/router functionality. It is based on Cisco's packet processing
67 stack that can run on commodity CPUs.
68 This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
69 vpp - the vector packet engine
70 vpp_api_test - vector packet engine API test tool
71 vpp_json_test - vector packet engine JSON test tool
72
73 %package -n %{lname}
74 Summary:        VPP libraries
75 Group:          System/Libraries
76 Provides:       %{lname}-any = %{version}
77
78 %description -n %{lname}
79 This package contains the VPP shared libraries, including:
80 vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
81 svm - vm library
82 vlib - vector processing library
83 vlib-api - binary API library
84 vnet -  network stack library
85
86 %package devel
87 Summary:        VPP header files, static libraries
88 Group:          Development/Libraries/C and C++
89 Requires:       %{lname} = %{version}
90 Conflicts:      otherproviders(%{name}-any-devel)
91 Provides:       %{name}-any-devel = %{version}
92
93 %description devel
94 This package contains the header files for VPP.
95 Install this package if you want to write a
96 program for compilation and linking with vpp lib.
97 vlib
98 vlibmemory
99 vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc.
100 vpp-api
101 vppinfra
102
103 %package plugins
104 Summary:        Vector Packet Processing--runtime plugins
105 Group:          Productivity/Networking/Routing
106 Conflicts:      otherproviders(%{name}-any-plugins)
107 Provides:       %{name}-any-plugins = %{version}
108
109 %description plugins
110 This package contains the VPP plugins which are loaded by VPP at startup
111
112 %package api-lua
113 Summary:        VPP api lua bindings
114 Group:          Development/Libraries/Other
115 Requires:       %{lname} = %{version}
116 Requires:       %{name} = %{version}
117 Requires:       %{name}-devel = %{version}
118 Conflicts:      otherproviders(%{name}-any-api-lua)
119 Provides:       %{name}-any-api-lua = %{version}
120
121 %description api-lua
122 This package contains the lua bindings for the vpp api
123
124 %package api-python
125 Summary:        VPP api python bindings
126 Group:          Development/Libraries/Python
127 Requires:       %{lname} = %{version}
128 Requires:       %{name} = %{version}
129 Requires:       %{name}-devel = %{version}
130 Requires:       python-setuptools
131 Conflicts:      otherproviders(%{name}-any-python-api)
132 Provides:       %{name}-any-python-api = %{version}
133
134 %description api-python
135 This package contains the python bindings for the vpp api
136
137 %prep
138 %setup -q -n %{name}-%{version}
139
140 %build
141 export VPP_BUILD_USER=suse
142 export VPP_BUILD_HOST=SUSE
143
144 make -C build-root V=1 CC=gcc-7 CXX=g++-7 PLATFORM=vpp TAG=vpp install-packages
145
146 cd %{_vpp_build_dir}/../src/vpp-api/python && %{py3_build}
147
148 %pre
149 # Add the vpp group
150 getent group vpp >/dev/null || groupadd -r vpp
151 %service_add_pre vpp.service
152
153 %install
154 #
155 # binaries
156 #
157 mkdir -p -m755 %{buildroot}%{_bindir}
158 mkdir -p -m755 %{buildroot}%{_unitdir}
159 install  -m 755 %{_vpp_install_dir}/*/bin/* %{buildroot}%{_bindir}
160
161 # api
162 mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api
163
164 #
165 # core api
166 #
167 mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api
168 install -p -m 644 %{_vpp_install_dir}/vpp/share/vpp/api/core/*.api.json %{buildroot}%{_datadir}/vpp/api
169
170 #
171 # configs
172 #
173 mkdir -p -m755 %{buildroot}%{_sysconfdir}/vpp
174 mkdir -p -m755 %{buildroot}%{_sysconfdir}/sysctl.d
175 install -p -m 644 %{_vpp_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir}
176 install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/startup.conf %{buildroot}%{_sysconfdir}/vpp/startup.conf
177 sed -i -e "s|^\(\s*\)api-trace {|plugin_path /usr/lib64/vpp_plugins\n\napi-trace {|" %{buildroot}%{_sysconfdir}/vpp/startup.conf
178 install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}%{_sysconfdir}/sysctl.d
179 #
180 # libraries
181 #
182 mkdir -p -m755 %{buildroot}%{_libdir}
183 mkdir -p -m755 %{buildroot}%{_sysconfdir}/bash_completion.d
184 mkdir -p -m755 %{buildroot}%{_datadir}/vpp
185 for file in $(find %{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print )
186 do
187         install -p -m 755 $file %{buildroot}%{_libdir}
188 done
189 for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///')
190 do
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/') )
196 done
197 for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api  -type f -name '*.api.json' -print )
198 do
199         install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
200 done
201
202 # Lua bindings
203 mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/cli
204 mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/lute
205 for file in $(cd %{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .)
206 do
207         install -p -m 644 %{_vpp_install_dir}/../../src/vpp-api/lua/$file \
208            %{buildroot}%{_datadir}/doc/vpp/examples/lua/$file
209 done
210
211 # Python bindings
212 cd %{_vpp_build_dir}/../src/vpp-api/python && %{py3_install}
213
214 #
215 # devel
216 #
217 for dir in %{_vpp_install_dir}/vpp/include/
218 do
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
227 done
228
229 # sample plugin
230 mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/sample
231 for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print)
232 do
233         install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \
234            %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/$file
235 done
236
237 #
238 # vpp-plugins
239 #
240 mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins
241 mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins
242 for file in $(cd %{_vpp_plugins_lib_dir}/vpp_plugins && find -type f -print)
243 do
244         install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_plugins/$file \
245            %{buildroot}/%{_libdir}/vpp_plugins/$file
246 done
247
248 for file in $(cd %{_vpp_plugins_lib_dir}/vpp_api_test_plugins && find -type f -print)
249 do
250         install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_api_test_plugins/$file \
251            %{buildroot}/%{_libdir}/vpp_api_test_plugins/$file
252 done
253
254 for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print )
255 do
256         install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
257 done
258
259 #
260 # remove RPATH from ELF binaries
261 #
262 %{_vpp_build_dir}/scripts/remove-rpath %{buildroot}
263
264 export 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