File dpdk.spec of Package dpdk
396
1
#
2
# spec file for package dpdk
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
# needssslcertforbuild
18
19
20
%define machine native
21
%define machine2 default
22
%ifarch x86_64
23
%define machine native
24
%define target x86_64-%{machine}-linuxapp-gcc
25
%endif
26
%ifarch %{ix86}
27
%define machine native
28
%define target i686-%{machine}-linuxapp-gcc
29
%endif
30
%ifarch aarch64
31
%define machine2 armv8a
32
%define target arm64-%{machine2}-linuxapp-gcc
33
%endif
34
%ifarch ppc64le
35
%define machine2 power8
36
%define target ppc_64-%{machine2}-linuxapp-gcc
37
%endif
38
%bcond_without shared
39
# Add option to build without examples
40
%bcond_without examples
41
# Add option to build without tools
42
%bcond_without tools
43
44
# The lname versioning is based solely on the MAJOR and MINOR
45
# as per DPDK CONFIG_RTE_MAJOR_ABI.
46
%define lname libdpdk-17_11-0
47
48
Name: dpdk
49
Version: 17.11.2
50
Release: 0
51
Summary: Set of libraries and drivers for fast packet processing
52
License: BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-only
53
Group: System/Libraries
54
Url: http://dpdk.org
55
Source: http://fast.dpdk.org/rel/dpdk-%{version}.tar.xz
56
Source1: preamble
57
# PATCH-FIX-OPENSUSE 0001-enic-fix-Type-punning-and-strict-aliasing-warning.patch
58
# This patch was originally taken from the fedora package but they have
59
# removed it since then because of
60
# http://osdir.com/ml/scm-fedora-commits/2016-03/msg00849.html
61
# However, the problem still exists and the fix has to find its way to the
62
# upstream code.
63
Patch1: 0001-enic-fix-Type-punning-and-strict-aliasing-warning.patch
64
BuildRequires: doxygen
65
BuildRequires: fdupes
66
BuildRequires: libelf-devel
67
BuildRequires: libnuma-devel
68
BuildRequires: libpcap-devel
69
BuildRequires: pesign-obs-integration
70
BuildRequires: rdma-core-devel
71
BuildRequires: zlib-devel
72
ExclusiveArch: aarch64 x86_64 %ix86 ppc64le
73
Provides: dpdk-any = %{version}
74
Conflicts: otherproviders(dpdk-any)
75
76
%description
77
The Data Plane Development Kit is a set of libraries and drivers for
78
fast packet processing in the user space.
79
80
%package devel
81
Summary: Data Plane Development Kit development files
82
Group: Development/Libraries/C and C++
83
Requires: %{lname} = %{version}
84
Provides: dpdk-any-devel = %{version}
85
Conflicts: otherproviders(dpdk-any-devel)
86
87
%description devel
88
This package contains the headers and other files needed for developing
89
applications with the Data Plane Development Kit.
90
91
%package -n %{lname}
92
Summary: Data Plane Development Kit runtime libraries
93
Group: Development/Libraries/C and C++
94
Provides: %{lname}-any = %{version}
95
96
%description -n %{lname}
97
This package contains the runtime libraries needed for 3rd party application
98
to use the Data Plane Development Kit.
99
100
%package doc
101
Summary: Data Plane Development Kit API documentation
102
Group: System/Libraries
103
BuildArch: noarch
104
Provides: dpdk-any-doc = %{version}
105
Conflicts: otherproviders(dpdk-any-doc)
106
107
%description doc
108
API programming documentation for the Data Plane Development Kit.
109
110
%if %{with tools}
111
%package tools
112
Summary: Tools for setting up Data Plane Development Kit environment
113
Group: System/Libraries
114
Requires: %{name} = %{version}
115
Requires: findutils
116
Requires: iproute
117
Requires: kmod
118
Requires: pciutils
119
Provides: dpdk-any-tools = %{version}
120
Conflicts: otherproviders(dpdk-any-tools)
121
122
%description tools
123
This package contains tools for setting up Data Plane Development Kit environment
124
%endif
125
126
%if %{with examples}
127
%package examples
128
Summary: Data Plane Development Kit example applications
129
Group: System/Libraries
130
BuildRequires: libvirt-devel
131
Provides: dpdk-any-examples = %{version}
132
Conflicts: otherproviders(dpdk-any-examples)
133
134
%description examples
135
Example applications utilizing the Data Plane Development Kit, such
136
as L2 and L3 forwarding.
137
%endif
138
139
%ifnarch %{ix86}
140
%package kmp
141
Summary: DPDK KNI kernel module
142
Group: System/Kernel
143
BuildRequires: %{kernel_module_package_buildreqs}
144
Conflicts: otherproviders(dpdk-any-kmp)
145
%suse_kernel_module_package -p %{_sourcedir}/preamble pae 64kb
146
147
%description kmp
148
The DPDK Kernel NIC Interface (KNI) allows userspace applications access to the Linux* control plane.
149
%endif
150
151
%define sdkdir %{_datadir}/dpdk
152
%define docdir %{_docdir}/dpdk
153
%define incdir %{_includedir}/dpdk
154
%define pmddir %{_libdir}/dpdk-pmds
155
156
%prep
157
# can't use %{name} because of dpdk-thunderx
158
%setup -q -n dpdk-stable-%{version}
159
%patch1 -p1 -z .enic
160
161
# This fixes CROSS compilation (broken) in the mk file for ThunderX
162
sed -i '/^CROSS /s/^/#/' mk/machine/thunderx/rte.vars.mk
163
164
%build
165
# set up a method for modifying the resulting .config file
166
function setconf() {
167
if grep -q ^$1= $3/.config; then
168
sed -i "s:^$1=.*$:$1=$2:g" $3/.config
169
else
170
echo $1=$2 >> $3/.config
171
fi
172
}
173
174
function setdefaultconf()
175
{
176
setconf CONFIG_RTE_MACHINE '"%{machine2}"' $1
177
# Disable experimental features
178
setconf CONFIG_RTE_NEXT_ABI n $1
179
180
# SONAME equals to DPDK release version
181
setconf CONFIG_RTE_MAJOR_ABI %{version} $1
182
183
# Enable automatic driver loading from this path
184
setconf CONFIG_RTE_EAL_PMD_PATH '"%{pmddir}"' $1
185
186
setconf CONFIG_RTE_LIBRTE_BNX2X_PMD y $1
187
setconf CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT y $1
188
setconf CONFIG_RTE_LIBRTE_PMD_PCAP y $1
189
setconf CONFIG_RTE_LIBRTE_VHOST_NUMA y $1
190
setconf CONFIG_RTE_LIBRTE_MLX5_PMD y $1
191
setconf CONFIG_RTE_LIBRTE_MLX4_PMD y $1
192
193
setconf CONFIG_RTE_EAL_IGB_UIO n $1
194
setconf CONFIG_RTE_KNI_KMOD n $1
195
196
%if %{with shared}
197
setconf CONFIG_RTE_BUILD_SHARED_LIB y $1
198
%endif
199
200
%ifarch aarch64 ppc64le
201
setconf CONFIG_RTE_LIBRTE_DISTRIBUTOR n $1
202
%endif
203
%ifarch ppc64le
204
setconf CONFIG_RTE_LIBRTE_PMD_RING n $1
205
setconf CONFIG_RTE_LIBRTE_IXGBE_PMD n $1
206
setconf CONFIG_RTE_LIBRTE_POWER n $1
207
%endif
208
}
209
# In case dpdk-devel is installed, we should ignore its hints about the SDK directories
210
unset RTE_SDK RTE_INCLUDE RTE_TARGET
211
212
# For the release, '-Wno-error=array-bounds' is done to prevent a spurious error
213
# generated by gcc 5.X against the 2.1 branch
214
export EXTRA_CFLAGS="%{optflags} -Wformat -fPIC -Wno-error=array-bounds"
215
216
# DPDK defaults to using builder-specific compiler flags. However,
217
# the config has been changed by specifying CONFIG_RTE_MACHINE=default
218
# in order to build for a more generic host. NOTE: It is possible that
219
# the compiler flags used still won't work for all Fedora-supported
220
# machines, but runtime checks in DPDK will catch those situations.
221
222
make V=1 O=%{target} T=%{target} %{?_smp_mflags} config
223
setdefaultconf %{target}
224
225
%ifnarch %{ix86}
226
export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'
227
for flavor in %{flavors_to_build}; do
228
export RTE_KERNELDIR=%{_prefix}/src/linux-obj/%{_target_cpu}/$flavor
229
make V=1 O=%{target}-$flavor T=%{target} %{?_smp_mflags} config
230
setdefaultconf %{target}-$flavor
231
%ifnarch %{ix86}
232
setconf CONFIG_RTE_EAL_IGB_UIO y %{target}-$flavor
233
setconf CONFIG_RTE_KNI_KMOD y %{target}-$flavor
234
%endif
235
cd %{target}-$flavor
236
make V=1 %{?_smp_mflags}
237
cd -
238
done
239
%endif
240
241
make V=1 O=%{target} %{?_smp_mflags}
242
make V=1 O=%{target} %{?_smp_mflags} doc-api-html
243
244
%if %{with examples}
245
make V=1 O=%{target}/examples T=%{target} %{?_smp_mflags} examples
246
%endif
247
248
%install
249
%ifnarch %{ix86}
250
# export needed for kmp package
251
export EXTRA_CFLAGS='-DVERSION=\"%{version}\"'
252
export INSTALL_MOD_PATH=%{buildroot}
253
export INSTALL_MOD_DIR=updates
254
export BRP_PESIGN_FILES="*.ko"
255
256
for flavor in %{flavors_to_build}; do
257
cd %{target}-$flavor
258
export RTE_KERNELDIR=%{_prefix}/src/linux-obj/%{_target_cpu}/$flavor
259
dir=/usr/src/linux-obj/%{_target_cpu}/$flavor
260
krel=$(make -s -C "$dir" kernelrelease)
261
mkdir -p %{buildroot}/lib/modules/$krel/extra/dpdk/
262
#make install expects same kernel for build and target, lets copy it manually
263
install -m644 ../%{target}-$flavor/kmod/*.ko %{buildroot}/lib/modules/$krel/extra/dpdk/
264
cd -
265
done
266
%endif
267
# In case dpdk-devel is installed
268
unset RTE_SDK RTE_INCLUDE RTE_TARGET
269
270
%make_install O=%{target} prefix=%{_usr} libdir=%{_libdir}
271
272
%if ! %{with tools}
273
rm -rf %{buildroot}%{sdkdir}/usertools/
274
rm -rf %{buildroot}%{_sbindir}/dpdk_nic_bind
275
%endif
276
rm -f %{buildroot}%{sdkdir}/usertools/setup.sh
277
#TODO pip elftools has issues to fix
278
rm -rf %{buildroot}%{_bindir}/dpdk-pmdinfo
279
280
%if %{with examples}
281
find %{target}/examples/ -name "*.map" | xargs rm -f
282
for f in %{target}/examples/*/%{target}/app/*; do
283
bn=`basename ${f}`
284
cp -p ${f} %{buildroot}%{_bindir}/dpdk_example_${bn}
285
done
286
%endif
287
288
# Create a driver directory with symlinks to all pmds
289
mkdir -p %{buildroot}/%{pmddir}
290
for f in %{buildroot}/%{_libdir}/*_pmd_*.so.*; do
291
bn=$(basename ${f})
292
ln -s ../${bn} %{buildroot}%{pmddir}/${bn}
293
done
294
#mempool is a driver now from 16.07
295
mkdir -p %{buildroot}/%{pmddir}
296
for f in %{buildroot}/%{_libdir}/*_mempool_*.so.*; do
297
bn=$(basename ${f})
298
ln -s ../${bn} %{buildroot}%{pmddir}/${bn}
299
done
300
301
# Setup RTE_SDK environment as expected by apps etc
302
mkdir -p %{buildroot}/%{_sysconfdir}/profile.d
303
cat << EOF > %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk-%{_arch}.sh
304
if [ -z "\${RTE_SDK}" ]; then
305
export RTE_SDK="%{sdkdir}"
306
export RTE_TARGET="%{target}"
307
export RTE_INCLUDE="%{incdir}"
308
fi
309
EOF
310
311
cat << EOF > %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk-%{_arch}.csh
312
if ( ! \$RTE_SDK ) then
313
setenv RTE_SDK "%{sdkdir}"
314
setenv RTE_TARGET "%{target}"
315
setenv RTE_INCLUDE "%{incdir}"
316
endif
317
EOF
318
319
# Fixup target machine mismatch
320
sed -i -e 's:-%{machine}-:-%{machine2}-:g' %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk*
321
322
#doc
323
mkdir %{buildroot}%{_docdir}/
324
mv %{buildroot}%{_datadir}/doc/dpdk %{buildroot}%{_docdir}/
325
326
ln -s %{_bindir}/dpdk-procinfo %{buildroot}%{_bindir}/dpdk_proc_info
327
ln -s %{_sbindir}/dpdk-devbind %{buildroot}%{_sbindir}/dpdk_nic_bind
328
329
# Remove duplicates
330
%fdupes %{buildroot}/%{_prefix}
331
332
%post devel -p /sbin/ldconfig
333
%postun devel -p /sbin/ldconfig
334
%post -n %{lname} -p /sbin/ldconfig
335
%postun -n %{lname} -p /sbin/ldconfig
336
337
%files
338
%defattr(-,root,root)
339
# BSD
340
%{_bindir}/testpmd
341
%{_bindir}/dpdk-procinfo
342
%{_bindir}/dpdk_proc_info
343
%{_bindir}/dpdk-pdump
344
345
%files -n %{lname}
346
%defattr(-,root,root)
347
%if %{with shared}
348
%dir %{_libdir}/dpdk-pmds
349
350
%{_libdir}/*.so.*
351
%{pmddir}/
352
%endif
353
354
%files doc
355
%defattr(-,root,root)
356
#BSD
357
%docdir
358
%doc LICENSE.GPL LICENSE.LGPL
359
360
%files devel
361
%defattr(-,root,root)
362
#BSD
363
%{incdir}/
364
%{sdkdir}
365
%if %{with tools}
366
%exclude %{sdkdir}/usertools/
367
%endif
368
%if %{with examples}
369
%exclude %{sdkdir}/examples/
370
%endif
371
%{_sysconfdir}/profile.d/dpdk-sdk-*.*
372
%if ! %{with shared}
373
%{_libdir}/*.a
374
%else
375
%{_libdir}/*.so
376
%endif
377
378
%if %{with tools}
379
%files tools
380
%defattr(-,root,root)
381
%{sdkdir}/usertools/
382
%{_sbindir}/dpdk-devbind
383
%{_sbindir}/dpdk_nic_bind
384
%{_bindir}/dpdk-test-eventdev
385
%{_bindir}/dpdk-test-crypto-perf
386
%endif
387
388
%if %{with examples}
389
%files examples
390
%defattr(-,root,root)
391
%{_bindir}/dpdk_example_*
392
%doc %{sdkdir}/examples
393
%endif
394
395
%changelog
396