diff options
author | Piotr Kubaj <pkubaj@FreeBSD.org> | 2019-12-12 02:57:48 +0800 |
---|---|---|
committer | Piotr Kubaj <pkubaj@FreeBSD.org> | 2019-12-12 02:57:48 +0800 |
commit | 6aca4f31c06d288d5412bda7f3a76963ac1ac7b8 (patch) | |
tree | f3a89e032dafe9a22e1ac639577a5e6665ff5676 | |
parent | e52f086b5411a92d22adca9de2078036faf3f1d8 (diff) | |
download | freebsd-ports-gnome-6aca4f31c06d288d5412bda7f3a76963ac1ac7b8.tar.gz freebsd-ports-gnome-6aca4f31c06d288d5412bda7f3a76963ac1ac7b8.tar.zst freebsd-ports-gnome-6aca4f31c06d288d5412bda7f3a76963ac1ac7b8.zip |
security/nss: fix build on powerpc platforms
NSS 3.48 broke powerpc by using getauxval, which FreeBSD doesn't have. GCC9 is also required because of usage of VSX, which needs to be manually added for some files.
PR: 242521
Approved by: jbeich (maintainer)
-rw-r--r-- | security/nss/Makefile | 4 | ||||
-rw-r--r-- | security/nss/files/patch-bug1602386 | 49 |
2 files changed, 51 insertions, 2 deletions
diff --git a/security/nss/Makefile b/security/nss/Makefile index 84dbfb5995d1..b84ac0b01d2b 100644 --- a/security/nss/Makefile +++ b/security/nss/Makefile @@ -55,8 +55,8 @@ BINS= ${DIST}/${OPSYS}${OSREL}_OPT.OBJ BINS= ${DIST}/${OPSYS}${OSREL}_DBG.OBJ .endif -.if ${OPSYS} == FreeBSD && ${ARCH} == i386 && ! ${MACHINE_CPU:Msse2} -USES+= compiler:c++14-lang # gcm.h +.if ${ARCH} == powerpc64 +USES+= compiler:c++11-lang # -mcrypto -mvsx .endif .if ${OPSYS} == FreeBSD && ${ARCH} == amd64 diff --git a/security/nss/files/patch-bug1602386 b/security/nss/files/patch-bug1602386 new file mode 100644 index 000000000000..1b24397fece6 --- /dev/null +++ b/security/nss/files/patch-bug1602386 @@ -0,0 +1,49 @@ +Fix build on FreeBSD/powerpc platforms. + +https://bugzilla.mozilla.org/show_bug.cgi?id=1602386 + +--- lib/freebl/Makefile.orig 2019-12-04 01:03:31.000000000 +0100 ++++ lib/freebl/Makefile 2019-12-11 16:48:47.959791000 +0100 +@@ -788,5 +788,7 @@ + endif + + ifeq ($(CPU_ARCH),ppc) +-$(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec ++$(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx ++$(OBJDIR)/$(PROG_PREFIX)gcm$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx ++$(OBJDIR)/$(PROG_PREFIX)rijndael$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx + endif +--- lib/freebl/blinit.c.orig 2019-12-11 17:45:06.930646000 +0100 ++++ lib/freebl/blinit.c 2019-12-11 17:50:04.797680000 +0100 +@@ -393,7 +393,12 @@ + + #if defined(__powerpc__) + ++#if defined(__FreeBSD__) && __FreeBSD__ < 12 ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#else + #include <sys/auxv.h> ++#endif + + // Defines from cputable.h in Linux kernel - PPC, letting us build on older kernels + #ifndef PPC_FEATURE2_VEC_CRYPTO +@@ -405,7 +410,17 @@ + { + char *disable_hw_crypto = PR_GetEnvSecure("NSS_DISABLE_PPC_GHASH"); + +- long hwcaps = getauxval(AT_HWCAP2); ++ unsigned long hwcaps = 0; ++#if defined(__linux__) ++ hwcaps = getauxval(AT_HWCAP2); ++#elif defined(__FreeBSD__) ++# if __FreeBSD__ >= 12 ++ elf_aux_info(AT_HWCAP2, &hwcaps, sizeof(hwcaps)); ++# else ++ size_t len = sizeof(hwcaps); ++ sysctlbyname("hw.cpu_features2", &hwcaps, &len, NULL, 0); ++# endif ++#endif + + ppc_crypto_support_ = hwcaps & PPC_FEATURE2_VEC_CRYPTO && disable_hw_crypto == NULL; + } |