--- /dev/null
+Add ZLIB_INCLUDE_DIR variable
+
+On Linux platform[1], the build system forces to use zlib from the
+system instead of compiling the one located intree.
+
+The following error is raised when the zlib header is installed
+somewhere else than in the default system include path:
+
+ ssl3con.c:39:18: fatal error: zlib.h: No such file or directory
+ #include "zlib.h"
+
+The same trick setup for sqlite include directory is reproduced for
+zlib. The build system disallows in any manner to give arguments to the
+compiler explicity.
+
+The variable ZLIB_INCLUDE_DIR point to the directory where the zlib
+header is located.
+
+[1]: https://hg.mozilla.org/projects/nss/file/NSS_3_33_BRANCH/coreconf/Linux.mk#l180
+[2]: https://hg.mozilla.org/projects/nss/file/NSS_3_33_BRANCH/lib/softoken/manifest.mn#l17
+
+Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
+
+--- libnss-3.33.orig/nss/lib/ssl/manifest.mn 2017-09-20 02:47:27.000000000 -0400
++++ libnss-3.33/nss/lib/ssl/manifest.mn 2018-02-16 16:45:41.512709898 -0500
+@@ -6,6 +6,10 @@
+
+ # DEFINES = -DTRACE
+
++ifdef ZLIB_INCLUDE_DIR
++INCLUDES += -I$(ZLIB_INCLUDE_DIR)
++endif
++
+ EXPORTS = \
+ ssl.h \
+ sslt.h \
+--- host-libnss-3.33.orig/nss/cmd/signtool/manifest.mn.orig 2018-02-16 17:08:58.474777871 -0500
++++ host-libnss-3.33/nss/cmd/signtool/manifest.mn 2018-02-16 17:09:22.603710963 -0500
+@@ -6,6 +6,10 @@
+
+ MODULE = nss
+
++ifdef ZLIB_INCLUDE_DIR
++INCLUDES += -I$(ZLIB_INCLUDE_DIR)
++endif
++
+ EXPORTS =
+
+ CSRCS = signtool.c \
+++ /dev/null
-Fix build with uClibc-ng
-
-The elf.h header in uClibc-ng is missing the AT_HWCAP2 definition. Add it in
-the code.
-
-Signed-off-by: Baruch Siach <baruch@tkos.co.il>
----
-Upstream status: Not upstreamable; uClibc needs to update elf.h
-
-diff -Nuar nss-3.38.orig/nss/lib/freebl/blinit.c nss-3.38/nss/lib/freebl/blinit.c
---- nss-3.38.orig/nss/lib/freebl/blinit.c 2018-06-21 12:24:45.000000000 +0300
-+++ nss-3.38/nss/lib/freebl/blinit.c 2018-06-26 13:13:55.636434720 +0300
-@@ -100,6 +100,9 @@
- defined(__GNUC__) && __GNUC__ >= 2 && defined(__ELF__)
- #include <sys/auxv.h>
- extern unsigned long getauxval(unsigned long type) __attribute__((weak));
-+#ifndef AT_HWCAP2
-+#define AT_HWCAP2 26
-+#endif
- #else
- static unsigned long (*getauxval)(unsigned long) = NULL;
- #define AT_HWCAP2 0
--- /dev/null
+From 2e1b003600156e4adcb88998eabf18addee45be1 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Sun, 8 Dec 2019 11:57:45 +0100
+Subject: [PATCH] Bug 1602288 - Fix build failure due to missing posix signal.h
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/coreconf/Linux.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
+index d07f8a3c5..854d3ca96 100644
+--- a/nss/coreconf/Linux.mk
++++ b/nss/coreconf/Linux.mk
+@@ -21,7 +21,7 @@ ifeq ($(USE_PTHREADS),1)
+ endif
+
+ DEFAULT_COMPILER = gcc
+-DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE
++DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE
+
+ ifeq ($(OS_TARGET),Android)
+ ifndef ANDROID_NDK
+--
+2.20.1
+
+++ /dev/null
-Add ZLIB_INCLUDE_DIR variable
-
-On Linux platform[1], the build system forces to use zlib from the
-system instead of compiling the one located intree.
-
-The following error is raised when the zlib header is installed
-somewhere else than in the default system include path:
-
- ssl3con.c:39:18: fatal error: zlib.h: No such file or directory
- #include "zlib.h"
-
-The same trick setup for sqlite include directory is reproduced for
-zlib. The build system disallows in any manner to give arguments to the
-compiler explicity.
-
-The variable ZLIB_INCLUDE_DIR point to the directory where the zlib
-header is located.
-
-[1]: https://hg.mozilla.org/projects/nss/file/NSS_3_33_BRANCH/coreconf/Linux.mk#l180
-[2]: https://hg.mozilla.org/projects/nss/file/NSS_3_33_BRANCH/lib/softoken/manifest.mn#l17
-
-Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
-
---- libnss-3.33.orig/nss/lib/ssl/manifest.mn 2017-09-20 02:47:27.000000000 -0400
-+++ libnss-3.33/nss/lib/ssl/manifest.mn 2018-02-16 16:45:41.512709898 -0500
-@@ -6,6 +6,10 @@
-
- # DEFINES = -DTRACE
-
-+ifdef ZLIB_INCLUDE_DIR
-+INCLUDES += -I$(ZLIB_INCLUDE_DIR)
-+endif
-+
- EXPORTS = \
- ssl.h \
- sslt.h \
---- host-libnss-3.33.orig/nss/cmd/signtool/manifest.mn.orig 2018-02-16 17:08:58.474777871 -0500
-+++ host-libnss-3.33/nss/cmd/signtool/manifest.mn 2018-02-16 17:09:22.603710963 -0500
-@@ -6,6 +6,10 @@
-
- MODULE = nss
-
-+ifdef ZLIB_INCLUDE_DIR
-+INCLUDES += -I$(ZLIB_INCLUDE_DIR)
-+endif
-+
- EXPORTS =
-
- CSRCS = signtool.c \
+++ /dev/null
-From 2e1b003600156e4adcb88998eabf18addee45be1 Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <giulio.benetti@benettiengineering.com>
-Date: Sun, 8 Dec 2019 11:57:45 +0100
-Subject: [PATCH] Bug 1602288 - Fix build failure due to missing posix signal.h
-
-Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
----
- nss/coreconf/Linux.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
-index d07f8a3c5..854d3ca96 100644
---- a/nss/coreconf/Linux.mk
-+++ b/nss/coreconf/Linux.mk
-@@ -21,7 +21,7 @@ ifeq ($(USE_PTHREADS),1)
- endif
-
- DEFAULT_COMPILER = gcc
--DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE
-+DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE
-
- ifeq ($(OS_TARGET),Android)
- ifndef ANDROID_NDK
---
-2.20.1
-
--- /dev/null
+From efe0fd875c80ff6e3a05db6c5e15b07c173530a6 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Tue, 10 Dec 2019 13:06:01 +0100
+Subject: [PATCH] Bug 1602743 - Fix PowerPc build sys/auxv.h failure
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/lib/freebl/blinit.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/nss/lib/freebl/blinit.c b/nss/lib/freebl/blinit.c
+index 959109b60..f0654595d 100644
+--- a/nss/lib/freebl/blinit.c
++++ b/nss/lib/freebl/blinit.c
+@@ -357,7 +357,9 @@ ppc_crypto_support()
+
+ #if defined(__powerpc__)
+
++#if (__has_include(<sys/auxv.h>))
+ #include <sys/auxv.h>
++#endif
+
+ // Defines from cputable.h in Linux kernel - PPC, letting us build on older kernels
+ #ifndef PPC_FEATURE2_VEC_CRYPTO
+@@ -368,8 +370,11 @@ static void
+ CheckPPCSupport()
+ {
+ char *disable_hw_crypto = PR_GetEnvSecure("NSS_DISABLE_PPC_GHASH");
++ long hwcaps = 0;
+
+- long hwcaps = getauxval(AT_HWCAP2);
++#if (__has_include(<sys/auxv.h>))
++ hwcaps = getauxval(AT_HWCAP2);
++#endif
+
+ ppc_crypto_support_ = hwcaps & PPC_FEATURE2_VEC_CRYPTO && disable_hw_crypto == NULL;
+ }
+--
+2.20.1
+
+++ /dev/null
-From efe0fd875c80ff6e3a05db6c5e15b07c173530a6 Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <giulio.benetti@benettiengineering.com>
-Date: Tue, 10 Dec 2019 13:06:01 +0100
-Subject: [PATCH] Bug 1602743 - Fix PowerPc build sys/auxv.h failure
-
-Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
----
- nss/lib/freebl/blinit.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/nss/lib/freebl/blinit.c b/nss/lib/freebl/blinit.c
-index 959109b60..f0654595d 100644
---- a/nss/lib/freebl/blinit.c
-+++ b/nss/lib/freebl/blinit.c
-@@ -357,7 +357,9 @@ ppc_crypto_support()
-
- #if defined(__powerpc__)
-
-+#if (__has_include(<sys/auxv.h>))
- #include <sys/auxv.h>
-+#endif
-
- // Defines from cputable.h in Linux kernel - PPC, letting us build on older kernels
- #ifndef PPC_FEATURE2_VEC_CRYPTO
-@@ -368,8 +370,11 @@ static void
- CheckPPCSupport()
- {
- char *disable_hw_crypto = PR_GetEnvSecure("NSS_DISABLE_PPC_GHASH");
-+ long hwcaps = 0;
-
-- long hwcaps = getauxval(AT_HWCAP2);
-+#if (__has_include(<sys/auxv.h>))
-+ hwcaps = getauxval(AT_HWCAP2);
-+#endif
-
- ppc_crypto_support_ = hwcaps & PPC_FEATURE2_VEC_CRYPTO && disable_hw_crypto == NULL;
- }
---
-2.20.1
-
--- /dev/null
+From 1ba8516045bc8a13fd72e1a85206a04b29d96758 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Thu, 12 Dec 2019 12:57:29 +0100
+Subject: [PATCH] Bug 1603398 - Fix nsinstall.c build failure on RHEL 7
+
+In Linux.mk -DLINUX and -Dlinux must be passed to DEFINES, not
+OS_CFLAGS.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/coreconf/Linux.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
+index d07f8a3c5..4b45a6054 100644
+--- a/nss/coreconf/Linux.mk
++++ b/nss/coreconf/Linux.mk
+@@ -132,7 +132,7 @@ endif
+
+ OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR
+ ifeq ($(KERNEL),Linux)
+- OS_CFLAGS += -DLINUX -Dlinux
++ DEFINES += -DLINUX -Dlinux
+ endif
+ OS_LIBS = $(OS_PTHREAD) -ldl -lc
+
+--
+2.20.1
+
+++ /dev/null
-From 1ba8516045bc8a13fd72e1a85206a04b29d96758 Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <giulio.benetti@benettiengineering.com>
-Date: Thu, 12 Dec 2019 12:57:29 +0100
-Subject: [PATCH] Bug 1603398 - Fix nsinstall.c build failure on RHEL 7
-
-In Linux.mk -DLINUX and -Dlinux must be passed to DEFINES, not
-OS_CFLAGS.
-
-Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
----
- nss/coreconf/Linux.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/nss/coreconf/Linux.mk b/nss/coreconf/Linux.mk
-index d07f8a3c5..4b45a6054 100644
---- a/nss/coreconf/Linux.mk
-+++ b/nss/coreconf/Linux.mk
-@@ -132,7 +132,7 @@ endif
-
- OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR
- ifeq ($(KERNEL),Linux)
-- OS_CFLAGS += -DLINUX -Dlinux
-+ DEFINES += -DLINUX -Dlinux
- endif
- OS_LIBS = $(OS_PTHREAD) -ldl -lc
-
---
-2.20.1
-