]> git.proxmox.com Git - mirror_ovs.git/blame - rhel/openvswitch.spec.in
debian, rhel: Ship ovs shared libraries and header files
[mirror_ovs.git] / rhel / openvswitch.spec.in
CommitLineData
c434706a
BP
1# Spec file for Open vSwitch on Red Hat Enterprise Linux.
2
e7529141 3# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
c434706a
BP
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.
329cf232
GS
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
c434706a
BP
13
14Name: openvswitch
15Summary: Open vSwitch daemon/database/utilities
16Group: System Environment/Daemons
17URL: http://www.openvswitch.org/
e0edde6f 18Vendor: Nicira, Inc.
c434706a
BP
19Version: @VERSION@
20
21License: ASL 2.0
22Release: 1
23Source: openvswitch-%{version}.tar.gz
24Buildroot: /tmp/openvswitch-rpm
73eb682e 25Requires: logrotate, python >= 2.7, python-six
4465062f 26BuildRequires: openssl-devel
c434706a 27
329cf232
GS
28%bcond_without check
29
c434706a
BP
30%description
31Open vSwitch provides standard network bridging functions and
32support for the OpenFlow protocol for remote per-flow control of
33traffic.
34
4886d4d2
EC
35%package devel
36Summary: Open vSwitch development package
37Group: Development/Libraries
38
39%description devel
40This package provides openvswitch headers and libopenvswitch for developers.
41
c434706a
BP
42%prep
43%setup -q
44
45%build
4886d4d2
EC
46./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
47 --libdir=%{_libdir} --enable-ssl --enable-shared
c434706a
BP
48make %{_smp_mflags}
49
50%install
51rm -rf $RPM_BUILD_ROOT
52make install DESTDIR=$RPM_BUILD_ROOT
53755990
CW
53
54rhel_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}
60rhel_cp etc_init.d_openvswitch 0755
61rhel_cp etc_logrotate.d_openvswitch 0644
62rhel_cp etc_sysconfig_network-scripts_ifup-ovs 0755
63rhel_cp etc_sysconfig_network-scripts_ifdown-ovs 0755
64rhel_cp usr_share_openvswitch_scripts_sysconfig.template 0644
65
c434706a
BP
66# Get rid of stuff we don't want to make RPM happy.
67rm \
0bc1b46a
BP
68 $RPM_BUILD_ROOT/usr/bin/ovs-testcontroller \
69 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-testcontroller.8 \
9d7c5643 70 $RPM_BUILD_ROOT/usr/bin/ovs-test \
2d8bdd8f 71 $RPM_BUILD_ROOT/usr/bin/ovs-l3ping \
9d7c5643 72 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8 \
2d8bdd8f 73 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
c434706a 74 $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
1247b5a7
PM
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-*
4886d4d2 80(cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
2fd84d5e 81(cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
c434706a
BP
82
83install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
84
4886d4d2
EC
85copy_headers() {
86 src=$1
87 dst=$RPM_BUILD_ROOT/$2
88 install -d -m 0755 $dst
89 install -m 0644 $src/*.h $dst
90}
91copy_headers include %{_includedir}/openvswitch
92copy_headers include/openflow %{_includedir}/openvswitch/openflow
93copy_headers include/openvswitch %{_includedir}/openvswitch/openvswitch
94copy_headers include/sparse %{_includedir}/openvswitch/sparse
95copy_headers include/sparse/arpa %{_includedir}/openvswitch/sparse/arpa
96copy_headers include/sparse/netinet %{_includedir}/openvswitch/sparse/netinet
97copy_headers include/sparse/sys %{_includedir}/openvswitch/sparse/sys
98copy_headers lib %{_includedir}/openvswitch/lib
99
100install -D -m 0644 lib/.libs/libopenvswitch.a \
101 $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
102
329cf232
GS
103%check
104%if %{with check}
0d3f2152 105 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
329cf232
GS
106 else
107 cat tests/testsuite.log
108 exit 1
109 fi
110%endif
111
c434706a
BP
112%clean
113rm -rf $RPM_BUILD_ROOT
114
115%post
116# Create default or update existing /etc/sysconfig/openvswitch.
117SYSCONFIG=/etc/sysconfig/openvswitch
118TEMPLATE=/usr/share/openvswitch/scripts/sysconfig.template
119if [ ! -e $SYSCONFIG ]; then
120 cp $TEMPLATE $SYSCONFIG
121else
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
129fi
130
131# Ensure all required services are set to run
132/sbin/chkconfig --add openvswitch
133/sbin/chkconfig openvswitch on
134
135%preun
136if [ "$1" = "0" ]; then # $1 = 0 for uninstall
137 /sbin/service openvswitch stop
138 /sbin/chkconfig --del openvswitch
139fi
140
141%postun
142if [ "$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
146fi
147
148exit 0
149
150%files
151%defattr(-,root,root)
f0dc83b7 152%dir /etc/openvswitch
2c9907cd
AW
153/etc/bash_completion.d/ovs-appctl-bashcomp.bash
154/etc/bash_completion.d/ovs-vsctl-bashcomp.bash
c434706a 155/etc/init.d/openvswitch
53755990 156%config(noreplace) /etc/logrotate.d/openvswitch
0fb42626
AF
157/etc/sysconfig/network-scripts/ifup-ovs
158/etc/sysconfig/network-scripts/ifdown-ovs
c434706a
BP
159/usr/bin/ovs-appctl
160/usr/bin/ovs-dpctl
14b4c575 161/usr/bin/ovs-dpctl-top
ec8f0f0c 162/usr/bin/ovs-docker
c434706a 163/usr/bin/ovs-ofctl
013061cf 164/usr/bin/ovs-parse-backtrace
c434706a 165/usr/bin/ovs-pcap
def046d5 166/usr/bin/ovs-pki
c434706a
BP
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
dd2d06c3 172/usr/bin/vtep-ctl
4886d4d2 173%{_libdir}/lib*.so.*
51a5f442 174/usr/sbin/ovs-bugtool
c434706a
BP
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
dd2d06c3 183/usr/share/man/man5/vtep.5.gz
c434706a 184/usr/share/man/man8/ovs-appctl.8.gz
2ad7bf32 185/usr/share/man/man8/ovs-bugtool.8.gz
c434706a
BP
186/usr/share/man/man8/ovs-ctl.8.gz
187/usr/share/man/man8/ovs-dpctl.8.gz
14b4c575 188/usr/share/man/man8/ovs-dpctl-top.8.gz
c434706a 189/usr/share/man/man8/ovs-ofctl.8.gz
013061cf 190/usr/share/man/man8/ovs-parse-backtrace.8.gz
def046d5 191/usr/share/man/man8/ovs-pki.8.gz
c434706a
BP
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
dd2d06c3 195/usr/share/man/man8/vtep-ctl.8.gz
4b38c153 196/usr/share/openvswitch/bugtool-plugins/
c434706a 197/usr/share/openvswitch/python/
b2df0225 198/usr/share/openvswitch/scripts/ovs-bugtool-*
2dc7590d 199/usr/share/openvswitch/scripts/ovs-check-dead-ifs
c434706a 200/usr/share/openvswitch/scripts/ovs-ctl
d422c118 201/usr/share/openvswitch/scripts/ovs-lib
c434706a 202/usr/share/openvswitch/scripts/ovs-save
dd2d06c3 203/usr/share/openvswitch/scripts/ovs-vtep
c434706a
BP
204/usr/share/openvswitch/scripts/sysconfig.template
205/usr/share/openvswitch/vswitch.ovsschema
dd2d06c3 206/usr/share/openvswitch/vtep.ovsschema
542cc9bb 207%doc COPYING DESIGN.md INSTALL.SSL.md NOTICE README.md WHY-OVS.md FAQ.md NEWS
a36de779 208%doc INSTALL.DPDK.md rhel/README.RHEL README-native-tunneling.md
c434706a 209/var/lib/openvswitch
c649fe54 210/var/log/openvswitch
4886d4d2
EC
211
212%files devel
213%{_libdir}/lib*.so
214%{_libdir}/lib*.a
215%{_libdir}/pkgconfig
216%{_includedir}/openvswitch/*