SpiderMonkey 是 Mozilla 的 JavaScript 引擎,目前的版本是1.8.5,这里记录一下它在AIX上的编译过程。
下载地址:https://developer.mozilla.org/zh-CN/docs/SpiderMonkey
GCC等GNU软件的下载地址:http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html

1.修改configure和configure.in
参见:https://www.ibm.com/developerworks/aix/library/au-gnu.html

MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'

改为:

MOZ_FIX_LINK_PATHS=''

2.修改jsnativestack.cpp
参见:http://hg.mozilla.org/mozilla-central/rev/70d9c9f2c148

--- a/js/src/jsnativestack.cpp
+++ b/js/src/jsnativestack.cpp
@@ -155,40 +155,43 @@ JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTI
void *
GetNativeStackBaseImpl()
{
  stack_t st;
  stack_getbounds(&st);
  return static_cast<char*>(st.ss_sp) + st.ss_size;
}

+#elif defined(AIX)
+
+#include <ucontext.h>
+
+JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0);
+
+void *
+GetNativeStackBaseImpl()
+{
+    ucontext_t context;
+    getcontext(&context);
+    return static_cast<char*>(context.uc_stack.ss_sp) +
+        context.uc_stack.ss_size;
+}
+
#elif defined(XP_OS2)

void *
GetNativeStackBaseImpl()
{
  PTIB  ptib;
  PPIB  ppib;

  DosGetInfoBlocks(&ptib, &ppib);
  return ptib->tib_pstacklimit;
}

-#elif defined(SOLARIS)
-
-#include <ucontext.h>
-
-void *
-GetNativeStackBaseImpl()
-{
-    stack_t st;
-    stack_getbounds(&st);
-    return static_cast<char*>(st.ss_sp) + st.ss_size;
-}
-
#else /* XP_UNIX */

void *
GetNativeStackBaseImpl()
{
  pthread_t thread = pthread_self();
# if defined(XP_MACOSX) || defined(DARWIN)
  return pthread_get_stackaddr_np(thread);

3.编译安装

./configure --prefix=/home/usr1/SpiderMonkey-1.8.5 --with-pthreads --disable-shared-js
gmake
gmake install

4.测试

$ cd /home/usr1/SpiderMonkey-1.8.5/bin
$ ./js
js> var a = new Object;
js> a.s = "Test String!";
"Test String!"

 


本文链接地址: 在AIX上使用GCC编译SpiderMonkey-1.8.5
http://qingfengju.com/index.asp?id=369

分类:Linux 查看次数:4798 发布时间:2014-4-20 22:42:20