commit:     4e1bbb9cb5cd617c9fc97ae3ec5f342f61030c17
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sun Jul 12 09:14:36 2020 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Sun Jul 12 09:14:36 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4e1bbb9c

dev-libs/open62541: Fix issues

This fixes two problems:

 * Build fix when ETF is enabled
 * Install XDP and ETF plugin header

Package-Manager: Portage-2.3.99, Repoman-2.3.23
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>

 dev-libs/open62541/files/open62541-1.1-etf.patch   | 43 ++++++++++++++++++++++
 .../open62541/files/open62541-1.1-headers.patch    | 36 ++++++++++++++++++
 dev-libs/open62541/open62541-1.1.ebuild            |  7 +++-
 3 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/dev-libs/open62541/files/open62541-1.1-etf.patch 
b/dev-libs/open62541/files/open62541-1.1-etf.patch
new file mode 100644
index 0000000..a5edee6
--- /dev/null
+++ b/dev-libs/open62541/files/open62541-1.1-etf.patch
@@ -0,0 +1,43 @@
+From aa6581a7053dd43247d65daa5511fbcc2977731f Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <k...@kmk-computers.de>
+Date: Sun, 12 Jul 2020 10:57:08 +0200
+Subject: [PATCH] etf: Fix compiler warning/build error in etf plugin
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix the following warning/error:
+
+|In function ‘snprintf’,
+|    inlined from ‘UA_PubSubChannelEthernetETF_open’ at 
/var/tmp/portage/dev-libs/open62541-1.1/work/open62541-1.1/plugins/ua_pubsub_ethernet_etf.c:189:5,
+|    inlined from ‘TransportLayerEthernetETF_addChannel’ at 
/var/tmp/portage/dev-libs/open62541-1.1/work/open62541-1.1/plugins/ua_pubsub_ethernet_etf.c:563:40:
+|/usr/include/bits/stdio2.h:67:10: error: ‘__builtin___snprintf_chk’ specified 
bound 40 exceeds destination size 16 [-Werror=stringop-overflow=]
+|   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
+|      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+|   68 |        __bos (__s), __fmt, __va_arg_pack ());
+|      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+|
+
+By using the correct size.
+
+Signed-off-by: Kurt Kanzenbach <k...@kmk-computers.de>
+---
+ plugins/ua_pubsub_ethernet_etf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/plugins/ua_pubsub_ethernet_etf.c 
b/plugins/ua_pubsub_ethernet_etf.c
+index 416b5857945a..d55eb363e3b5 100644
+--- a/plugins/ua_pubsub_ethernet_etf.c
++++ b/plugins/ua_pubsub_ethernet_etf.c
+@@ -186,7 +186,7 @@ UA_PubSubChannelEthernetETF_open(const 
UA_PubSubConnectionConfig *connectionConf
+     struct ifreq ifreq;
+     memset(&ifreq, 0, sizeof(struct ifreq));
+     UA_UInt64 len = UA_MIN(address->networkInterface.length, 
sizeof(ifreq.ifr_name)-1);
+-    UA_snprintf(ifreq.ifr_name, sizeof(struct ifreq),
++    UA_snprintf(ifreq.ifr_name, sizeof(ifreq.ifr_name),
+                 "%.*s", (int)len,
+                 (char*)address->networkInterface.data);
+ 
+-- 
+2.26.2
+

diff --git a/dev-libs/open62541/files/open62541-1.1-headers.patch 
b/dev-libs/open62541/files/open62541-1.1-headers.patch
new file mode 100644
index 0000000..29d2ed3
--- /dev/null
+++ b/dev-libs/open62541/files/open62541-1.1-headers.patch
@@ -0,0 +1,36 @@
+From fef10a1f02ae5863e6670802ce162b6e102e3df8 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <k...@kmk-computers.de>
+Date: Sun, 12 Jul 2020 10:39:31 +0200
+Subject: [PATCH] cmake: Install ETF and XDP plugin headers
+
+When the corresponding features are enabled, the headers should be installed as
+well.
+
+Signed-off-by: Kurt Kanzenbach <k...@kmk-computers.de>
+---
+ CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ee40c19af21f..3401ce3d2bd1 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -858,6 +858,7 @@ if(UA_ENABLE_PUBSUB)
+     list(APPEND default_plugin_headers 
${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pubsub_udp.h)
+     list(APPEND default_plugin_sources 
${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_udp.c)
+     if(UA_ENABLE_PUBSUB_ETH_UADP_ETF)
++        list(APPEND default_plugin_headers 
${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pubsub_ethernet_etf.h)
+         list(APPEND default_plugin_sources 
${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_ethernet_etf.c)
+     endif()
+     if(UA_ENABLE_PUBSUB_ETH_UADP)
+@@ -867,6 +868,7 @@ if(UA_ENABLE_PUBSUB)
+     if(UA_ENABLE_PUBSUB_ETH_UADP_XDP)
+         if(EXISTS "${XDP_LIBRARY}")
+             list(APPEND open62541_LIBRARIES ${XDP_LIBRARY})
++            list(APPEND default_plugin_headers 
${PROJECT_SOURCE_DIR}/plugins/include/open62541/plugin/pubsub_ethernet_xdp.h)
+             list(APPEND default_plugin_sources 
${PROJECT_SOURCE_DIR}/plugins/ua_pubsub_ethernet_xdp.c)
+         else()
+             MESSAGE(WARNING "samples in bpf-next directory were not built. 
Build the bpf-next to use XDP")
+-- 
+2.26.2
+

diff --git a/dev-libs/open62541/open62541-1.1.ebuild 
b/dev-libs/open62541/open62541-1.1.ebuild
index 5fe1065..b6b0d45 100644
--- a/dev-libs/open62541/open62541-1.1.ebuild
+++ b/dev-libs/open62541/open62541-1.1.ebuild
@@ -51,7 +51,11 @@ RDEPEND="
        ${DEPEND}
 "
 
-PATCHES=( "${FILESDIR}/${P}-tests.patch" )
+PATCHES=(
+       "${FILESDIR}/${P}-etf.patch"
+       "${FILESDIR}/${P}-headers.patch"
+       "${FILESDIR}/${P}-tests.patch"
+)
 
 src_configure() {
        local mycmakeargs=(
@@ -64,6 +68,7 @@ src_configure() {
                -DUA_ENABLE_ENCRYPTION_MBEDTLS=$(usex mbedtls)
                -DUA_ENABLE_ENCRYPTION_OPENSSL=$(usex openssl)
                -DUA_ENABLE_PUBSUB=$(usex pubsub)
+               -DUA_ENABLE_PUBSUB_ETH_UADP=$(usex pubsub)
                -DUA_ENABLE_PUBSUB_ETH_UADP_ETF=$(usex etf)
                -DUA_ENABLE_PUBSUB_ETH_UADP_XDP=$(usex xdp)
        )

Reply via email to