From 045adbeb66933c0b2bc1c4b6920eb0e7b7ca04af Mon Sep 17 00:00:00 2001
From: Peter Stadler <peter.stadler@student.uibk.ac.at>
Date: Tue, 4 Feb 2020 16:14:46 +0100
Subject: [PATCH] nginx: fix endianness issue #8988

Patch the auto/endianess file to use CONFIG_BIG_ENDIAN.

Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
---
 net/nginx/Makefile                         |  4 +++-
 net/nginx/patches/104-endianness_fix.patch | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 net/nginx/patches/104-endianness_fix.patch

diff --git a/net/nginx/Makefile b/net/nginx/Makefile
index 496bb7e4c..1ad9e1c50 100644
--- a/net/nginx/Makefile
+++ b/net/nginx/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nginx
 PKG_VERSION:=1.17.7
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://nginx.org/download/
@@ -361,6 +361,8 @@ ifeq ($(CONFIG_NGINX_LUA),y)
 					LUA_LIB=$(STAGING_DIR)/usr/lib
 endif
 
+CONFIGURE_VARS += CONFIG_BIG_ENDIAN=$(CONFIG_BIG_ENDIAN)
+
 CONFIGURE_ARGS += \
 			--crossbuild=Linux::$(ARCH) \
 			--prefix=/usr \
diff --git a/net/nginx/patches/104-endianness_fix.patch b/net/nginx/patches/104-endianness_fix.patch
new file mode 100644
index 000000000..081bcdb00
--- /dev/null
+++ b/net/nginx/patches/104-endianness_fix.patch
@@ -0,0 +1,21 @@
+diff --git a/auto/endianness b/auto/endianness
+index 1b552b6b..2b6f9ea4 100644
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -12,6 +12,16 @@ checking for system byte ordering
+ 
+ END
+ 
++if [ "${CONFIG_BIG_ENDIAN}" != "y" ]; then
++    echo " little endian"
++    have=NGX_HAVE_LITTLE_ENDIAN . auto/have
++else
++    echo " big endian"
++fi
++
++return
++
++
+ 
+ cat << END > $NGX_AUTOTEST.c
+