kumquat-buildroot/package/skalibs/0001-No-runtime-tests-for-endianness.patch
Eric Le Bihan 332360e342 skalibs: new package
This new package provides skalibs, a collection of free software / open
source C development files used for building all softwares from
skarnet.org.

Note that, though skalibs (and all skarnet softwares) follows the
"./configure; make; make install" convention, it does not behave like a
traditional autotools project:

 - static libraries are installed in $prefix/usr/lib/skalibs.
 - pkg-config and libtool are not used: instead a custom system called
   "sysdeps" is used and locations to libraries and headers are to be
   passed explicitly via options of the './configure' script.

The host variant is provided to allow building the host variants of the
other skarnet softwares.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
[Thomas: remove post install target hook, do it directly in the target
installation commands.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-12-23 11:19:58 +01:00

96 lines
3.0 KiB
Diff

From 1e6f0b094c6ce6454be572704b866d2ce0962e59 Mon Sep 17 00:00:00 2001
From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Date: Sun, 4 Dec 2016 19:10:40 +0100
Subject: [PATCH] No runtime tests for endianness
Replace build and execution of runtime test programs for determining
the endianness of the target with compile time test programs.
This improves support for cross-compilation.
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
configure | 15 +++++++++++----
src/sysdeps/trybigendian.c | 16 ++++++++++++++++
src/sysdeps/trylittleendian.c | 16 ++++++++++++++++
3 files changed, 43 insertions(+), 4 deletions(-)
create mode 100644 src/sysdeps/trybigendian.c
create mode 100644 src/sysdeps/trylittleendian.c
diff --git a/configure b/configure
index 1579025..4da9c5e 100755
--- a/configure
+++ b/configure
@@ -463,13 +463,20 @@ EOF
fi
exec 3>&-
- echo "Checking system endianness..."
- $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o tryendianness src/sysdeps/tryendianness.c
- endianness=$(./tryendianness) || fail "$0: unable to determine endianness"
+ echo "Checking system endianness..."
+ if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o trybigendian src/sysdeps/trybigendian.c 2>/dev/null; then
+ endianness=big
+ else
+ if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -o trylittleendian src/sysdeps/trylittleendian.c 2>/dev/null; then
+ endianness=little
+ else
+ fail "$0: unable to determine endianness"
+ fi
+ fi
echo "endianness: $endianness" >> $sysdeps/sysdeps
echo "#define ${package_macro_name}_ENDIANNESS \"$endianness\"" >> $sysdeps/sysdeps.h
echo " ... $endianness"
- rm -f tryendianness
+ rm -f trybigendian trylittleendian
trytypesize ushort USHORT "unsigned short"
trytypesize uint UINT "unsigned int"
diff --git a/src/sysdeps/trybigendian.c b/src/sysdeps/trybigendian.c
new file mode 100644
index 0000000..d857572
--- /dev/null
+++ b/src/sysdeps/trybigendian.c
@@ -0,0 +1,16 @@
+#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) || \
+ defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
+ defined(__BIG_ENDIAN) || \
+ defined(__ARMEB__) || \
+ defined(__THUMBEB__) || \
+ defined(__AARCH64EB__) || \
+ defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
+#define YEAH
+#else
+#error "not big endian"
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/src/sysdeps/trylittleendian.c b/src/sysdeps/trylittleendian.c
new file mode 100644
index 0000000..eba065a
--- /dev/null
+++ b/src/sysdeps/trylittleendian.c
@@ -0,0 +1,16 @@
+#if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) || \
+ defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
+ defined(__LITTLE_ENDIAN) || \
+ defined(__ARMEL__) || \
+ defined(__THUMBEL__) || \
+ defined(__AARCH64EL__) || \
+ defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
+#define YEAH
+#else
+#error "not little endian"
+#endif
+
+int main(void)
+{
+ return 0;
+}
--
2.5.5