SpiderMonkey Build Documentation
From MDC
Contents |
[edit] Get sources
SpiderMonkey is easy to build from source if you have the usual Mozilla build prerequisites installed. Before you begin, make sure you have right build tools for your computer: Linux, Windows, Mac, others.
Then, download and unzip the SpiderMonkey 1.7 source code:
mkdir mozilla cd mozilla wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz tar xzf js-1.7.0.tar.gz
SpiderMonkey 1.7 is the most recent official SpiderMonkey release. Alternatively, you can get the latest SpiderMonkey source code from CVS, as described below.
[edit] Getting the CVS trunk version of SpiderMonkey
Just like when you're fetching any other Mozilla project from CVS, you need to log into the CVS server first. To do this, cd into the base directory you'd like to check out the code into, then enter the following command at your command line:
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login
When prompted, enter the password, anonymous.
Once you've logged in, cd into the root of your CVS tree and enter the following command:
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -l mozilla/js/src mozilla/js/src/config mozilla/js/src/editline mozilla/js/src/fdlibm
This checks out all the files needed in order to build the JavaScript shell.
[edit] Getting a branch version of SpiderMonkey
If you want to experiment with a specific branch's version of SpiderMonkey, you need to check out js/src from branch but check out editline and config from trunk:
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -l -r BRANCH_NAME mozilla/js/src mozilla/js/src/fdlibm cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -l mozilla/js/src/config mozilla/js/src/editline
Change BRANCH_NAME to the name of the branch you want to check out. You can use a JavaScript branch name (e.g. JS_1_7_ALPHA_BRANCH) or a Mozilla branch name (e.g. MOZILLA_1_8_BRANCH).
[edit] Build
Once you have the source code, you can build SpiderMonkey by running the following two commands:
cd mozilla/js/src make -f Makefile.ref
When compilation is complete, you should have an executable named js in a directory whose name depends on the system you're building on. For example, on Mac OS X, the executable is located at Darwin_DBG.OBJ/js.
At this point, you're ready to run and try out the shell.
By default, this makes a debug build. For an optimized build, add BUILD_OPT=1 to the make command line.
[edit] Test
- Run cd js/src; ./Linux_All_DBG.OBJ/js perfect.js (or using a similar directory with your platform's name) and check if appropriate output is printed.
- Run the following command to start the test suite.
-
cd ../tests; perl jsDriver.pl -L slow-n.tests -L spidermonkey-n.tests -k -e smdebug
- Warning: The test suite could run up to 30-40 minutes and eats up a lot of CPU cycles.
- If you compile SpiderMonkey with BUILD_OPT=1, you can use -e smopt instead of -e smdebug. The tests run noticeably faster that way.
-
- If there are any failures, they will be recorded in a file, something like results-2007-08-23-010815-smdebug-failures.txt. Rename this file to spidermonkey-known-failures-n.tests.
- As of 2007-08-23, there are around 175-200 failing tests.
- In subsequent test runs, you can add the option -L spidermonkey-known-failures-n.tests to the above test suite run command to ignore these failing tests. This way, you can make sure your code changes haven't broken anything which was previously working.