package/mesa3d: Fix endianess detection with musl-based toolchains
authorBernd Kuhls <bernd.kuhls@t-online.de>
Fri, 4 Nov 2016 20:20:58 +0000 (21:20 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 5 Nov 2016 10:52:04 +0000 (11:52 +0100)
Fixes
http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
http://autobuild.buildroot.net/results/462/4629ee4813aa36de884bba2576612f909c007264/

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/mesa3d/0004-Fix-endianess-detection-with-musl-based-toolchains.patch [new file with mode: 0644]

diff --git a/package/mesa3d/0004-Fix-endianess-detection-with-musl-based-toolchains.patch b/package/mesa3d/0004-Fix-endianess-detection-with-musl-based-toolchains.patch
new file mode 100644 (file)
index 0000000..656705b
--- /dev/null
@@ -0,0 +1,65 @@
+From 61b076689b6308b1c9d0d84ee8654a47e65e67ae Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd.kuhls@t-online.de>
+Date: Fri, 4 Nov 2016 19:44:37 +0100
+Subject: [PATCH 1/1] Fix endianess detection with musl-based toolchains
+
+Musl does not define __GLIBC__ and will not provide a __MUSL__ macro:
+http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F
+
+This patch checks for the presence of endian.h and promotes the result
+to src/amd/Makefile.addrlib.am which executes the broken build command.
+Fixes compile errors detected by the autobuilder infrastructure of the
+buildroot project:
+
+http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
+http://autobuild.buildroot.net/results/e27/e27a9a95f72dba3076549beb2a2ccfdbea2fcfee/
+
+Patch sent upstream: https://patchwork.freedesktop.org/patch/119961/
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ configure.ac                | 1 +
+ src/amd/Makefile.addrlib.am | 1 +
+ src/util/u_endian.h         | 2 +-
+ 3 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 4761c59..7991b52 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -786,6 +786,7 @@ fi
+ AC_HEADER_MAJOR
+ AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
+ AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
++AC_CHECK_HEADER([endian.h], [DEFINES="$DEFINES -DHAVE_ENDIAN_H"])
+ AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
+ AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
+diff --git a/src/amd/Makefile.addrlib.am b/src/amd/Makefile.addrlib.am
+index 64823fc..4e2fb1d 100644
+--- a/src/amd/Makefile.addrlib.am
++++ b/src/amd/Makefile.addrlib.am
+@@ -28,6 +28,7 @@ addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
+       -I$(srcdir)/addrlib/core \
+       -I$(srcdir)/addrlib/inc/chip/r800 \
+       -I$(srcdir)/addrlib/r800/chip \
++      $(DEFINES) \
+       -DBRAHMA_BUILD=1
+ addrlib_libamdgpu_addrlib_la_CXXFLAGS = \
+diff --git a/src/util/u_endian.h b/src/util/u_endian.h
+index b9d563d..266fb4a 100644
+--- a/src/util/u_endian.h
++++ b/src/util/u_endian.h
+@@ -27,7 +27,7 @@
+ #ifndef U_ENDIAN_H
+ #define U_ENDIAN_H
+-#if defined(__GLIBC__) || defined(ANDROID)
++#if defined(__GLIBC__) || defined(ANDROID) || defined(HAVE_ENDIAN_H)
+ #include <endian.h>
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+-- 
+2.10.1
+