rhel: Include pkgconfig and update header install in Fedora/RHEL spec.
[cascardo/ovs.git] / rhel / openvswitch-fedora.spec.in
1 # Spec file for Open vSwitch.
2
3 # Copyright (C) 2009, 2010, 2013, 2014 Nicira Networks, Inc.
4 #
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved.  This file is offered as-is,
8 # without warranty of any kind.
9 #
10 # If tests have to be skipped while building, specify the '--without check'
11 # option. For example:
12 # rpmbuild -bb --without check rhel/openvswitch-fedora.spec
13
14 #%define kernel 2.6.40.4-5.fc15.x86_64
15
16 # Enable PIE, bz#955181
17 %global _hardened_build 1
18
19 Name: openvswitch
20 Summary: Open vSwitch
21 Group: System Environment/Daemons
22 URL: http://www.openvswitch.org/
23 Version: @VERSION@
24
25 # Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
26 # lib/sflow*.[ch] files are SISSL
27 # datapath/ is GPLv2 (although not built into any of the binary packages)
28 # python/compat is Python (although not built into any of the binary packages)
29 License: ASL 2.0 and LGPLv2+ and SISSL
30 Release: 1%{?dist}
31 Source: http://openvswitch.org/releases/%{name}-%{version}.tar.gz
32
33 BuildRequires: autoconf
34 BuildRequires: systemd-units openssl openssl-devel
35 BuildRequires: python python-twisted-core python-zope-interface PyQt4
36 BuildRequires: desktop-file-utils
37 BuildRequires: groff graphviz
38
39 Requires: openssl iproute module-init-tools
40 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
41 Requires: kernel >= 3.15.0-0
42
43 Requires(post): systemd-units
44 Requires(preun): systemd-units
45 Requires(postun): systemd-units
46 Obsoletes: openvswitch-controller <= 0:2.1.0-1
47
48 %bcond_without check
49
50 %description
51 Open vSwitch provides standard network bridging functions and
52 support for the OpenFlow protocol for remote per-flow control of
53 traffic.
54
55 %package -n python-openvswitch
56 Summary: Open vSwitch python bindings
57 License: ASL 2.0
58 BuildArch: noarch
59 Requires: python
60
61 %description -n python-openvswitch
62 Python bindings for the Open vSwitch database
63
64 %package test
65 Summary: Open vSwitch testing utilities
66 License: ASL 2.0
67 BuildArch: noarch
68 Requires: python-openvswitch = %{version}-%{release}
69 Requires: python python-twisted-core python-twisted-web
70
71 %description test
72 Utilities that are useful to diagnose performance and connectivity
73 issues in Open vSwitch setup.
74
75 %package devel
76 Summary: Open vSwitch OpenFlow development package (library, headers)
77 License: ASL 2.0
78 Provides: openvswitch-static = %{version}-%{release}
79
80 %description devel
81 This provides static library, libopenswitch.a and the openvswitch header
82 files needed to build an external application.
83
84
85 %prep
86 %setup -q
87
88 %build
89 %configure --enable-ssl --with-pkidir=%{_sharedstatedir}/openvswitch/pki
90 make %{?_smp_mflags}
91
92 %install
93 rm -rf $RPM_BUILD_ROOT
94 make install DESTDIR=$RPM_BUILD_ROOT
95
96 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
97
98 install -p -D -m 0644 \
99         rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
100         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
101 install -p -D -m 0644 \
102         rhel/usr_lib_systemd_system_openvswitch.service \
103         $RPM_BUILD_ROOT%{_unitdir}/openvswitch.service
104 install -p -D -m 0644 \
105         rhel/usr_lib_systemd_system_openvswitch-nonetwork.service \
106         $RPM_BUILD_ROOT%{_unitdir}/openvswitch-nonetwork.service
107
108 install -m 0755 rhel/etc_init.d_openvswitch \
109         $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/openvswitch.init
110
111 install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \
112         $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/openvswitch
113
114 install -m 0644 vswitchd/vswitch.ovsschema \
115         $RPM_BUILD_ROOT/%{_datadir}/openvswitch/vswitch.ovsschema
116
117 install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/
118 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \
119         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
120 install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \
121         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
122
123 install -d -m 0755 $RPM_BUILD_ROOT%{python_sitelib}
124 mv $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/* \
125    $RPM_BUILD_ROOT%{python_sitelib}
126 rmdir $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
127
128 install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
129
130 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/conf.db
131 touch $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch/system-id.conf
132
133 %check
134 %if %{with check}
135     if make check TESTSUITEFLAGS='%{_smp_mflags}' ||
136        make check TESTSUITEFLAGS='--recheck'; then :;
137     else
138         cat tests/testsuite.log
139         exit 1
140     fi
141 %endif
142
143 %clean
144 rm -rf $RPM_BUILD_ROOT
145
146 %preun
147 %if 0%{?systemd_preun:1}
148     %systemd_preun %{name}.service
149 %else
150     if [ $1 -eq 0 ] ; then
151     # Package removal, not upgrade
152         /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
153         /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
154     fi
155 %endif
156
157
158 %post
159 %if 0%{?systemd_post:1}
160     %systemd_post %{name}.service
161 %else
162     # Package install, not upgrade
163     if [ $1 -eq 1 ]; then
164         /bin/systemctl daemon-reload >dev/null || :
165     fi
166 %endif
167
168
169 %postun
170 %if 0%{?systemd_postun_with_restart:1}
171     %systemd_postun_with_restart %{name}.service
172 %else
173     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
174     if [ "$1" -ge "1" ] ; then
175     # Package upgrade, not uninstall
176         /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
177     fi
178 %endif
179
180
181 %files -n python-openvswitch
182 %{python_sitelib}/ovs
183 %doc COPYING
184
185 %files test
186 %{_bindir}/ovs-test
187 %{_bindir}/ovs-vlan-test
188 %{_bindir}/ovs-l3ping
189 %{_mandir}/man8/ovs-test.8*
190 %{_mandir}/man8/ovs-vlan-test.8*
191 %{_mandir}/man8/ovs-l3ping.8*
192 %{python_sitelib}/ovstest
193
194 %files devel
195 %{_libdir}/*.a
196 %{_libdir}/*.la
197 %{_libdir}/pkgconfig/*.pc
198 %{_includedir}/openvswitch/*
199 %{_includedir}/openflow/*
200
201 %files
202 %defattr(-,root,root)
203 %dir %{_sysconfdir}/openvswitch
204 %config %ghost %{_sysconfdir}/openvswitch/conf.db
205 %config %ghost %{_sysconfdir}/openvswitch/system-id.conf
206 %config(noreplace) %{_sysconfdir}/sysconfig/openvswitch
207 %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch
208 %{_unitdir}/openvswitch.service
209 %{_unitdir}/openvswitch-nonetwork.service
210 %{_datadir}/openvswitch/scripts/openvswitch.init
211 %{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
212 %{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
213 %{_datadir}/openvswitch/bugtool-plugins/
214 %{_datadir}/openvswitch/scripts/ovs-bugtool-*
215 %{_datadir}/openvswitch/scripts/ovs-check-dead-ifs
216 %{_datadir}/openvswitch/scripts/ovs-lib
217 %{_datadir}/openvswitch/scripts/ovs-vtep
218 %{_datadir}/openvswitch/scripts/ovs-ctl
219 %config %{_datadir}/openvswitch/vswitch.ovsschema
220 %config %{_datadir}/openvswitch/vtep.ovsschema
221 %{_bindir}/ovs-appctl
222 %{_bindir}/ovs-docker
223 %{_bindir}/ovs-dpctl
224 %{_bindir}/ovs-dpctl-top
225 %{_bindir}/ovs-ofctl
226 %{_bindir}/ovs-vsctl
227 %{_bindir}/ovsdb-client
228 %{_bindir}/ovsdb-tool
229 %{_bindir}/ovs-testcontroller
230 %{_bindir}/ovs-pki
231 %{_bindir}/vtep-ctl
232 %{_sbindir}/ovs-bugtool
233 %{_sbindir}/ovs-vswitchd
234 %{_sbindir}/ovsdb-server
235 %{_mandir}/man1/ovs-benchmark.1*
236 %{_mandir}/man1/ovs-pcap.1*
237 %{_mandir}/man1/ovs-tcpundump.1*
238 %{_mandir}/man1/ovsdb-client.1*
239 %{_mandir}/man1/ovsdb-server.1*
240 %{_mandir}/man1/ovsdb-tool.1*
241 %{_mandir}/man5/ovs-vswitchd.conf.db.5*
242 %{_mandir}/man5/vtep.5*
243 %{_mandir}/man8/vtep-ctl.8*
244 %{_mandir}/man8/ovs-appctl.8*
245 %{_mandir}/man8/ovs-bugtool.8*
246 %{_mandir}/man8/ovs-ctl.8*
247 %{_mandir}/man8/ovs-dpctl.8*
248 %{_mandir}/man8/ovs-dpctl-top.8*
249 %{_mandir}/man8/ovs-ofctl.8*
250 %{_mandir}/man8/ovs-pki.8*
251 %{_mandir}/man8/ovs-vsctl.8*
252 %{_mandir}/man8/ovs-vswitchd.8*
253 %{_mandir}/man8/ovs-parse-backtrace.8*
254 %{_mandir}/man8/ovs-testcontroller.8*
255 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md
256 %doc FAQ.md NEWS INSTALL.DPDK.md rhel/README.RHEL
257 /var/lib/openvswitch
258 /var/log/openvswitch
259 %exclude %{_bindir}/ovs-benchmark
260 %exclude %{_bindir}/ovs-parse-backtrace
261 %exclude %{_bindir}/ovs-pcap
262 %exclude %{_bindir}/ovs-tcpundump
263 %exclude %{_sbindir}/ovs-vlan-bug-workaround
264 %exclude %{_mandir}/man1/ovs-benchmark.1.gz
265 %exclude %{_mandir}/man1/ovs-pcap.1.gz
266 %exclude %{_mandir}/man1/ovs-tcpundump.1.gz
267 %exclude %{_mandir}/man8/ovs-vlan-bug-workaround.8.gz
268 %exclude %{_datadir}/openvswitch/scripts/ovs-save
269
270 %changelog
271 * Wed Jan 12 2011 Ralf Spenneberg <ralf@os-s.net>
272 - First build on F14