22 January 2012

Spidermonkey 1.8.5 MinGW

After tried Webkit's JSCore previously which is quite working despite unstable webkitgtk, I decide to compare it with Mozilla's offering: spidermonkey. Sadly neither it was new? (1.8.5) nor they provide win32 binary? Did they?

Anyway there is a VS build here www.kahusecurity.com/2010/spidermonkey-1-8-5-for-windows/
So why not MinGW?

Binaries and devel files (Mingw32 dwarf2 exceptions not MinGW-w64):
The js.exe only depends on msvcrt.dll and libnspr4.dll, no WinSxS hell :-) Good, now I want to bind Gjs with python!

Build instructions:
Surprise, seems mozilla didn't care much about mingw (after seeking some pointers on their site)...
The source use autotooled configuration.. good :-) so does its dependencies: NSPR

1. To build it basically I just modify any line in configure that define CC/CXX as "cl" with gcc/g++ and remove all illegal options and flags such as -nologo and -mno-cygwin (GCC 4.6.2). Here is my configure for refenrence.

2. NSPR is easy to build: configure and make

3. For Spidermonkey be sure to define CC=gcc and CXX=g++ first, then I use: configure --with-nspr-prefix=[path to nspr] --with-windows-version=502 --disable-shared-js --enable-static

note:  --with-windows-version=502  needed to silence windres version error

4. Once completed, we will soon encounter infamous error WinMain thingy when compiling nsinstall, I already have this tool so I skip this and replace all $(INSTALL) occurrences with [path to nsinstall.exe]

5. Continuing, If we're unlucky there is an undeclared intptr_t in nanojit.h, just include wchar.h there

6. Build will resume smoothly, up to linking step where it complain invalid path (python not automatically turn "\" to "/"), So we have to edit libjs_static.a.fake file and replace all slashes

7. Continue make, and then make check which give me 2 errors: a math and a date test...

No comments:

Post a Comment