vxlan: vxlan/vxlan.api API cleanup
[vpp.git] / extras / rpm / vpp-suse.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/lib
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:  libboost_headers-devel
45 BuildRequires:  libboost_thread-devel
46 BuildRequires:  libnuma-devel
47 BuildRequires:  libopenssl-devel
48 BuildRequires:  libtool
49 BuildRequires:  lsb-release
50 BuildRequires:  make
51 BuildRequires:  mbedtls-devel
52 BuildRequires:  openssl-devel
53 BuildRequires:  python-devel
54 BuildRequires:  python-pip
55 BuildRequires:  python-rpm-macros
56 BuildRequires:  python2-ply
57 BuildRequires:  python3-devel
58 BuildRequires:  python3-pip
59 BuildRequires:  shadow
60 Conflicts:      otherproviders(vpp-any)
61 Provides:       %{name}-any = %{version}
62 ExclusiveArch:  x86_64 aarch64
63 %if 0%{?suse_version} >= 1210
64 BuildRequires:  systemd-rpm-macros
65 %endif
66
67 %description
68 The Vector Packet Processing platform is a framework that provides
69 switch/router functionality. It is based on Cisco's packet processing
70 stack that can run on commodity CPUs.
71 This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
72 vpp - the vector packet engine
73 vpp_api_test - vector packet engine API test tool
74 vpp_json_test - vector packet engine JSON test tool
75
76 %package -n %{lname}
77 Summary:        VPP libraries
78 Group:          System/Libraries
79 Provides:       %{lname}-any = %{version}
80
81 %description -n %{lname}
82 This package contains the VPP shared libraries, including:
83 vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
84 svm - vm library
85 vlib - vector processing library
86 vlib-api - binary API library
87 vnet -  network stack library
88
89 %package devel
90 Summary:        VPP header files, static libraries
91 Group:          Development/Libraries/C and C++
92 Requires:       %{lname} = %{version}
93 Conflicts:      otherproviders(%{name}-any-devel)
94 Provides:       %{name}-any-devel = %{version}
95
96 %description devel
97 This package contains the header files for VPP.
98 Install this package if you want to write a
99 program for compilation and linking with vpp lib.
100 vlib
101 vlibmemory
102 vnet - devices, classify, dhcp, ethernet flow, gre, ip, etc.
103 vpp-api
104 vppinfra
105
106 %package plugins
107 Summary:        Vector Packet Processing--runtime plugins
108 Group:          Productivity/Networking/Routing
109 Conflicts:      otherproviders(%{name}-any-plugins)
110 Provides:       %{name}-any-plugins = %{version}
111
112 %description plugins
113 This package contains the VPP plugins which are loaded by VPP at startup
114
115 %package api-lua
116 Summary:        VPP api lua bindings
117 Group:          Development/Libraries/Other
118 Requires:       %{lname} = %{version}
119 Requires:       %{name} = %{version}
120 Requires:       %{name}-devel = %{version}
121 Conflicts:      otherproviders(%{name}-any-api-lua)
122 Provides:       %{name}-any-api-lua = %{version}
123
124 %description api-lua
125 This package contains the lua bindings for the vpp api
126
127 %package api-python
128 Summary:        VPP api python bindings
129 Group:          Development/Libraries/Python
130 Requires:       %{lname} = %{version}
131 Requires:       %{name} = %{version}
132 Requires:       %{name}-devel = %{version}
133 Requires:       python-setuptools
134 Conflicts:      otherproviders(%{name}-any-python-api)
135 Provides:       %{name}-any-python-api = %{version}
136
137 %description api-python
138 This package contains the python bindings for the vpp api
139
140 %prep
141 %setup -q -n %{name}-%{version}
142
143 %build
144 export VPP_BUILD_USER=suse
145 export VPP_BUILD_HOST=SUSE
146
147 make -C build-root V=1 CC=gcc-7 CXX=g++-7 PLATFORM=vpp TAG=vpp install-packages
148
149 cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_build}
150
151 %pre
152 # Add the vpp group
153 getent group vpp >/dev/null || groupadd -r vpp
154 %service_add_pre vpp.service
155
156 %install
157 #
158 # binaries
159 #
160 mkdir -p -m755 %{buildroot}%{_bindir}
161 mkdir -p -m755 %{buildroot}%{_unitdir}
162 install  -m 755 %{_vpp_install_dir}/*/bin/* %{buildroot}%{_bindir}
163
164 # api
165 mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api
166
167 #
168 # core api
169 #
170 mkdir -p -m755 %{buildroot}%{_datadir}/vpp/api
171 install -p -m 644 %{_vpp_install_dir}/vpp/share/vpp/api/core/*.api.json %{buildroot}%{_datadir}/vpp/api
172
173 #
174 # configs
175 #
176 mkdir -p -m755 %{buildroot}%{_sysconfdir}/vpp
177 mkdir -p -m755 %{buildroot}%{_sysconfdir}/sysctl.d
178 install -p -m 644 %{_vpp_build_dir}/../extras/rpm/vpp.service %{buildroot}%{_unitdir}
179 install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/startup.conf %{buildroot}%{_sysconfdir}/vpp/startup.conf
180 install -p -m 644 %{_vpp_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}%{_sysconfdir}/sysctl.d
181 #
182 # libraries
183 #
184 mkdir -p -m755 %{buildroot}%{_libdir}
185 mkdir -p -m755 %{buildroot}%{_sysconfdir}/bash_completion.d
186 mkdir -p -m755 %{buildroot}%{_datadir}/vpp
187 for file in $(find %{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*' -print )
188 do
189         install -p -m 755 $file %{buildroot}%{_libdir}
190 done
191 for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///')
192 do
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/') )
198 done
199 for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api  -type f -name '*.api.json' -print )
200 do
201         install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
202 done
203
204 # Lua bindings
205 mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/cli
206 mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/lua/examples/lute
207 for file in $(cd %{_vpp_install_dir}/../../src/vpp-api/lua && git ls-files .)
208 do
209         install -p -m 644 %{_vpp_install_dir}/../../src/vpp-api/lua/$file \
210            %{buildroot}%{_datadir}/doc/vpp/examples/lua/$file
211 done
212
213 # Python bindings
214 cd %{_vpp_build_dir}/../src/vpp-api/python && %{py2_install}
215
216 mkdir -p -m755 %{buildroot}%{python_sitelib}/vpp_papi
217 for file in $(find %{_vpp_install_dir}/*/lib/python2.7/site-packages/ -type f -print | grep -v pyc | grep -v pyo)
218 do
219         install -p -m755 $file %{buildroot}%{python_sitelib}/vpp_papi/
220 done
221 chmod -x %{buildroot}%{python_sitelib}/vpp_papi/*.txt
222
223 #
224 # devel
225 #
226 for dir in %{_vpp_install_dir}/{vom,vpp}/include/
227 do
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
236 done
237
238 # sample plugin
239 mkdir -p -m755 %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/sample
240 for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print)
241 do
242         install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \
243            %{buildroot}%{_datadir}/doc/vpp/examples/sample-plugin/$file
244 done
245
246 #
247 # vpp-plugins
248 #
249 mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins
250 mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins
251 for file in $(cd %{_vpp_plugins_lib_dir}/vpp_plugins && find -type f -print)
252 do
253         install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_plugins/$file \
254            %{buildroot}/%{_libdir}/vpp_plugins/$file
255 done
256
257 for file in $(cd %{_vpp_plugins_lib_dir}/vpp_api_test_plugins && find -type f -print)
258 do
259         install -p -m 644 %{_vpp_plugins_lib_dir}/vpp_api_test_plugins/$file \
260            %{buildroot}/%{_libdir}/vpp_api_test_plugins/$file
261 done
262
263 for file in $(find %{_vpp_install_dir}/vpp/share/vpp/api/plugins -type f -name '*.api.json' -print )
264 do
265         install -p -m 644 $file %{buildroot}%{_datadir}/vpp/api
266 done
267
268 #
269 # remove RPATH from ELF binaries
270 #
271 %{_vpp_build_dir}/scripts/remove-rpath %{buildroot}
272
273 export 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
296 %license LICENSE
297
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
306 %files api-python
307 %dir %{python_sitelib}/vpp_papi*
308 %{python_sitelib}/vpp_papi*
309
310 %files devel
311 %dir %{_datadir}/doc/vpp
312 %dir %{_datadir}/doc/vpp/examples
313 %{_libdir}/*.so
314 %{_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