dpdk.spec revision 66ff7c11
1# Add option to build as static libraries (--without shared)
2%bcond_without shared
3# Add option to build without examples
4%bcond_without examples
5# Add option to build without tools
6%bcond_without tools
7
8# Dont edit Version: and Release: directly, only these:
9%define ver %{?_ver}
10%define rel 1
11# Define when building git snapshots
12
13%define srcver %{ver}%{?_snapver:.%{_snapver}}
14
15# Add option to build the PDF documentation separately (--with pdfdoc)
16%bcond_with pdfdoc
17
18Name: dpdk
19Version: %{ver}
20Release:%{?_snapver:%{_snapver}.}%{rel}%{?dist}
21Epoch: 2
22URL: http://dpdk.org
23Source: http://dpdk.org/browse/dpdk/snapshot/dpdk-%{srcver}.tar.gz
24
25Summary: Set of libraries and drivers for fast packet processing
26
27#
28# Note that, while this is dual licensed, all code that is included with this
29# Pakcage are BSD licensed. The only files that aren't licensed via BSD is the
30# kni kernel module which is dual LGPLv2/BSD, and thats not built for fedora.
31#
32License: BSD and LGPLv2 and GPLv2
33
34#
35# The DPDK is designed to optimize througput of network traffic using, among
36# other techniques, carefully crafted assembly instructions.  As such it
37# needs extensive work to port it to other architectures.
38#
39ExclusiveArch: x86_64 i686 aarch64 ppc64le
40
41# machine_arch maps between rpm and dpdk arch name, often same as _target_cpu
42# machine_tmpl is the config template machine name, often "native"
43# machine is the actual machine name used in the dpdk make system
44%ifarch x86_64
45%define machine_arch x86_64
46%define machine_tmpl native
47%define machine default
48%endif
49%ifarch i686
50%define machine_arch i686
51%define machine_tmpl native
52%define machine default
53%endif
54%ifarch aarch64
55%define machine_arch arm64
56%define machine_tmpl armv8a
57%define machine armv8a
58%endif
59%ifarch ppc64le
60%define machine_arch ppc_64
61%define machine_tmpl power8
62%define machine power8
63%endif
64
65
66%define target %{machine_arch}-%{machine_tmpl}-linuxapp-gcc
67
68BuildRequires: gcc
69BuildRequires: kernel-headers, libpcap-devel, doxygen, zlib-devel
70%if 0%{?fedora} >= 25
71BuildRequires: python3-sphinx
72%else
73BuildRequires: python-sphinx
74%endif
75BuildRequires: numactl-devel
76%if %{with pdfdoc}
77BuildRequires: texlive-dejavu inkscape texlive-latex-bin-bin
78BuildRequires: texlive-kpathsea-bin texlive-metafont-bin texlive-cm
79BuildRequires: texlive-cmap texlive-ec texlive-babel-english
80BuildRequires: texlive-fancyhdr texlive-fancybox texlive-titlesec BuildRequires: texlive-framed texlive-threeparttable texlive-mdwtools
81BuildRequires: texlive-wrapfig texlive-parskip texlive-upquote texlive-multirow
82BuildRequires: texlive-helvetic texlive-times texlive-dvips
83%endif
84
85%description
86The Data Plane Development Kit is a set of libraries and drivers for
87fast packet processing in the user space.
88
89%package devel
90Summary: Data Plane Development Kit development files
91Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
92%if ! %{with shared}
93Provides: %{name}-static = %{epoch}:%{version}-%{release}
94%endif
95
96%description devel
97This package contains the headers and other files needed for developing
98applications with the Data Plane Development Kit.
99
100%package doc
101Summary: Data Plane Development Kit API documentation
102BuildArch: noarch
103
104%description doc
105API programming documentation for the Data Plane Development Kit.
106
107%if %{with tools}
108%package tools
109Summary: Tools for setting up Data Plane Development Kit environment
110Requires: %{name} = %{epoch}:%{version}-%{release}
111Requires: kmod pciutils findutils iproute
112
113%if 0%{?fedora} >= 25
114Requires: python3-pyelftools
115%endif
116%description tools
117%{summary}
118%endif
119
120%if %{with examples}
121%package examples
122Summary: Data Plane Development Kit example applications
123BuildRequires: libvirt-devel
124
125%description examples
126Example applications utilizing the Data Plane Development Kit, such
127as L2 and L3 forwarding.
128%endif
129
130%define sdkdir  %{_datadir}/%{name}
131%define docdir  %{_docdir}/%{name}
132%define incdir %{_includedir}/%{name}
133%define pmddir %{_libdir}/%{name}-pmds
134
135%prep
136%setup -q -n dpdk-%{version}
137#%patch0 -p1
138
139%build
140# set up a method for modifying the resulting .config file
141function setconf() {
142	if grep -q ^$1= %{target}/.config; then
143		sed -i "s:^$1=.*$:$1=$2:g" %{target}/.config
144	else
145		echo $1=$2 >> %{target}/.config
146	fi
147}
148
149# In case dpdk-devel is installed, we should ignore its hints about the SDK directories
150unset RTE_SDK RTE_INCLUDE RTE_TARGET
151
152# Note: _hardening_ldflags has to go on the extra cflags line because dpdk is
153# astoundingly convoluted in how it processes its linker flags.  Fixing it in
154# dpdk is the preferred solution, but adjusting to allow a gcc option in the
155# ldflags, even when gcc is used as the linker, requires large tree-wide changes
156export EXTRA_CFLAGS="$(echo %{optflags} | sed -e 's:-Wall::g' -e 's:-march=[[:alnum:]]* ::g') -Wformat -fPIC %{_hardening_ldflags}"
157export EXTRA_LDFLAGS=$(echo %{__global_ldflags} | sed -e's/-Wl,//g' -e's/-spec.*//')
158export HOST_EXTRA_CFLAGS=$EXTRA_CFLAGS
159export EXTRA_HOST_LDFLAGS=$(echo %{__global_ldflags} | sed -e's/-spec.*//')
160
161# DPDK defaults to using builder-specific compiler flags.  However,
162# the config has been changed by specifying CONFIG_RTE_MACHINE=default
163# in order to build for a more generic host.  NOTE: It is possible that
164# the compiler flags used still won't work for all Fedora-supported
165# machines, but runtime checks in DPDK will catch those situations.
166make V=1 O=%{target} T=%{target} %{?_smp_mflags} config
167
168setconf CONFIG_RTE_MACHINE '"%{machine}"'
169# Disable experimental features
170setconf CONFIG_RTE_NEXT_ABI n
171setconf CONFIG_RTE_LIBRTE_MBUF_OFFLOAD n
172# Disable unmaintained features
173setconf CONFIG_RTE_LIBRTE_POWER n
174
175# Enable automatic driver loading from this path
176setconf CONFIG_RTE_EAL_PMD_PATH '"%{pmddir}"'
177
178setconf CONFIG_RTE_LIBRTE_BNX2X_PMD y
179setconf CONFIG_RTE_LIBRTE_PMD_PCAP y
180setconf CONFIG_RTE_LIBRTE_VHOST_NUMA y
181
182setconf CONFIG_RTE_EAL_IGB_UIO n
183setconf CONFIG_RTE_LIBRTE_KNI n
184setconf CONFIG_RTE_KNI_KMOD n
185setconf CONFIG_RTE_KNI_PREEMPT_DEFAULT n
186
187setconf CONFIG_RTE_APP_EVENTDEV n
188
189setconf CONFIG_RTE_LIBRTE_NFP_PMD y
190
191%ifarch aarch64
192setconf CONFIG_RTE_LIBRTE_DPAA_BUS n
193setconf CONFIG_RTE_LIBRTE_DPAA_MEMPOOL n
194setconf CONFIG_RTE_LIBRTE_DPAA_PMD n
195%endif
196
197%if %{with shared}
198setconf CONFIG_RTE_BUILD_SHARED_LIB y
199%endif
200
201make V=1 O=%{target} %{?_smp_mflags} -Wimplicit-fallthrough=0
202make V=1 O=%{target} %{?_smp_mflags} doc-api-html doc-guides-html %{?with_pdfdoc: guides-pdf}
203
204%if %{with examples}
205make V=1 O=%{target}/examples T=%{target} %{?_smp_mflags} examples
206%endif
207
208%install
209# In case dpdk-devel is installed
210unset RTE_SDK RTE_INCLUDE RTE_TARGET
211
212%make_install O=%{target} prefix=%{_usr} libdir=%{_libdir}
213
214%if ! %{with tools}
215rm -rf %{buildroot}%{sdkdir}/usertools
216rm -rf %{buildroot}%{_sbindir}/dpdk_nic_bind
217rm -rf %{buildroot}%{_bindir}/dpdk-test-crypto-perf
218%endif
219rm -f %{buildroot}%{sdkdir}/usertools/dpdk-setup.sh
220
221%if %{with examples}
222find %{target}/examples/ -name "*.map" | xargs rm -f
223for f in %{target}/examples/*/%{target}/app/*; do
224    bn=`basename ${f}`
225    cp -p ${f} %{buildroot}%{_bindir}/dpdk_example_${bn}
226done
227%endif
228
229%if 0%{?fedora} >= 25
230# Replace /usr/bin/env python with /usr/bin/python3
231find %{buildroot}%{sdkdir}/ -name "*.py" -exec \
232  sed -i -e 's|#!\s*/usr/bin/env python|#!/usr/bin/python3|' {} +
233%endif
234
235# Create a driver directory with symlinks to all pmds
236mkdir -p %{buildroot}/%{pmddir}
237for f in %{buildroot}/%{_libdir}/*_pmd_*.so.*; do
238    bn=$(basename ${f})
239    ln -s ../${bn} %{buildroot}%{pmddir}/${bn}
240done
241
242# Setup RTE_SDK environment as expected by apps etc
243mkdir -p %{buildroot}/%{_sysconfdir}/profile.d
244cat << EOF > %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk-%{_arch}.sh
245if [ -z "\${RTE_SDK}" ]; then
246    export RTE_SDK="%{sdkdir}"
247    export RTE_TARGET="%{target}"
248    export RTE_INCLUDE="%{incdir}"
249fi
250EOF
251
252cat << EOF > %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk-%{_arch}.csh
253if ( ! \$RTE_SDK ) then
254    setenv RTE_SDK "%{sdkdir}"
255    setenv RTE_TARGET "%{target}"
256    setenv RTE_INCLUDE "%{incdir}"
257endif
258EOF
259
260# Fixup target machine mismatch
261sed -i -e 's:-%{machine_tmpl}-:-%{machine}-:g' %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk*
262
263%files
264# BSD
265%{_bindir}/testpmd
266%{_bindir}/dpdk-procinfo
267%if %{with shared}
268%{_libdir}/*.so.*
269%{pmddir}/
270%endif
271
272%files doc
273#BSD
274%{docdir}
275
276%files devel
277#BSD
278%{incdir}/
279%{sdkdir}
280%if %{with tools}
281%exclude %{sdkdir}/usertools/
282%endif
283%if %{with examples}
284%exclude %{sdkdir}/examples/
285%endif
286%{_sysconfdir}/profile.d/dpdk-sdk-*.*
287%if ! %{with shared}
288%{_libdir}/*.a
289%else
290%{_libdir}/*.so
291%endif
292
293%if %{with tools}
294%files tools
295%{sdkdir}/usertools/
296%{_sbindir}/dpdk-devbind
297%{_bindir}/dpdk-pdump
298%{_bindir}/dpdk-pmdinfo
299%{_bindir}/dpdk-test-crypto-perf
300%endif
301
302%if %{with examples}
303%files examples
304%{_bindir}/dpdk_example_*
305%doc %{sdkdir}/examples
306%endif
307
308%changelog
309* Mon Jun 4 2018 Thomas F Herbert <therbert@redhat.com> - 17.11.2-2
310- Backport changes from Fedora 28 17.11.2-1.f28
311- Remove dependency on Python3 for Centos
312
313* Tue Apr 24 2018 Neil Horman <nhorman@redhat.com> - 2:17.11.2-1
314- Update to latest 17.11 LTS (fixes bz 1571352)
315
316* Tue Apr 10 2018 Timothy Redaelli <tredaelli@redhat.com> - 2:17.11.1-2
317- Fix Requires dpdk by adding epoch (bz 1564215)
318
319* Mon Apr 09 2018 Neil Horman <nhorman@redhat.com> - 17.11.1-1
320- sync rawhide updates (including LTS shift) with f28 (bz 1564215)
321
322* Thu Apr 05 2018 Neil Horman <nhorman@redhat.com> - 18.02-6
323- Remove some debug checks (bz 1548404)
324
325* Thu Apr 05 2018 Neil Horman <nhorman@redhat.com> - 18.02-5
326- Fix compiler flag error (bz 1548404)
327
328* Tue Mar 20 2018 Neil Horman <nhorman@redhat.com> - 18.02-4
329- Update ldflags (bz 1548404)
330- bump release to keep it in line with rawhide
331
332* Fri Mar 02 2018 Neil Horman <nhorman@redhat.com> - 18.02-2
333- update to latest upstream (bz 1550708)
334
335* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 17.11-4
336- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
337
338* Wed Jan 03 2018 Iryna Shcherbina <ishcherb@redhat.com> - 17.11-3
339- Update Python 2 dependency declarations to new packaging standards
340  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
341
342* Thu Nov 30 2017 Neil Horman <nhorman@redhat.com> - 17.11-2
343- Fix dangling symlinks (bz 1519322)
344- Fix devtools->usertools conversion (bz 1519332)
345- Fix python-pyelftools requirement (bz 1519336)
346
347* Thu Nov 16 2017 Neil Horman <nhorman@redhat.com> - 17.11-1
348- Update to latest upstream
349
350* Wed Aug 09 2017 Neil Horman <nhorman@redhat.com> - 17.08-1
351- Update to latest upstream
352
353* Mon Jul 31 2017 Neil Horman <nhorman@redhat.com> - 17.05-2
354- backport rte_eth_tx_done_cleanup map fix (#1476341)
355
356* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 17.05-2
357- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
358
359* Mon May 15 2017 Neil Horman <nhorman@redhat.com> - 17.05-1
360- Update to latest upstream
361
362* Fri Feb 24 2017 Neil Horman <nhorman@redhat.com> - 17-02-2
363- Add python dependency (#1426561)
364
365* Wed Feb 15 2017 Fedora Release Monitoring  <release-monitoring@fedoraproject.org> - 17.02-1
366- Update to 17.02 (#1422285)
367
368* Mon Feb 06 2017 Yaakov Selkowitz <yselkowi@redhat.com> - 16.11-2
369- Enable aarch64, ppc64le (#1419731)
370
371* Tue Nov 15 2016 Neil Horman <nhorman@redhat.com> - 16.11-1
372- Update to 16.11
373
374* Tue Aug 02 2016 Neil Horman <nhorman@redhat.com> - 16.07-1
375* Update to 16.07
376
377* Thu Apr 14 2016 Panu Matilainen <pmatilai@redhat.com> - 16.04-1
378- Update to 16.04
379- Drop all patches, they're not needed anymore
380- Drop linker script generation, its upstream now
381- Enable vhost numa support again
382
383* Wed Mar 16 2016 Panu Matilainen <pmatilai@redhat.com> - 2.2.0-7
384- vhost numa code causes crashes, disable until upstream fixes
385- Generalize target/machine/etc macros to enable i686 builds
386
387* Tue Mar 01 2016 Panu Matilainen <pmatilai@redhat.com> - 2.2.0-6
388- Drop no longer needed bnx2x patch, the gcc false positive has been fixed
389- Drop no longer needed -Wno-error=array-bounds from CFLAGS
390- Eliminate the need for the enic patch by eliminating second -Wall from CFLAGS
391- Disable unmaintained librte_power as per upstream recommendation
392
393* Mon Feb 15 2016 Neil Horman <nhorman@redhat.com> 2.2.0-5
394- Fix ftbfs isssue (1307431)
395
396* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-4
397- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
398
399* Tue Jan 26 2016 Panu Matilainen <pmatilai@redhat.com> - 2.2.0-3
400- Use a different quoting method to avoid messing up vim syntax highlighting
401- A string is expected as CONFIG_RTE_MACHINE value, quote it too
402
403* Mon Jan 25 2016 Panu Matilainen <pmatilai@redhat.com> - 2.2.0-2
404- Enable librte_vhost NUMA-awareness
405
406* Wed Jan 20 2016 Panu Matilainen <pmatilai@redhat.com> - 2.2.0-1
407- Update to 2.2.0
408- Establish a driver directory for automatic driver loading
409- Move the unversioned pmd symlinks from libdir -devel
410- Make option matching stricter in spec setconf
411- Spec cleanups
412- Adopt upstream standard installation layout
413
414* Thu Oct 22 2015 Aaron Conole <aconole@redhat.com> - 2.1.0-3
415- Include examples binaries
416- Enable the Broadcom NetXtreme II 10Gb PMD
417- Fix up linkages for the dpdk-devel package
418
419* Wed Sep 30 2015 Aaron Conole <aconole@redhat.com> - 2.1.0-2
420- Re-enable the IGB, IXGBE, I40E PMDs
421- Bring the Fedora and RHEL packages more in-line.
422
423* Wed Aug 26 2015 Neil Horman <nhorman@redhat.com> - 2.1.0-1
424- Update to latest version
425
426* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-2
427- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
428
429* Mon Apr 06 2015 Neil Horman <nhorman@redhat.com> - 2.0.0-1
430- Update to dpdk 2.0
431- converted --with shared option to --without shared option
432
433* Wed Jan 28 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-8
434- Always build with -fPIC
435
436* Wed Jan 28 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-7
437- Policy compliance: move static libraries to -devel, provide dpdk-static
438- Add a spec option to build as shared libraries
439
440* Wed Jan 28 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-6
441- Avoid variable expansion in the spec here-documents during build
442- Drop now unnecessary debug flags patch
443- Add a spec option to build a combined library
444
445* Tue Jan 27 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-5
446- Avoid unnecessary use of %%global, lazy expansion is normally better
447- Drop unused destdir macro while at it
448- Arrange for RTE_SDK environment + directory layout expected by DPDK apps
449- Drop config from main package, it shouldn't be needed at runtime
450
451* Tue Jan 27 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-4
452- Copy the headers instead of broken symlinks into -devel package
453- Force sane mode on the headers
454- Avoid unnecessary %%exclude by not copying unpackaged content to buildroot
455- Clean up summaries and descriptions
456- Drop unnecessary kernel-devel BR, we are not building kernel modules
457
458* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7.0-3
459- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
460
461* Thu Jul 17 2014 - John W. Linville <linville@redhat.com> - 1.7.0-2
462- Use EXTRA_CFLAGS to include standard Fedora compiler flags in build
463- Set CONFIG_RTE_MACHINE=default to build for least-common-denominator machines
464- Turn-off build of librte_acl, since it does not build on default machines
465- Turn-off build of physical device PMDs that require kernel support
466- Clean-up the install rules to match current packaging
467- Correct changelog versions 1.0.7 -> 1.7.0
468- Remove ix86 from ExclusiveArch -- it does not build with above changes
469
470* Thu Jul 10 2014 - Neil Horman <nhorman@tuxdriver.com> - 1.7.0-1.0
471- Update source to official 1.7.0 release 
472
473* Thu Jul 03 2014 - Neil Horman <nhorman@tuxdriver.com>
474- Fixing up release numbering
475
476* Tue Jul 01 2014 - Neil Horman <nhorman@tuxdriver.com> - 1.7.0-0.9.1.20140603git5ebbb1728
477- Fixed some build errors (empty debuginfo, bad 32 bit build)
478
479* Wed Jun 11 2014 - Neil Horman <nhorman@tuxdriver.com> - 1.7.0-0.9.20140603git5ebbb1728
480- Fix another build dependency
481
482* Mon Jun 09 2014 - Neil Horman <nhorman@tuxdriver.com> - 1.7.0-0.8.20140603git5ebbb1728
483- Fixed doc arch versioning issue
484
485* Mon Jun 09 2014 - Neil Horman <nhorman@tuxdriver.com> - 1.7.0-0.7.20140603git5ebbb1728
486- Added verbose output to build
487
488* Tue May 13 2014 - Neil Horman <nhorman@tuxdriver.com> - 1.7.0-0.6.20140603git5ebbb1728
489- Initial Build
490
491