Skip to contentSkip to conversation

pixz: Fix build on big-endian/musl systems

PATCH New Khem Raj 1 participant 1 message Mar 22, 2016

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 pixz: Fix build on big-endian/musl systems

---
 ...onfigure-Detect-headers-before-using-them.patch | 51 ++++++++++++++++++++++
 ...-Use-macro-bswap_64-instead-of-__bswap_64.patch | 47 ++++++++++++++++++++
 meta/recipes-extended/pixz/pixz_1.0.6.bb           |  7 ++-
 3 files changed, 103 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/pixz/pixz/0001-configure-Detect-headers-before-using-them.patch
 create mode 100644 meta/recipes-extended/pixz/pixz/0002-endian-Use-macro-bswap_64-instead-of-__bswap_64.patch
meta/recipes-extended/pixz/pixz/0001-configure-Detect-headers-before-using-them.patch new file +51 -0
new file mode 100644
index 0000000..12bae28
@@ -0,0 +1,51 @@
+From c84480be8df6966c538d1fb67ccae2f42cc46421 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 22 Mar 2016 07:36:54 +0000
+Subject: [PATCH 1/2] configure: Detect headers before using them
+
+Current logic does not work when system does not have
+sys/endian.h, since it tried to reuse the cached results
+from first try of detecting htole64 in sys/endian.h which is
+'no' and hence the second try to look into endian.h also
+comes out negative.
+
+So we check for header and then run the test for symbols
+and these symbols are not standard and we need to define _GNU_SOURCE
+for it to work, this issue is exposed by systems using musl e.g.
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Submitted
+
+ configure.ac | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 4cb56bc..5e23c50 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -69,12 +69,17 @@ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+ AC_FUNC_STRTOD
+ AC_CHECK_FUNCS([memchr memmove memset strerror strtol])
+-AC_CHECK_DECLS([htole64, le64toh],
+-               [],
++AC_CHECK_HEADER([sys/endian.h],
+                [
+-                 AC_CHECK_DECLS([htole64, le64toh], [], [], [#include <endian.h>])
++                 AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <sys/endian.h>])
+                ],
+-               [#include <sys/endian.h>])
++               [], [])
++
++AC_CHECK_HEADER([endian.h],
++               [
++                 AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <endian.h>])
++               ],
++               [], [])
+ 
+ AC_CONFIG_FILES([Makefile
+                  src/Makefile
+-- 
+1.8.3.1
+
meta/recipes-extended/pixz/pixz/0002-endian-Use-macro-bswap_64-instead-of-__bswap_64.patch new file +47 -0

47 lines not on this page · raw message

meta/recipes-extended/pixz/pixz_1.0.6.bb +5 -2
index 67681d4..0e51472 100644
@@ -9,11 +9,14 @@ SRC_URI[sha256sum] = "02c50746b134fa1b1aae41fcc314d7c6f1919b3d48bcdea01bf11769f8
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=5cf6d164086105f1512ccb81bfff1926"
 
-SRC_URI += "file://936d8068ae19d95260d3058f41dd6cf718101cd6.patch"
+SRC_URI += "file://936d8068ae19d95260d3058f41dd6cf718101cd6.patch \
+            file://0001-configure-Detect-headers-before-using-them.patch \
+            file://0002-endian-Use-macro-bswap_64-instead-of-__bswap_64.patch \
+"
 UPSTREAM_CHECK_URI = "https://github.com/vasi/pixz/releases"
 
 EXTRA_OECONF += "--without-manpage"
-
+CFLAGS_append_libc-musl = " -D_GNU_SOURCE"
 CACHED_CONFIGUREVARS += "ac_cv_file_src_pixz_1=no"
 
 inherit autotools pkgconfig
Signature · 1 line
1.8.3.1