dpif-netlink: add GENEVE creation support
[cascardo/ovs.git] / rhel / openvswitch.spec.in
1 # Spec file for Open vSwitch on Red Hat Enterprise Linux.
2
3 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, 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.spec
13
14 Name: openvswitch
15 Summary: Open vSwitch daemon/database/utilities
16 Group: System Environment/Daemons
17 URL: http://www.openvswitch.org/
18 Vendor: Nicira, Inc.
19 Version: @VERSION@
20
21 License: ASL 2.0
22 Release: 1
23 Source: openvswitch-%{version}.tar.gz
24 Buildroot: /tmp/openvswitch-rpm
25 Requires: logrotate, python >= 2.7, python-six
26 BuildRequires: openssl-devel
27
28 %bcond_without check
29
30 %description
31 Open vSwitch provides standard network bridging functions and
32 support for the OpenFlow protocol for remote per-flow control of
33 traffic.
34
35 %package devel
36 Summary:        Open vSwitch development package
37 Group:          Development/Libraries
38
39 %description devel
40 This package provides openvswitch headers and libopenvswitch for developers.
41
42 %prep
43 %setup -q
44
45 %build
46 ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
47     --libdir=%{_libdir} --enable-ssl --enable-shared
48 make %{_smp_mflags}
49
50 %install
51 rm -rf $RPM_BUILD_ROOT
52 make install DESTDIR=$RPM_BUILD_ROOT
53
54 rhel_cp() {
55  base=$1
56  mode=$2
57  dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g')
58  install -D -m $mode rhel/$base $dst
59 }
60 rhel_cp etc_init.d_openvswitch 0755
61 rhel_cp etc_logrotate.d_openvswitch 0644
62 rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
63 rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
64 rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
65
66 # Get rid of stuff we don't want to make RPM happy.
67 rm \
68     $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
69     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
70     $RPM_BUILD_ROOT/usr/bin/ovs-test \
71     $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
72     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
73     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
74     $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
75     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8 \
76     $RPM_BUILD_ROOT/usr/bin/ovn-* \
77     $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \
78     $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \
79     $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn-*
80 (cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
81 (cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
82
83 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
84
85 copy_headers() {
86     src=$1
87     dst=$RPM_BUILD_ROOT/$2
88     install -d -m 0755 $dst
89     install -m 0644 $src/*.h $dst
90 }
91 copy_headers include %{_includedir}/openvswitch
92 copy_headers include/openflow %{_includedir}/openvswitch/openflow
93 copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
94 copy_headers include/sparse %{_includedir}/openvswitch/sparse
95 copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
96 copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
97 copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
98 copy_headers lib %{_includedir}/openvswitch/lib
99
100 install -D -m 0644 lib/.libs/libopenvswitch.a \
101     $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
102
103 %check
104 %if %{with check}
105     if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
106     else
107         cat tests/testsuite.log
108         exit 1
109     fi
110 %endif
111
112 %clean
113 rm -rf $RPM_BUILD_ROOT
114
115 %post
116 # Create default or update existing /etc/sysconfig/openvswitch.
117 SYSCONFIG=/etc/sysconfig/openvswitch
118 TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
119 if [ ! -e $SYSCONFIG ]; then
120     cp $TEMPLATE $SYSCONFIG
121 else
122     for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
123     do
124         if ! grep $var $SYSCONFIG >/dev/null 2>&1; then
125             echo >> $SYSCONFIG
126             sed -n "/$var:/,/$var=/p" $TEMPLATE >> $SYSCONFIG
127         fi
128     done
129 fi
130
131 # Ensure all required services are set to run
132 /sbin/chkconfig --add openvswitch
133 /sbin/chkconfig openvswitch on
134
135 %preun
136 if [ "$1" = "0" ]; then     # $1 = 0 for uninstall
137     /sbin/service openvswitch stop
138     /sbin/chkconfig --del openvswitch
139 fi
140
141 %postun
142 if [ "$1" = "0" ]; then     # $1 = 0 for uninstall
143     rm -f /etc/openvswitch/conf.db
144     rm -f /etc/sysconfig/openvswitch
145     rm -f /etc/openvswitch/vswitchd.cacert
146 fi
147
148 exit 0
149
150 %files
151 %defattr(-,root,root)
152 %dir /etc/openvswitch
153 /etc/bash_completion.d/ovs-appctl-bashcomp.bash
154 /etc/bash_completion.d/ovs-vsctl-bashcomp.bash
155 /etc/init.d/openvswitch
156 %config(noreplace) /etc/logrotate.d/openvswitch
157 /etc/sysconfig/network-scripts/ifup-ovs
158 /etc/sysconfig/network-scripts/ifdown-ovs
159 /usr/bin/ovs-appctl
160 /usr/bin/ovs-dpctl
161 /usr/bin/ovs-dpctl-top
162 /usr/bin/ovs-docker
163 /usr/bin/ovs-ofctl
164 /usr/bin/ovs-parse-backtrace
165 /usr/bin/ovs-pcap
166 /usr/bin/ovs-pki
167 /usr/bin/ovs-tcpundump
168 /usr/bin/ovs-vlan-test
169 /usr/bin/ovs-vsctl
170 /usr/bin/ovsdb-client
171 /usr/bin/ovsdb-tool
172 /usr/bin/vtep-ctl
173 %{_libdir}/lib*.so.*
174 /usr/sbin/ovs-bugtool
175 /usr/sbin/ovs-vswitchd
176 /usr/sbin/ovsdb-server
177 /usr/share/man/man1/ovs-pcap.1.gz
178 /usr/share/man/man1/ovs-tcpundump.1.gz
179 /usr/share/man/man1/ovsdb-client.1.gz
180 /usr/share/man/man1/ovsdb-server.1.gz
181 /usr/share/man/man1/ovsdb-tool.1.gz
182 /usr/share/man/man5/ovs-vswitchd.conf.db.5.gz
183 /usr/share/man/man5/vtep.5.gz
184 /usr/share/man/man8/ovs-appctl.8.gz
185 /usr/share/man/man8/ovs-bugtool.8.gz
186 /usr/share/man/man8/ovs-ctl.8.gz
187 /usr/share/man/man8/ovs-dpctl.8.gz
188 /usr/share/man/man8/ovs-dpctl-top.8.gz
189 /usr/share/man/man8/ovs-ofctl.8.gz
190 /usr/share/man/man8/ovs-parse-backtrace.8.gz
191 /usr/share/man/man8/ovs-pki.8.gz
192 /usr/share/man/man8/ovs-vlan-test.8.gz
193 /usr/share/man/man8/ovs-vsctl.8.gz
194 /usr/share/man/man8/ovs-vswitchd.8.gz
195 /usr/share/man/man8/vtep-ctl.8.gz
196 /usr/share/openvswitch/bugtool-plugins/
197 /usr/share/openvswitch/python/
198 /usr/share/openvswitch/scripts/ovs-bugtool-*
199 /usr/share/openvswitch/scripts/ovs-check-dead-ifs
200 /usr/share/openvswitch/scripts/ovs-ctl
201 /usr/share/openvswitch/scripts/ovs-lib
202 /usr/share/openvswitch/scripts/ovs-save
203 /usr/share/openvswitch/scripts/ovs-vtep
204 /usr/share/openvswitch/scripts/sysconfig.template
205 /usr/share/openvswitch/vswitch.ovsschema
206 /usr/share/openvswitch/vtep.ovsschema
207 %doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md FAQ.md NEWS
208 %doc INSTALL.DPDK.md rhel/README.RHEL README-native-tunneling.md
209 /var/lib/openvswitch
210 /var/log/openvswitch
211
212 %files devel
213 %{_libdir}/lib*.so
214 %{_libdir}/lib*.a
215 %{_libdir}/pkgconfig
216 %{_includedir}/openvswitch/*