Skip to contentSkip to conversation

libkcapi: Update patch to upstream submitted one

PATCH New Khem Raj 1 participant 2 messages Nov 21, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v3 1/1 libkcapi: Update patch to upstream submitted one

Use builtin_bswap32 with clang if available

---
v2: Use builtin_bswap32 with clang if available
v3: Provide for __has_builtin if not existing

 ...uiltin_bswap32-on-Clang-if-supported.patch | 39 +++++++++++++++++++
 .../0001-kcapi-kdf-Move-code-to-fix.patch     | 24 ++++++------
 .../recipes-crypto/libkcapi/libkcapi_git.bb   |  1 +
 3 files changed, 53 insertions(+), 11 deletions(-)
 create mode 100644 meta-oe/recipes-crypto/libkcapi/libkcapi/0001-Use-__builtin_bswap32-on-Clang-if-supported.patch
meta-oe/recipes-crypto/libkcapi/libkcapi/0001-Use-__builtin_bswap32-on-Clang-if-supported.patch new file +39 -0
new file mode 100644
index 0000000000..e713665ab3
@@ -0,0 +1,39 @@
+From 7b5dd67fee58f9f54c8a676abe2131776c0a3c52 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 20 Nov 2019 13:41:39 -0800
+Subject: [PATCH] Use __builtin_bswap32 on Clang if supported
+
+clang pretends to be gcc 4.2.1 so GCC_VERSION macro will decide that
+__builtin_bswap32 is not supported on clang, whereas in reality it might
+so its better to add a check for enquiring clang if it supports
+__builtin_bswap32 or not
+
+Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/83]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ lib/kcapi-kdf.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/kcapi-kdf.c b/lib/kcapi-kdf.c
+index 9e53a0b..f32fbe9 100644
+--- a/lib/kcapi-kdf.c
++++ b/lib/kcapi-kdf.c
+@@ -54,10 +54,14 @@
+ #include "kcapi.h"
+ #include "internal.h"
+ 
++#ifndef __has_builtin
++# define __has_builtin(x) 0
++#endif
++
+ #define GCC_VERSION (__GNUC__ * 10000		\
+ 		     + __GNUC_MINOR__ * 100	\
+ 		     + __GNUC_PATCHLEVEL__)
+-#if GCC_VERSION >= 40400
++#if GCC_VERSION >= 40400 || (defined(__clang__) && __has_builtin(__builtin_bswap32))
+ # define __HAVE_BUILTIN_BSWAP32__
+ #endif
+ 
+-- 
+2.24.0
+
meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch +13 -11
index 3dd7ea7f9b..7ed9caf096 100644
@@ -1,4 +1,4 @@
-From 00c1654e368f728b213c4e3782045d54098edb25 Mon Sep 17 00:00:00 2001
+From 8f961521add49278b48c9721fc53e05ee3543b74 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Sat, 16 Nov 2019 23:03:51 -0800
 Subject: [PATCH] kcapi-kdf: Move code to fix
@@ -6,13 +6,14 @@ Subject: [PATCH] kcapi-kdf: Move code to fix
 Fixes clang build
 unused function '_bswap32' [-Werror,-Wunused-function]
 
+Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/83]
 Signed-off-by: Khem Raj <[email protected]>
 ---
- lib/kcapi-kdf.c | 36 ++++++++++++++++--------------------
- 1 file changed, 16 insertions(+), 20 deletions(-)
+ lib/kcapi-kdf.c | 37 +++++++++++++++++--------------------
+ 1 file changed, 17 insertions(+), 20 deletions(-)
 
 diff --git a/lib/kcapi-kdf.c b/lib/kcapi-kdf.c
-index ea39846..8e4a636 100644
+index ea39846..9e53a0b 100644
 --- a/lib/kcapi-kdf.c
 +++ b/lib/kcapi-kdf.c
 @@ -54,6 +54,20 @@
@@ -26,17 +27,17 @@ index ea39846..8e4a636 100644
 +# define __HAVE_BUILTIN_BSWAP32__
 +#endif
 +
-+#ifdef __HAVE_BUILTIN_BSWAP32__
-+# define be_bswap32(x) (uint32_t)__builtin_bswap32((uint32_t)(x))
 +/* Endian dependent byte swap operations.  */
-+#elif  __BYTE_ORDER__ ==  __ORDER_BIG_ENDIAN__
++#if  __BYTE_ORDER__ ==  __ORDER_BIG_ENDIAN__
 +# define be_bswap32(x) ((uint32_t)(x))
 +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+
++# ifdef __HAVE_BUILTIN_BSWAP32__
++#  define be_bswap32(x) (uint32_t)__builtin_bswap32((uint32_t)(x))
++# else
  static inline uint32_t rol32(uint32_t x, int n)
  {
  	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
-@@ -68,27 +82,9 @@ static inline uint32_t _bswap32(uint32_t x)
+@@ -68,27 +82,10 @@ static inline uint32_t _bswap32(uint32_t x)
  {
  	return ((rol32(x, 8) & 0x00ff00ffL) | (ror32(x, 8) & 0xff00ff00L));
  }
@@ -59,10 +60,11 @@ index ea39846..8e4a636 100644
 -# define be_bswap32(x) ((uint32_t)(x))
 -#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 -# define be_bswap32(x) _swap32(x)
-+# define be_bswap32(x) _bswap32(x)
++#  define be_bswap32(x) _bswap32(x)
++# endif
  #else
 -#error "Endianess not defined"
-+# error "Neither builtin_bswap32 nor endianess defined"
++# error "endianess not defined"
  #endif
  
  DSO_PUBLIC
meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb +1 -0
index aa438e5859..4e217a351d 100644
@@ -11,6 +11,7 @@ PV = "1.1.5"
 SRC_URI = " \
     git://github.com/smuellerDD/libkcapi.git \
     file://0001-kcapi-kdf-Move-code-to-fix.patch \
+    file://0001-Use-__builtin_bswap32-on-Clang-if-supported.patch \
 "
 
 inherit autotools
Signature · 1 line
2.24.0
author
#1 lore raw

PATCH v2 1/1 ruli: Fix install step and build samples too

do_install never executed as a result it was empty install Create ruli-bin package for utilities, so libraries can be packages granularily

Drop the makefile patch which is no longer needed, set the make variables to get the needed bits set

---
v2: Fix build failures due to warnings on x86/mips

 ...-Fix-build-with-format-string-checks.patch |  29 ++++-
 ...ake-space-for-flags-from-environment.patch |  95 ++++++++++++++
 ...v-Mark-prev_addr_list_size-as-unused.patch |  35 +++++
 .../recipes-support/ruli/files/Makefile.patch | 122 ------------------
 .../recipes-support/ruli/ruli_0.36.bb         |  23 +++-
 5 files changed, 169 insertions(+), 135 deletions(-)
 create mode 100644 meta-networking/recipes-support/ruli/files/0001-Make-space-for-flags-from-environment.patch
 create mode 100644 meta-networking/recipes-support/ruli/files/0001-ruli_srv-Mark-prev_addr_list_size-as-unused.patch
 delete mode 100644 meta-networking/recipes-support/ruli/files/Makefile.patch
meta-networking/recipes-support/ruli/files/0001-Fix-build-with-format-string-checks.patch +23 -6
index f8eb3ae67a..8ca26b51bb 100644
@@ -15,11 +15,9 @@ Signed-off-by: Khem Raj <[email protected]>
  src/ruli_addr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/src/ruli_addr.c b/src/ruli_addr.c
-index 00d5d0d..f1eabae 100644
 --- a/src/ruli_addr.c
 +++ b/src/ruli_addr.c
-@@ -415,7 +415,7 @@ int ruli_in_print(FILE *out, const _ruli_addr *addr, int family)
+@@ -415,7 +415,7 @@ int ruli_in_print(FILE *out, const _ruli
  {
    switch (family) {
    case PF_INET:
@@ -28,6 +26,25 @@ index 00d5d0d..f1eabae 100644
  
    case PF_INET6:
      return ruli_inet6_print(out, &addr->ipv6);
--- 
-2.13.1
-
+--- a/sample/getaddrinfo.c
++++ b/sample/getaddrinfo.c
+@@ -174,7 +174,7 @@ static void solve(const char *fullname)
+ 
+       for (ai = ai_res; ai; ai = ai->ai_next) {
+ 
+-	printf(fullname);
++	printf("%s", fullname);
+ 
+ 	switch (ai->ai_family) {
+ 	case PF_INET:
+--- a/sample/ruli-getaddrinfo.c
++++ b/sample/ruli-getaddrinfo.c
+@@ -176,7 +176,7 @@ static void solve(const char *fullname)
+ 
+       for (ai = ai_res; ai; ai = ai->ai_next) {
+ 
+-	printf(fullname);
++	printf("%s", fullname);
+ 
+ 	switch (ai->ai_family) {
+ 	case PF_INET:
meta-networking/recipes-support/ruli/files/0001-Make-space-for-flags-from-environment.patch new file +95 -0

95 lines not on this page · raw message

meta-networking/recipes-support/ruli/files/0001-ruli_srv-Mark-prev_addr_list_size-as-unused.patch new file +35 -0
new file mode 100644
index 0000000000..213006a677
@@ -0,0 +1,35 @@
+From 895ae26e36c4498677ad0b2695a6e5af05548a29 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 20 Nov 2019 22:02:43 -0800
+Subject: [PATCH] ruli_srv: Mark prev_addr_list_size as unused
+
+This ensures that compiler does not trip on building it
+
+ruli_srv.c:157:20: error: variable 'prev_addr_list_size' set but not used [-Werror=unused-but-set-variable]
+|   int              prev_addr_list_size;
+|                    ^~~~~~~~~~~~~~~~~~~
+cc1: all warnings being treated as errors
+
+Upstream-Status: Inappropriate [Workaround]
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/ruli_srv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/ruli_srv.c b/src/ruli_srv.c
+index 45c70c7..ff82349 100644
+--- a/src/ruli_srv.c
++++ b/src/ruli_srv.c
+@@ -154,7 +154,7 @@ static void *on_walk_answer(ruli_host_t *host_qry, void *qry_arg)
+   walk_t           *walk_qry = (walk_t *) qry_arg;
+   ruli_srv_t       *srv_qry = walk_qry->srv_query;
+   ruli_srv_entry_t *srv_entry;
+-  int              prev_addr_list_size;
++  __attribute__((unused)) int              prev_addr_list_size;
+ 
+   assert(ruli_host_answer_code(host_qry) != RULI_SRV_CODE_VOID);
+ 
+-- 
+2.24.0
+
meta-networking/recipes-support/ruli/files/Makefile.patch deleted +0 -122

122 lines not on this page · raw message

meta-networking/recipes-support/ruli/ruli_0.36.bb +16 -7
index 885796d2a5..b82a3d08e8 100644
@@ -8,18 +8,27 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 DEPENDS = "liboop"
 
 SRC_URI = "http://download.savannah.gnu.org/releases/ruli/ruli_${PV}.orig.tar.gz \
-           file://Makefile.patch \
            file://0001-Fix-build-with-format-string-checks.patch \
            file://0001-src-ruli_addr.c-Add-missing-format-string.patch \
+           file://0001-ruli_srv-Mark-prev_addr_list_size-as-unused.patch \
+           file://0001-Make-space-for-flags-from-environment.patch \
            "
 
 SRC_URI[md5sum] = "e73fbfdeadddb68a703a70cea5271468"
 SRC_URI[sha256sum] = "11d32def5b514748fbd9ea8c88049ae99e1bb358efc74eb91a4d268a3999dbfa"
 
-do_install1() {
-    install -d ${D}${includedir}/ruli
-    install -d ${D}${libdir}
-    install -m 0644 ${S}/src/ruli*.h ${D}${includedir}/ruli
-    install -m 0644 ${S}/src/libruli.so ${D}${libdir}
-    install -m 0644 ${S}/src/libruli.so.4 ${D}${libdir}
+B = "${S}"
+
+EXTRA_OEMAKE = 'CC="${CC}" OOP_BASE_DIR="${STAGING_EXECPREFIXDIR}" INSTALL_BASE_DIR="${D}${exec_prefix}"'
+
+do_configure() {
+    touch configure-stamp
+}
+
+do_install() {
+    oe_runmake install
 }
+
+PACKAGES =+ "${PN}-bin"
+
+FILES_${PN} =+ "${bindir}"
Signature · 1 line
2.24.0