[ovs-dev] [PATCH] debian, rhel: Ship ovs shared libraries and header files

Flavio Leitner fbl at sysclose.org
Tue Apr 26 17:32:33 UTC 2016


On Fri, Apr 15, 2016 at 01:28:18PM -0700, echiu at vmware.com wrote:
> From: Edwin Chiu <echiu at vmware.com>
> 
> Compile and package ovs shared libraries and create new header
> package for debian (openvswitch-dev) and rhel (openvswitch-devel).
> 
> VMware-BZ: #1556299
> Signed-off-by: Edwin Chiu <echiu at vmware.com>
> Co-authored-by: Harold Lim <haroldl at vmware.com>
> ---
>  debian/automake.mk                |    1 +
>  debian/control                    |   16 ++++++++++++++++
>  debian/openvswitch-common.install |    1 +
>  debian/openvswitch-dev.install    |   11 +++++++++++
>  debian/rules                      |    4 +++-
>  rhel/openvswitch.spec.in          |   38 +++++++++++++++++++++++++++++++++++--
>  6 files changed, 68 insertions(+), 3 deletions(-)
>  create mode 100644 debian/openvswitch-dev.install
> 
> diff --git a/debian/automake.mk b/debian/automake.mk
> index de2350c..7b5b3aa 100644
> --- a/debian/automake.mk
> +++ b/debian/automake.mk
> @@ -18,6 +18,7 @@ EXTRA_DIST += \
>  	debian/openvswitch-datapath-source.copyright \
>  	debian/openvswitch-datapath-source.dirs \
>  	debian/openvswitch-datapath-source.install \
> +	debian/openvswitch-dev.install \
>  	debian/openvswitch-ipsec.dirs \
>  	debian/openvswitch-ipsec.init \
>  	debian/openvswitch-ipsec.install \
> diff --git a/debian/control b/debian/control
> index 2918d06..2c07a73 100644
> --- a/debian/control
> +++ b/debian/control
> @@ -288,3 +288,19 @@ Description: Open vSwitch VTEP utilities
>   .
>   This package provides utilities that are useful to interact with a
>   VTEP-configured database and a VTEP emulator.
> +
> +Package: openvswitch-dev
> +Architecture: linux-any
> +Depends:
> + openvswitch-common (>= ${binary:Version}),
> + ${misc:Depends}
> +Description: Open vSwitch development package
> + Open vSwitch is a production quality, multilayer, software-based, Ethernet
> + virtual switch. It is designed to enable massive network automation through
> + programmatic extension, while still supporting standard management interfaces
> + and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
> + addition, it is designed to support distribution across multiple physical
> + servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
> + 1000V.
> + .
> + This package provides openvswitch headers and libopenvswitch for developers.
> diff --git a/debian/openvswitch-common.install b/debian/openvswitch-common.install
> index 3264ea5..ebb7d5c 100644
> --- a/debian/openvswitch-common.install
> +++ b/debian/openvswitch-common.install
> @@ -9,3 +9,4 @@ usr/sbin/ovs-bugtool
>  usr/share/openvswitch/bugtool-plugins
>  usr/share/openvswitch/scripts/ovs-bugtool-*
>  usr/share/openvswitch/scripts/ovs-lib
> +usr/lib/lib*.so.*
> diff --git a/debian/openvswitch-dev.install b/debian/openvswitch-dev.install
> new file mode 100644
> index 0000000..7a34765
> --- /dev/null
> +++ b/debian/openvswitch-dev.install
> @@ -0,0 +1,11 @@
> +usr/lib/lib*.so
> +usr/lib/lib*.a
> +usr/lib/pkgconfig
> +include/*.h usr/local/include/openvswitch
> +include/openflow/*.h usr/local/include/openvswitch/openflow
> +include/openvswitch/*.h usr/local/include/openvswitch/openvswitch
> +include/sparse/*.h usr/local/include/openvswitch/sparse
> +include/sparse/arpa/*.h usr/local/include/openvswitch/sparse/arpa
> +include/sparse/netinet/*.h usr/local/include/openvswitch/sparse/netinet
> +include/sparse/sys/*.h usr/local/include/openvswitch/sparse/sys
> +lib/*.h usr/local/include/openvswitch/lib
> diff --git a/debian/rules b/debian/rules
> index 2a70bd6..64bc779 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -30,7 +30,7 @@ override_dh_autoreconf:
>  	dh_autoreconf $(DH_AS_NEEDED)
>  
>  override_dh_auto_configure:
> -	dh_auto_configure -- --enable-ssl $(DATAPATH_CONFIGURE_OPTS)
> +	dh_auto_configure -- --enable-ssl --enable-shared $(DATAPATH_CONFIGURE_OPTS)
>  
>  override_dh_auto_test:
>  ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
> @@ -91,3 +91,5 @@ override_dh_installinit:
>  
>  override_dh_strip:
>  	dh_strip --dbg-package=openvswitch-dbg
> +
> +override_dh_usrlocal:
> diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
> index b86f5db..8a47367 100644
> --- a/rhel/openvswitch.spec.in
> +++ b/rhel/openvswitch.spec.in
> @@ -32,11 +32,19 @@ Open vSwitch provides standard network bridging functions and
>  support for the OpenFlow protocol for remote per-flow control of
>  traffic.
>  
> +%package devel
> +Summary:        Open vSwitch development package
> +Group:          Development/Libraries
> +
> +%description devel
> +This package provides openvswitch headers and libopenvswitch for developers.
> +
>  %prep
>  %setup -q
>  
>  %build
> -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} --enable-ssl
> +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=%{_localstatedir} \
> +    --libdir=%{_libdir} --enable-ssl --enable-shared
>  make %{_smp_mflags}
>  
>  %install
> @@ -69,11 +77,30 @@ rm \
>      $RPM_BUILD_ROOT/usr/share/man/man?/ovn-* \
>      $RPM_BUILD_ROOT/usr/share/openvswitch/ovn-* \
>      $RPM_BUILD_ROOT/usr/share/openvswitch/scripts/ovn-*
> -(cd "$RPM_BUILD_ROOT" && rm -rf usr/lib)
> +(cd "$RPM_BUILD_ROOT" && rm -rf usr/%{_lib}/*.la)
>  (cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
>  
>  install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
>  
> +copy_headers() {
> +    src=$1
> +    dst=$RPM_BUILD_ROOT/$2
> +    install -d -m 0755 $dst
> +    install -m 0644 $src/*.h $dst
> +}
> +LOCAL_INCLUDE=usr/local/include
> +copy_headers include $LOCAL_INCLUDE/openvswitch
> +copy_headers include/openflow $LOCAL_INCLUDE/openvswitch/openflow
> +copy_headers include/openvswitch $LOCAL_INCLUDE/openvswitch/openvswitch
> +copy_headers include/sparse $LOCAL_INCLUDE/openvswitch/sparse
> +copy_headers include/sparse/arpa $LOCAL_INCLUDE/openvswitch/sparse/arpa
> +copy_headers include/sparse/netinet $LOCAL_INCLUDE/openvswitch/sparse/netinet
> +copy_headers include/sparse/sys $LOCAL_INCLUDE/openvswitch/sparse/sys
> +copy_headers lib $LOCAL_INCLUDE/openvswitch/lib

You are copying the headers to /usr/local/include. Usually we avoid
doing that because /usr/local is reserved for local stuff that the admin
could have built/installed manually.

For instance, you could install the RPM and still compile upstream OVS
which by default installs itself in /usr/local.  However, after this patch
there would be an unexpected conflict.

Also that you moved the files to be inside openvswitch/ which looks
good but then you need to fix the .pc files otherwise they will refer
to the old (and invalid %{_includedir}).  I guess the same problem
would happen with the debian version.

Thanks,
fbl

> +
> +install -D -m 0644 lib/.libs/libopenvswitch.a \
> +    $RPM_BUILD_ROOT/%{_libdir}/libopenvswitch.a
> +
>  %check
>  %if %{with check}
>      if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
> @@ -144,6 +171,7 @@ exit 0
>  /usr/bin/ovsdb-client
>  /usr/bin/ovsdb-tool
>  /usr/bin/vtep-ctl
> +%{_libdir}/lib*.so.*
>  /usr/sbin/ovs-bugtool
>  /usr/sbin/ovs-vswitchd
>  /usr/sbin/ovsdb-server
> @@ -181,3 +209,9 @@ exit 0
>  %doc INSTALL.DPDK.md rhel/README.RHEL README-native-tunneling.md
>  /var/lib/openvswitch
>  /var/log/openvswitch
> +
> +%files devel
> +%{_libdir}/lib*.so
> +%{_libdir}/lib*.a
> +%{_libdir}/pkgconfig
> +/usr/local/include/openvswitch/*
> -- 
> 1.7.9.5
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

-- 
fbl




More information about the dev mailing list