pkg: update RPM
[dpdk.git] / pkg / dpdk.spec
1 # Copyright 2014 6WIND S.A.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 #
7 # - Redistributions of source code must retain the above copyright
8 #   notice, this list of conditions and the following disclaimer.
9 #
10 # - Redistributions in binary form must reproduce the above copyright
11 #   notice, this list of conditions and the following disclaimer in
12 #   the documentation and/or other materials provided with the
13 #   distribution.
14 #
15 # - Neither the name of 6WIND S.A. nor the names of its
16 #   contributors may be used to endorse or promote products derived
17 #   from this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30 # OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 Name: dpdk
33 Version: 1.8.0
34 Release: 1
35 Packager: packaging@6wind.com
36 URL: http://dpdk.org
37 Source: http://dpdk.org/browse/dpdk/snapshot/dpdk-%{version}.tar.gz
38
39 Summary: Data Plane Development Kit core
40 Group: System Environment/Libraries
41 License: BSD and LGPLv2 and GPLv2
42
43 ExclusiveArch: i686, x86_64
44 %global target %{_arch}-native-linuxapp-gcc
45 %global machine default
46
47 BuildRequires: kernel-devel, kernel-headers, libpcap-devel, xen-devel
48 BuildRequires: doxygen, python-sphinx, inkscape
49 BuildRequires: texlive-collection-latexextra, texlive-collection-fontsextra
50
51 %description
52 DPDK core includes kernel modules, core libraries and tools.
53 testpmd application allows to test fast packet processing environments
54 on x86 platforms. For instance, it can be used to check that environment
55 can support fast path applications such as 6WINDGate, pktgen, rumptcpip, etc.
56 More libraries are available as extensions in other packages.
57
58 %package devel
59 Summary: Data Plane Development Kit for development
60 Requires: %{name}%{?_isa} = %{version}-%{release}
61 %description devel
62 DPDK devel is a set of makefiles, headers and examples
63 for fast packet processing on x86 platforms.
64
65 %package doc
66 Summary: Data Plane Development Kit API documentation
67 BuildArch: noarch
68 %description doc
69 DPDK doc is divided in two parts: API details in doxygen HTML format
70 and guides in sphinx HTML/PDF formats.
71
72 %global destdir %{buildroot}%{_prefix}
73 %global moddir  /lib/modules/%(uname -r)/extra
74 %global datadir %{_datadir}/dpdk
75 %global docdir  %{_docdir}/dpdk
76
77 %prep
78 %setup -q
79
80 %build
81 make O=%{target} T=%{target} config
82 sed -ri 's,(RTE_MACHINE=).*,\1%{machine},' %{target}/.config
83 sed -ri 's,(RTE_APP_TEST=).*,\1n,'         %{target}/.config
84 sed -ri 's,(RTE_BUILD_SHARED_LIB=).*,\1y,' %{target}/.config
85 sed -ri 's,(LIBRTE_VHOST=).*,\1y,'         %{target}/.config
86 sed -ri 's,(LIBRTE_PMD_PCAP=).*,\1y,'      %{target}/.config
87 sed -ri 's,(LIBRTE_PMD_XENVIRT=).*,\1y,'   %{target}/.config
88 sed -ri 's,(LIBRTE_XEN_DOM0=).*,\1y,'      %{target}/.config
89 make O=%{target} %{?_smp_mflags}
90 make O=%{target} doc
91
92 %install
93 rm -rf %{buildroot}
94 make            O=%{target}      DESTDIR=%{destdir}
95 mkdir -p                                 %{buildroot}%{moddir}
96 mv     %{destdir}/%{target}/kmod/*.ko    %{buildroot}%{moddir}
97 rmdir  %{destdir}/%{target}/kmod
98 mkdir -p                                 %{buildroot}%{_sbindir}
99 ln -s  %{datadir}/tools/*nic_bind.py     %{buildroot}%{_sbindir}/dpdk_nic_bind
100 mkdir -p                                 %{buildroot}%{_bindir}
101 mv     %{destdir}/%{target}/app/testpmd  %{buildroot}%{_bindir}
102 rmdir  %{destdir}/%{target}/app
103 mv     %{destdir}/%{target}/include      %{buildroot}%{_includedir}
104 mv     %{destdir}/%{target}/lib          %{buildroot}%{_libdir}
105 mkdir -p                                 %{buildroot}%{docdir}
106 rm -rf %{destdir}/%{target}/doc/*/*/.{build,doc}*
107 mv     %{destdir}/%{target}/doc/html/*   %{buildroot}%{docdir}
108 mv     %{destdir}/%{target}/doc/*/*/*pdf %{buildroot}%{docdir}/guides
109 rm -rf %{destdir}/%{target}/doc
110 mkdir -p                                 %{buildroot}%{datadir}
111 mv     %{destdir}/%{target}/.config      %{buildroot}%{datadir}/config
112 mv     %{destdir}/%{target}              %{buildroot}%{datadir}
113 mv     %{destdir}/scripts                %{buildroot}%{datadir}
114 mv     %{destdir}/mk                     %{buildroot}%{datadir}
115 cp -a             examples               %{buildroot}%{datadir}
116 cp -a             tools                  %{buildroot}%{datadir}
117 ln -s             %{datadir}/config      %{buildroot}%{datadir}/%{target}/.config
118 ln -s             %{_includedir}         %{buildroot}%{datadir}/%{target}/include
119 ln -s             %{_libdir}             %{buildroot}%{datadir}/%{target}/lib
120
121 %files
122 %dir %{datadir}
123 %{datadir}/config
124 %{datadir}/tools
125 %{moddir}/*
126 %{_sbindir}/*
127 %{_bindir}/*
128 %{_libdir}/*
129
130 %files devel
131 %{_includedir}/*
132 %{datadir}/mk
133 %{datadir}/scripts
134 %{datadir}/%{target}
135 %{datadir}/examples
136
137 %files doc
138 %doc %{docdir}
139
140 %post
141 /sbin/ldconfig
142 /sbin/depmod
143
144 %postun
145 /sbin/ldconfig
146 /sbin/depmod