From a5b85531e1552ac3d2c74ca940fa48cccb731f2f Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 1 Nov 2011 08:15:09 +0000
Subject: [PATCH] Add and apply patch to set visibility to default during
 inclusion of pthread headers.  Fixes problem linking JS on FreeBSD 9.0-RC1.

---
 3rdp/build/GNUmakefile             |  1 +
 3rdp/build/jsnativestack.cpp.patch | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 3rdp/build/jsnativestack.cpp.patch

diff --git a/3rdp/build/GNUmakefile b/3rdp/build/GNUmakefile
index 7bee4532f7..11d069e174 100644
--- a/3rdp/build/GNUmakefile
+++ b/3rdp/build/GNUmakefile
@@ -30,6 +30,7 @@ $(JSLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/libmozjs.tgz | $(JS_SRC) $(JS_IDIR)
 	@echo Creating $@ ...
 	$(QUIET)-rm -rf $(JS_SRC)/*
 	$(QUIET)tar -xzC $(JS_SRC) -f $(3RDPDISTDIR)$(DIRSEP)libmozjs.tgz
+	$(QUIET)patch -d $(JS_SRC) < jsnativestack.cpp.patch
 	-$(QUIET)cd $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src && autoconf-2.13
 	$(QUIET)cd $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src && ./configure $(JS_CONFIGURE_ARGS)
 	$(QUIET)$(MAKE) -C $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src
diff --git a/3rdp/build/jsnativestack.cpp.patch b/3rdp/build/jsnativestack.cpp.patch
new file mode 100644
index 0000000000..685b47a0f9
--- /dev/null
+++ b/3rdp/build/jsnativestack.cpp.patch
@@ -0,0 +1,16 @@
+--- js-1.8.5/js/src/jsnativestack.cpp.orig	2011-11-01 00:58:59.000000000 -0700
++++ js-1.8.5/js/src/jsnativestack.cpp	2011-11-01 01:02:48.000000000 -0700
+@@ -48,11 +48,13 @@
+ # include <os2.h>
+ 
+ #elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX)
++# pragma GCC visibility push(default)
+ # include <pthread.h>
+ 
+ # if defined(__FreeBSD__)
+ #  include <pthread_np.h>
+ # endif
++# pragma GCC visibility pop
+ 
+ #else
+ # error "Unsupported platform"
-- 
GitLab