diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-03-22 07:56:17 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-25 10:29:16 +0000 |
commit | af1f77a1eb9d1dc3de17c9b0a2b74d76ada40544 (patch) | |
tree | 0a4bab52148631b239566741925ed5e47ed826f9 /meta/recipes-extended/pixz/pixz | |
parent | 421289cbcc422d8a45018f69660a1ed3b1018cb3 (diff) | |
download | poky-af1f77a1eb9d1dc3de17c9b0a2b74d76ada40544.tar.gz |
pixz: Fix build on big-endian/musl systems
(From OE-Core rev: 364f625480dca41d2902e209e4bfb675b1a93dce)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/pixz/pixz')
2 files changed, 98 insertions, 0 deletions
diff --git a/meta/recipes-extended/pixz/pixz/0001-configure-Detect-headers-before-using-them.patch b/meta/recipes-extended/pixz/pixz/0001-configure-Detect-headers-before-using-them.patch new file mode 100644 index 0000000000..12bae28dc7 --- /dev/null +++ b/meta/recipes-extended/pixz/pixz/0001-configure-Detect-headers-before-using-them.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From c84480be8df6966c538d1fb67ccae2f42cc46421 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 22 Mar 2016 07:36:54 +0000 | ||
4 | Subject: [PATCH 1/2] configure: Detect headers before using them | ||
5 | |||
6 | Current logic does not work when system does not have | ||
7 | sys/endian.h, since it tried to reuse the cached results | ||
8 | from first try of detecting htole64 in sys/endian.h which is | ||
9 | 'no' and hence the second try to look into endian.h also | ||
10 | comes out negative. | ||
11 | |||
12 | So we check for header and then run the test for symbols | ||
13 | and these symbols are not standard and we need to define _GNU_SOURCE | ||
14 | for it to work, this issue is exposed by systems using musl e.g. | ||
15 | |||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | --- | ||
18 | Upstream-Status: Submitted | ||
19 | |||
20 | configure.ac | 13 +++++++++---- | ||
21 | 1 file changed, 9 insertions(+), 4 deletions(-) | ||
22 | |||
23 | diff --git a/configure.ac b/configure.ac | ||
24 | index 4cb56bc..5e23c50 100644 | ||
25 | --- a/configure.ac | ||
26 | +++ b/configure.ac | ||
27 | @@ -69,12 +69,17 @@ AC_FUNC_MALLOC | ||
28 | AC_FUNC_REALLOC | ||
29 | AC_FUNC_STRTOD | ||
30 | AC_CHECK_FUNCS([memchr memmove memset strerror strtol]) | ||
31 | -AC_CHECK_DECLS([htole64, le64toh], | ||
32 | - [], | ||
33 | +AC_CHECK_HEADER([sys/endian.h], | ||
34 | [ | ||
35 | - AC_CHECK_DECLS([htole64, le64toh], [], [], [#include <endian.h>]) | ||
36 | + AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <sys/endian.h>]) | ||
37 | ], | ||
38 | - [#include <sys/endian.h>]) | ||
39 | + [], []) | ||
40 | + | ||
41 | +AC_CHECK_HEADER([endian.h], | ||
42 | + [ | ||
43 | + AC_CHECK_DECLS([htole64, le64toh], [], [], [#define _GNU_SOURCE 1 #include <endian.h>]) | ||
44 | + ], | ||
45 | + [], []) | ||
46 | |||
47 | AC_CONFIG_FILES([Makefile | ||
48 | src/Makefile | ||
49 | -- | ||
50 | 1.8.3.1 | ||
51 | |||
diff --git a/meta/recipes-extended/pixz/pixz/0002-endian-Use-macro-bswap_64-instead-of-__bswap_64.patch b/meta/recipes-extended/pixz/pixz/0002-endian-Use-macro-bswap_64-instead-of-__bswap_64.patch new file mode 100644 index 0000000000..6b615988db --- /dev/null +++ b/meta/recipes-extended/pixz/pixz/0002-endian-Use-macro-bswap_64-instead-of-__bswap_64.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 5f3a535987bae4c3e3d9e9079c7526e399f7aecd Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 22 Mar 2016 07:42:39 +0000 | ||
4 | Subject: [PATCH 2/2] endian: Use macro bswap_64 instead of __bswap_64 | ||
5 | |||
6 | byteswap.h defines then as public APIs on all libc | ||
7 | on linux including musl | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | Upstream-Status: Submitted | ||
12 | src/endian.c | 5 +++-- | ||
13 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/src/endian.c b/src/endian.c | ||
16 | index b7724f3..51aea58 100644 | ||
17 | --- a/src/endian.c | ||
18 | +++ b/src/endian.c | ||
19 | @@ -15,6 +15,7 @@ void xle64enc(uint8_t *d, uint64_t n) { | ||
20 | #include <stdint.h> | ||
21 | #ifdef __linux__ | ||
22 | #include <endian.h> | ||
23 | + #include <byteswap.h> | ||
24 | #else | ||
25 | #include <sys/endian.h> | ||
26 | #endif | ||
27 | @@ -23,7 +24,7 @@ void xle64enc(uint8_t *d, uint64_t n) { | ||
28 | # if __BYTE_ORDER == __LITTLE_ENDIAN | ||
29 | # define htole64(x) (x) | ||
30 | # else | ||
31 | -# define htole64(x) __bswap_64 (x) | ||
32 | +# define htole64(x) bswap_64 (x) | ||
33 | # endif | ||
34 | #endif | ||
35 | |||
36 | @@ -31,7 +32,7 @@ void xle64enc(uint8_t *d, uint64_t n) { | ||
37 | # if __BYTE_ORDER == __LITTLE_ENDIAN | ||
38 | # define le64toh(x) (x) | ||
39 | # else | ||
40 | -# define le64toh(x) __bswap_64 (x) | ||
41 | +# define le64toh(x) bswap_64 (x) | ||
42 | # endif | ||
43 | #endif | ||
44 | |||
45 | -- | ||
46 | 1.8.3.1 | ||
47 | |||