From 6810ba3a550c5559ccbdbdda846ea7cbfa04bcca Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 6 Jun 2014 08:40:44 +0000
Subject: Haiku patch


diff --git a/js/src/Makefile.in b/js/src/Makefile.in
index a85e055..a994d00 100644
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -659,7 +659,7 @@ LIBS +=  C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
 endif
 
 # BeOS and HP-UX do not require the extra linking of "-lm"
-ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS OS2,$(OS_ARCH)))
+ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS OS2 Haiku,$(OS_ARCH)))
 EXTRA_LIBS	+= -lm
 endif
 
diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp
index 0366d25..590e5d0 100644
--- a/js/src/jsnativestack.cpp
+++ b/js/src/jsnativestack.cpp
@@ -184,6 +184,18 @@ GetNativeStackBaseImpl()
     return static_cast<char*>(st.ss_sp) + st.ss_size;
 }
 
+#elif defined(__HAIKU__)
+
+#include <OS.h>
+
+void *
+GetNativeStackBaseImpl()
+{
+	thread_info info;
+	get_thread_info(find_thread(NULL), &info);
+    return info.stack_base;
+}
+
 #else /* XP_UNIX */
 
 void *
-- 
1.8.3.4


From 97379beb600f8eca868e0c9e605085e1264097a2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 6 Jun 2014 11:48:10 +0000
Subject: nsinstall patch


diff --git a/js/src/config/nsinstall.c b/js/src/config/nsinstall.c
index 355a092..008b0f1 100644
--- a/js/src/config/nsinstall.c
+++ b/js/src/config/nsinstall.c
@@ -114,7 +114,7 @@ mkdirs(char *path, mode_t mode)
     for (cp = strrchr(path, '/'); cp && cp != path && *(cp - 1) == '/'; cp--);
     if (cp && cp != path) {
 	*cp = '\0';
-	if ((lstat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
+	if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
 	    mkdirs(path, mode) < 0) {
 	    return -1;
 	}
-- 
1.8.3.4

