summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2018-10-09 02:03:42 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-10-09 02:03:42 +0200
commitd2f9017b2af5431e4c095da9c2843173a2918684 (patch)
tree6e84eb8cc856a1e9de08ec258b1ee0ed5a9902fe
parent48539b59174564950a9d4546048d462a7bfadfb1 (diff)
nss: add glibc2.5 support
htole32 and friends were only added in glibc 2.9 or something Change-Id: I902d5d7ab3be959e8a3aeb18ba3ce1bd519219a8
-rw-r--r--nss/UnpackedTarball_nss.mk1
-rw-r--r--nss/nss-glib2.5-support.patch53
2 files changed, 54 insertions, 0 deletions
diff --git a/nss/UnpackedTarball_nss.mk b/nss/UnpackedTarball_nss.mk
index a839620f5f53..813309c6bf1e 100644
--- a/nss/UnpackedTarball_nss.mk
+++ b/nss/UnpackedTarball_nss.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
$(if $(findstring 120_70,$(VCVER)_$(WINDOWS_SDK_VERSION)), \
nss/nss-winXP-sdk.patch.1) \
$(if $(filter WNTMSC,$(OS)$(COM)),nss/nss-no-c99.patch) \
+ nss/nss-glib2.5-support.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/nss/nss-glib2.5-support.patch b/nss/nss-glib2.5-support.patch
new file mode 100644
index 000000000000..b8a925965288
--- /dev/null
+++ b/nss/nss-glib2.5-support.patch
@@ -0,0 +1,53 @@
+--- a/nss/nss/lib/freebl/verified/kremlib.h 2018-06-21 11:24:45.000000000 +0200
++++ b/nss/nss/lib/freebl/verified/kremlib.h 2018-10-09 01:59:41.260215665 +0200
+@@ -183,7 +183,49 @@
+
+ /* ... for Linux */
+ #if defined(__linux__) || defined(__CYGWIN__)
+-#include <endian.h>
++/* Define necessary macros for the header to expose all fields. */
++# define _BSD_SOURCE
++# define __USE_BSD
++# define _DEFAULT_SOURCE
++# include <endian.h>
++# include <features.h>
++/* See http://linux.die.net/man/3/endian */
++# if !defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 9)))
++# include <arpa/inet.h>
++# if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN)
++# define htobe16(x) htons(x)
++# define htole16(x) (x)
++# define be16toh(x) ntohs(x)
++# define le16toh(x) (x)
++
++# define htobe32(x) htonl(x)
++# define htole32(x) (x)
++# define be32toh(x) ntohl(x)
++# define le32toh(x) (x)
++
++# define htobe64(x) (((uint64_t)htonl(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)htonl(((uint32_t)(x)))) << 32))
++# define htole64(x) (x)
++# define be64toh(x) (((uint64_t)ntohl(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)ntohl(((uint32_t)(x)))) << 32))
++# define le64toh(x) (x)
++# elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)
++# define htobe16(x) (x)
++# define htole16(x) ((((((uint16_t)(x)) >> 8))|((((uint16_t)(x)) << 8)))
++# define be16toh(x) (x)
++# define le16toh(x) ((((((uint16_t)(x)) >> 8))|((((uint16_t)(x)) << 8)))
++
++# define htobe32(x) (x)
++# define htole32(x) (((uint32_t)htole16(((uint16_t)(((uint32_t)(x)) >> 16)))) | (((uint32_t)htole16(((uint16_t)(x)))) << 16))
++# define be32toh(x) (x)
++# define le32toh(x) (((uint32_t)le16toh(((uint16_t)(((uint32_t)(x)) >> 16)))) | (((uint32_t)le16toh(((uint16_t)(x)))) << 16))
++
++# define htobe64(x) (x)
++# define htole64(x) (((uint64_t)htole32(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)htole32(((uint32_t)(x)))) << 32))
++# define be64toh(x) (x)
++# define le64toh(x) (((uint64_t)le32toh(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)le32toh(((uint32_t)(x)))) << 32))
++# else
++# error Byte Order not supported or not defined.
++# endif
++# endif
+
+ /* ... for OSX */
+ #elif defined(__APPLE__)