From af066db7e9c943d684153af93796d909f59328be Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 27 Mar 2017 16:06:19 +0000 Subject: [PATCH] devel/nspr: use localtime_r and PTHREAD_MUTEX_ADAPTIVE_NP --- devel/nspr/Makefile | 1 + devel/nspr/files/patch-bug1350414 | 55 +++++++++++++++++++++++++++++++ devel/nspr/files/patch-bug1350966 | 17 ++++++++++ 3 files changed, 73 insertions(+) create mode 100644 devel/nspr/files/patch-bug1350414 create mode 100644 devel/nspr/files/patch-bug1350966 diff --git a/devel/nspr/Makefile b/devel/nspr/Makefile index cf5823dce8c4..a11241397878 100644 --- a/devel/nspr/Makefile +++ b/devel/nspr/Makefile @@ -3,6 +3,7 @@ PORTNAME= nspr DISTVERSION= 4.14 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= MOZILLA/${PORTNAME}/releases/v${PORTVERSION}/src diff --git a/devel/nspr/files/patch-bug1350414 b/devel/nspr/files/patch-bug1350414 new file mode 100644 index 000000000000..3af61346cc39 --- /dev/null +++ b/devel/nspr/files/patch-bug1350414 @@ -0,0 +1,55 @@ +--- configure~ ++++ configure +@@ -6730,6 +6730,8 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5 + + $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h + ++ $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h ++ + CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall" + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` + if test "$MOZ_OBJFORMAT" = "elf"; then +@@ -7340,6 +7342,8 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool." + + $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h + ++ $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h ++ + if test -z "$USE_NSPR_THREADS"; then + USE_PTHREADS=1 + fi +@@ -7396,6 +7400,8 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool." + + $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h + ++ $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h ++ + CFLAGS="$CFLAGS -ansi -Wall" + CXXFLAGS="$CXXFLAGS -ansi -Wall" + DLL_SUFFIX=so.1.0 +--- configure.in~ ++++ configure.in +@@ -1554,6 +1554,7 @@ tools are selected during the Xcode/Developer Tools installation.]) + AC_DEFINE(FREEBSD) + AC_DEFINE(HAVE_BSD_FLOCK) + AC_DEFINE(HAVE_SOCKLEN_T) ++ AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall" + MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` + if test "$MOZ_OBJFORMAT" = "elf"; then +@@ -2114,6 +2115,7 @@ tools are selected during the Xcode/Developer Tools installation.]) + AC_DEFINE(NETBSD) + AC_DEFINE(HAVE_BSD_FLOCK) + AC_DEFINE(HAVE_SOCKLEN_T) ++ AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + if test -z "$USE_NSPR_THREADS"; then + USE_PTHREADS=1 + fi +@@ -2162,6 +2164,7 @@ tools are selected during the Xcode/Developer Tools installation.]) + AC_DEFINE(OPENBSD) + AC_DEFINE(HAVE_BSD_FLOCK) + AC_DEFINE(HAVE_SOCKLEN_T) ++ AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + CFLAGS="$CFLAGS -ansi -Wall" + CXXFLAGS="$CXXFLAGS -ansi -Wall" + DLL_SUFFIX=so.1.0 diff --git a/devel/nspr/files/patch-bug1350966 b/devel/nspr/files/patch-bug1350966 new file mode 100644 index 000000000000..62748aba4468 --- /dev/null +++ b/devel/nspr/files/patch-bug1350966 @@ -0,0 +1,17 @@ +--- pr/src/pthreads/ptsynch.c~ ++++ pr/src/pthreads/ptsynch.c +@@ -55,12 +55,11 @@ void _PR_InitLocks(void) + rv = _PT_PTHREAD_MUTEXATTR_INIT(&_pt_mattr); + PR_ASSERT(0 == rv); + +-#ifdef LINUX +-#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) ++#if (defined(LINUX) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ ++ (defined(FREEBSD) && __FreeBSD_version > 700055) + rv = pthread_mutexattr_settype(&_pt_mattr, PTHREAD_MUTEX_ADAPTIVE_NP); + PR_ASSERT(0 == rv); + #endif +-#endif + + rv = _PT_PTHREAD_CONDATTR_INIT(&_pt_cvar_attr); + PR_ASSERT(0 == rv);