openvswitch: only libopenvswitch depends on libunbound, libunwind
authorYousong Zhou <yszhou4tech@gmail.com>
Wed, 29 Jul 2020 09:30:38 +0000 (17:30 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Thu, 30 Jul 2020 02:02:13 +0000 (10:02 +0800)
This is to make explicit the conditional select of libunwind is only
needed for libopenvswitch.  If we spill it over other packages, the
generated kconfig will have recursive dependency issue.  2 new patches
were made for this goal

The other thing is that "+libunwind" will cause it to be built if any of the
packages defined in this Makefile is enabled (y or m).  This is at the moment
by-design of the build system.

Libunwind does not support architectures like arc.  Use conditional select To
avoid (libunwind) build failures like the following,

  checking for ELF helper width... configure: error: Unknown ELF target: arc
  make[3]: *** [Makefile:65: /data/openwrt/build_dir/target-arc_arc700_uClibc/
  libunwind-1.3.1/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1

Things like "+PACKAGE_openvswitch-libopenvswitch:libunwind" will also result in
recursive deps error for chains of 3 nodes.  Kconfig construct like the
following will be made

config A
tristate
select B
depends on !(C) || (x)

config B
tristate
select C

config C
tristate

config x
bool

Other changes include

 - Shared use of variable ovs__common_depends was removed
 - Ovn doc build was patched out

Link: https://github.com/openwrt/packages/pull/12959#issuecomment-665021413
Reported-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
net/openvswitch/Makefile
net/openvswitch/openvswitch.mk
net/openvswitch/patches/0009-build-only-link-libopenvswitch-with-libunwind-libunb.patch [new file with mode: 0644]
net/ovn/Makefile
net/ovn/patches/0001-build-skip-building-tests.patch [deleted file]
net/ovn/patches/0001-build-skip-check-and-use-of-libunbound.patch [new file with mode: 0644]
net/ovn/patches/0002-build-skip-tests-and-docs.patch [new file with mode: 0644]
net/ovn/patches/0002-ovn-lib-fix-install_dir.patch [deleted file]
net/ovn/patches/0003-ovn-lib-fix-install_dir.patch [new file with mode: 0644]

index 74a0ae22c11963d56582400d1361570dd48d5f97..c869ace10b14d6a51c071829d583d374fb68a715 100644 (file)
@@ -17,7 +17,7 @@ include ./openvswitch.mk
 #
 PKG_NAME:=openvswitch
 PKG_VERSION:=$(ovs_version)
-PKG_RELEASE:=7
+PKG_RELEASE:=8
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
 PKG_HASH:=dd5f727427e36cab22bdeae61529d8c8fccacc53d968cfa7658f7f935ddda531
@@ -156,7 +156,7 @@ ovs_kmod_openvswitch-lisp-intree_depends:= +kmod-openvswitch-intree
 ovs_kmod_openvswitch-lisp-intree_files:= $(ovs_kmod_intree_dir)/vport-lisp.ko
 $(eval $(call OvsKmodPackageTemplate,openvswitch-lisp-intree))
 
-ovs__common_depends:= +libatomic +libunbound +libunwind
+ovs__common_depends:=+libatomic +librt
 
 # Dependency review
 #
@@ -166,42 +166,46 @@ ovs__common_depends:= +libatomic +libunbound +libunwind
 #
 ovs_libopenvswitch_title:=Open vSwitch (libopenvswitch.so)
 ovs_libopenvswitch_hidden:=1
-ovs_libopenvswitch_depends:=+libopenssl +librt
+ovs_libopenvswitch_depends:=+libopenssl +libunbound +!(arc||arceb):libunwind
+ovs_libopenvswitch_depends+=$(ovs__common_depends)
 ovs_libopenvswitch_files:=usr/lib/libopenvswitch*.so*
 $(eval $(call OvsPackageTemplate,libopenvswitch))
 
 
 ovs_libofproto_title:=Open vSwitch (libofproto.so libsflow.so)
 ovs_libofproto_hidden:=1
-ovs_libofproto_depends:=+librt
+ovs_libofproto_depends+=$(ovs__common_depends)
 ovs_libofproto_files:=usr/lib/libofproto*.so* usr/lib/libsflow*.so*
 $(eval $(call OvsPackageTemplate,libofproto))
 
 
 ovs_libovsdb_title:=Open vSwitch (libovsdb.so)
 ovs_libovsdb_hidden:=1
-ovs_libovsdb_depends:=+librt
+ovs_libovsdb_depends+=$(ovs__common_depends)
 ovs_libovsdb_files:=usr/lib/libovsdb*.so*
 $(eval $(call OvsPackageTemplate,libovsdb))
 
 
 ovs_vswitchd_title:=Open vSwitch (ovs-vswitchd)
 ovs_vswitchd_hidden:=1
-ovs_vswitchd_depends:=+librt +openvswitch-libopenvswitch +openvswitch-libofproto
+ovs_vswitchd_depends:=+openvswitch-libopenvswitch +openvswitch-libofproto
+ovs_vswitchd_depends+=$(ovs__common_depends)
 ovs_vswitchd_files:=usr/sbin/ovs-vswitchd
 $(eval $(call OvsPackageTemplate,vswitchd))
 
 
 ovs_ovsdb_title:=Open vSwitch (ovsdb-server)
 ovs_ovsdb_hidden:=1
-ovs_ovsdb_depends:=+librt +openvswitch-libopenvswitch +openvswitch-libovsdb
+ovs_ovsdb_depends:=+openvswitch-libopenvswitch +openvswitch-libovsdb
+ovs_ovsdb_depends+=$(ovs__common_depends)
 ovs_ovsdb_files:=usr/sbin/ovsdb-server
 $(eval $(call OvsPackageTemplate,ovsdb))
 
 
 ovs_common_title:=Open vSwitch (common files)
 ovs_common_hidden:=1
-ovs_common_depends:=+librt +openvswitch-libopenvswitch +openvswitch-libofproto +openvswitch-libovsdb
+ovs_common_depends:=+openvswitch-libopenvswitch +openvswitch-libofproto +openvswitch-libovsdb
+ovs_common_depends+=$(ovs__common_depends)
 ovs_common_files:= \
        usr/share/openvswitch/scripts/ovs-lib \
        usr/share/openvswitch/scripts/ovs-ctl \
@@ -231,8 +235,9 @@ $(eval $(call OvsPackageTemplate,common))
 # uuidgen is required for generating system-id
 ovs_openvswitch_title:=Open vSwitch
 ovs_openvswitch_hidden:=
-ovs_openvswitch_depends:=+librt +coreutils +coreutils-sleep +uuidgen \
+ovs_openvswitch_depends:=+coreutils +coreutils-sleep +uuidgen \
        +openvswitch-common +openvswitch-vswitchd +openvswitch-ovsdb +kmod-openvswitch
+ovs_openvswitch_depends+=$(ovs__common_depends)
 ovs_openvswitch_files:= usr/share/openvswitch/vswitch.ovsschema
 $(eval $(call OvsPackageTemplate,openvswitch))
 
index 78d35c031f37e5aa208396738f2fc652a45eac63..a90f3dabe902b438efc345c24131d04f089d4456 100644 (file)
@@ -10,7 +10,6 @@ ovs_builddir=$(KERNEL_BUILD_DIR)/openvswitch-$(ovs_version)
 
 # Shared vars, macros
 
-ovs__common_depends:=
 ovs_packages:=
 
 ovs_package_name=$(if $(filter openvswitch,$(1)),openvswitch,openvswitch-$(1))
@@ -22,7 +21,7 @@ define OvsPackageTemplate
      URL:=https://www.openvswitch.org
      TITLE:=$(ovs_$(1)_title)
      HIDDEN:=$(ovs_$(1)_hidden)
-     DEPENDS:=$(ovs_$(1)_depends) $(ovs__common_depends)
+     DEPENDS:=$(ovs_$(1)_depends)
   endef
 
   define Package/$(call ovs_package_name,$(1))/install
diff --git a/net/openvswitch/patches/0009-build-only-link-libopenvswitch-with-libunwind-libunb.patch b/net/openvswitch/patches/0009-build-only-link-libopenvswitch-with-libunwind-libunb.patch
new file mode 100644 (file)
index 0000000..106e748
--- /dev/null
@@ -0,0 +1,60 @@
+From 6324f0c594e3773c754861e630fff694d1bec15a Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Wed, 29 Jul 2020 17:29:14 +0800
+Subject: [PATCH] build: only link libopenvswitch with libunwind, libunbound
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ lib/automake.mk          | 2 ++
+ lib/libopenvswitch.pc.in | 2 +-
+ m4/openvswitch.m4        | 6 ++++--
+ 3 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/lib/automake.mk b/lib/automake.mk
+index 95925b57c..df95bea10 100644
+--- a/lib/automake.mk
++++ b/lib/automake.mk
+@@ -10,6 +10,8 @@ lib_LTLIBRARIES += lib/libopenvswitch.la
+ lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
+ lib_libopenvswitch_la_LIBADD += $(CAPNG_LDADD)
+ lib_libopenvswitch_la_LIBADD += $(LIBBPF_LDADD)
++lib_libopenvswitch_la_LIBADD += $(LIBUNBOUND_LDADD)
++lib_libopenvswitch_la_LIBADD += $(LIBUNWIND_LDADD)
+ if WIN32
+ lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS}
+diff --git a/lib/libopenvswitch.pc.in b/lib/libopenvswitch.pc.in
+index 2a3f2ca7b..c8d02eb5a 100644
+--- a/lib/libopenvswitch.pc.in
++++ b/lib/libopenvswitch.pc.in
+@@ -7,5 +7,5 @@ Name: libopenvswitch
+ Description: Open vSwitch library
+ Version: @VERSION@
+ Libs: -L${libdir} -lopenvswitch
+-Libs.private: @LIBS@
++Libs.private: @LIBS@ @SSL_LIBS@ @CAPNG_LDADD@ @LIBBPF_LDADD@ @LIBUNBOUND_LDADD@ @LIBUNWIND_LDADD@
+ Cflags: -I${includedir}/openvswitch
+diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
+index ada31c491..6165cc7b1 100644
+--- a/m4/openvswitch.m4
++++ b/m4/openvswitch.m4
+@@ -623,7 +623,8 @@ AC_DEFUN([OVS_CHECK_UNBOUND],
+   [AC_CHECK_LIB(unbound, ub_ctx_create, [HAVE_UNBOUND=yes], [HAVE_UNBOUND=no])
+    if test "$HAVE_UNBOUND" = yes; then
+      AC_DEFINE([HAVE_UNBOUND], [1], [Define to 1 if unbound is detected.])
+-     LIBS="$LIBS -lunbound"
++     LIBUNBOUND_LDADD="-lunbound"
++     AC_SUBST(LIBUNBOUND_LDADD)
+    fi
+    AM_CONDITIONAL([HAVE_UNBOUND], [test "$HAVE_UNBOUND" = yes])
+    AC_SUBST([HAVE_UNBOUND])])
+@@ -635,7 +636,8 @@ AC_DEFUN([OVS_CHECK_UNWIND],
+    [HAVE_UNWIND=no])
+    if test "$HAVE_UNWIND" = yes; then
+      AC_DEFINE([HAVE_UNWIND], [1], [Define to 1 if unwind is detected.])
+-     LIBS="$LIBS -lunwind"
++     LIBUNWIND_LDADD="-lunwind"
++     AC_SUBST(LIBUNWIND_LDADD)
+    fi
+    AM_CONDITIONAL([HAVE_UNWIND], [test "$HAVE_UNWIND" = yes])
+    AC_SUBST([HAVE_UNWIND])])
index fa7ed552d1933db3b5e030ed7137d23c452d0946..5aba157cbf1b6d4c949ef4c7b1c73b76c60dafbd 100644 (file)
@@ -10,7 +10,7 @@ include ../openvswitch/openvswitch.mk
 
 PKG_NAME:=ovn
 PKG_VERSION:=20.06.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/ovn-org/ovn.git
@@ -33,18 +33,19 @@ PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
 include $(INCLUDE_DIR)/package.mk
 include ../../lang/python/python3-host.mk
 
-ovs__common_depends:= +libatomic +libunbound
+ovs__common_depends:=+libatomic +librt
 
 ovs_libovn_title:=Open vSwitch (libovn.so)
 ovs_libovn_hidden:=1
-ovs_libovn_depends:=+librt
+ovs_libovn_depends+=$(ovs__common_depends)
 ovs_libovn_files:=usr/lib/libovn*.so*
 $(eval $(call OvsPackageTemplate,libovn))
 
 
 ovs_ovn-common_title:=Open Virtual Network (common files)
 ovs_ovn-common_hidden:=1
-ovs_ovn-common_depends:=+librt +openvswitch-common +openvswitch-libopenvswitch +openvswitch-libovn +openvswitch-libovsdb
+ovs_ovn-common_depends:=+openvswitch-common +openvswitch-libopenvswitch +openvswitch-libovn +openvswitch-libovsdb
+ovs_ovn-common_depends+=$(ovs__common_depends)
 ovs_ovn-common_files:= \
        usr/share/ovn/scripts/ovn-ctl \
        usr/share/ovn/scripts/ovn-lib \
@@ -58,6 +59,7 @@ $(eval $(call OvsPackageTemplate,ovn-common))
 ovs_ovn-north_title:=Open Virtual Network (north package)
 ovs_ovn-north_hidden:=
 ovs_ovn-north_depends:=+openvswitch-ovsdb +openvswitch-ovn-common
+ovs_ovn-north_depends+=$(ovs__common_depends)
 ovs_ovn-north_files:=\
        usr/share/ovn/ovn-nb.ovsschema \
        usr/share/ovn/ovn-sb.ovsschema \
@@ -68,6 +70,7 @@ $(eval $(call OvsPackageTemplate,ovn-north))
 ovs_ovn-host_title:=Open Virtual Network (chassis package)
 ovs_ovn-host_hidden:=
 ovs_ovn-host_depends:=+openvswitch +openvswitch-ovn-common
+ovs_ovn-host_depends+=$(ovs__common_depends)
 ovs_ovn-host_files:=usr/bin/ovn-controller
 $(eval $(call OvsPackageTemplate,ovn-host))
 
diff --git a/net/ovn/patches/0001-build-skip-building-tests.patch b/net/ovn/patches/0001-build-skip-building-tests.patch
deleted file mode 100644 (file)
index 2984241..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-From d048a1e98363197c0d2609f6adb6919bde473df4 Mon Sep 17 00:00:00 2001
-From: Yousong Zhou <yszhou4tech@gmail.com>
-Date: Mon, 23 Mar 2020 14:18:30 +0800
-Subject: [PATCH] build: skip building tests
-
-Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
----
- Makefile.am | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 04400e184..b2c42d84c 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -492,7 +492,6 @@ include Documentation/automake.mk
- include m4/automake.mk
- include lib/automake.mk
- include utilities/automake.mk
--include tests/automake.mk
- include include/automake.mk
- include third-party/automake.mk
- include debian/automake.mk
diff --git a/net/ovn/patches/0001-build-skip-check-and-use-of-libunbound.patch b/net/ovn/patches/0001-build-skip-check-and-use-of-libunbound.patch
new file mode 100644 (file)
index 0000000..e93deb1
--- /dev/null
@@ -0,0 +1,22 @@
+From f3cc8c83993486b9d35557f2bd85038d5bb96bc5 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Wed, 29 Jul 2020 20:09:56 +0800
+Subject: [PATCH] build: skip check and use of libunbound
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ configure.ac | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2bcd1945b..ad550fff8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -130,7 +130,6 @@ OVS_CHECK_LINUX_HOST
+ OVS_LIBTOOL_VERSIONS
+ OVS_CHECK_CXX
+ AX_FUNC_POSIX_MEMALIGN
+-OVN_CHECK_UNBOUND
+ OVS_CHECK_INCLUDE_NEXT([stdio.h string.h])
+ AC_CONFIG_FILES([lib/libovn.sym])
diff --git a/net/ovn/patches/0002-build-skip-tests-and-docs.patch b/net/ovn/patches/0002-build-skip-tests-and-docs.patch
new file mode 100644 (file)
index 0000000..342dfab
--- /dev/null
@@ -0,0 +1,26 @@
+From cea7c74ecc4a0843f29ce1882d7876fff199a721 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Mon, 23 Mar 2020 14:18:30 +0800
+Subject: [PATCH] build: skip tests and docs
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ Makefile.am | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 04400e184..c12cfcd11 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -488,11 +488,9 @@ dist-docs:
+ include automake.mk
+-include Documentation/automake.mk
+ include m4/automake.mk
+ include lib/automake.mk
+ include utilities/automake.mk
+-include tests/automake.mk
+ include include/automake.mk
+ include third-party/automake.mk
+ include debian/automake.mk
diff --git a/net/ovn/patches/0002-ovn-lib-fix-install_dir.patch b/net/ovn/patches/0002-ovn-lib-fix-install_dir.patch
deleted file mode 100644 (file)
index b67dfd7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-From ecf232bf32dd433642bb9da2ac0c2de483b8736a Mon Sep 17 00:00:00 2001
-From: Yousong Zhou <yszhou4tech@gmail.com>
-Date: Mon, 23 Mar 2020 15:54:26 +0800
-Subject: [PATCH] ovn-lib: fix install_dir()
-
-The command "install" is not available in OpenWrt by default
-
-Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
----
- utilities/ovn-lib.in | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/utilities/ovn-lib.in b/utilities/ovn-lib.in
-index af1b72edb..f6ab5581c 100644
---- a/utilities/ovn-lib.in
-+++ b/utilities/ovn-lib.in
-@@ -54,7 +54,10 @@ ovn_install_dir () {
-     [ "${OVN_USER##*:}" != "" ] && INSTALL_GROUP="${OVN_USER##*:}"
-     if test ! -d "$DIR"; then
--        install -d -m "$INSTALL_MODE" -o "$INSTALL_USER" -g "$INSTALL_GROUP" "$DIR"
-+        mkdir -p "$DIR"
-+        chmod "$INSTALL_MODE" "$DIR"
-+        chown "$INSTALL_USER" "$DIR"
-+        chgrp "$INSTALL_GROUP" "$DIR"
-         restorecon "$DIR" >/dev/null 2>&1
-     fi
- }
diff --git a/net/ovn/patches/0003-ovn-lib-fix-install_dir.patch b/net/ovn/patches/0003-ovn-lib-fix-install_dir.patch
new file mode 100644 (file)
index 0000000..46a7daa
--- /dev/null
@@ -0,0 +1,28 @@
+From 7385d1e67dda100853cf748034220cdbed6b3d7c Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Mon, 23 Mar 2020 15:54:26 +0800
+Subject: [PATCH] ovn-lib: fix install_dir()
+
+The command "install" is not available in OpenWrt by default
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ utilities/ovn-lib.in | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/utilities/ovn-lib.in b/utilities/ovn-lib.in
+index af1b72edb..f6ab5581c 100644
+--- a/utilities/ovn-lib.in
++++ b/utilities/ovn-lib.in
+@@ -54,7 +54,10 @@ ovn_install_dir () {
+     [ "${OVN_USER##*:}" != "" ] && INSTALL_GROUP="${OVN_USER##*:}"
+     if test ! -d "$DIR"; then
+-        install -d -m "$INSTALL_MODE" -o "$INSTALL_USER" -g "$INSTALL_GROUP" "$DIR"
++        mkdir -p "$DIR"
++        chmod "$INSTALL_MODE" "$DIR"
++        chown "$INSTALL_USER" "$DIR"
++        chgrp "$INSTALL_GROUP" "$DIR"
+         restorecon "$DIR" >/dev/null 2>&1
+     fi
+ }