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