SpiderMonkey Build Documentation

  • Revision slug: SpiderMonkey/Build_Documentation
  • Revision title: SpiderMonkey Build Documentation
  • Revision id: 39174
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

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.o...s-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 Mercurial, as described below.

Getting the latest SpiderMonkey source code

The Mercurial repository at http://hg.mozilla.org/mozilla-central/ hosts the latest SpiderMonkey sources.

hg clone http://hg.mozilla.org/mozilla-central/
cd js/src

(This downloads the entire Mozilla repository, including the full change history and a lot of Gecko and Firefox source code that isn't part of SpiderMonkey. To avoid getting the full change history, click the zip or gz links at http://hg.mozilla.org/index.cgi/mozi...ntral/file/tip . This fetches a snapshot of the current Mozilla tree.)

Getting older SpiderMonkey sources from CVS

Note: You will need to explicitly fetch the JavaScript shell sources even if you currently build another Mozilla project, as there are files specific to the shell that are not normally found in a Mozilla source tree.

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.

If you also want the regression tests, add this command:

cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/js/tests

Getting older branch versions 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).

Using MacPorts

For MacOS, you can also use MacPorts to install SpiderMonkey. First install MacPorts, and then:

 sudo port install spidermonkey

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.

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.

{{ jsapi_todo("public-failures.txt should be documented here.") }}

Revision Source

<h2 name="Get_sources">Get sources</h2>
<p><a href="/en/SpiderMonkey" title="en/SpiderMonkey">SpiderMonkey</a> 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: <a href="/en/Linux_Build_Prerequisites" title="en/Linux_Build_Prerequisites">Linux</a>, <a href="/en/Windows_Build_Prerequisites" title="en/Windows_Build_Prerequisites">Windows</a>, <a href="/en/Mac_OS_X_Build_Prerequisites" title="en/Mac_OS_X_Build_Prerequisites">Mac</a>, <a href="/en/Build_Documentation" title="en/Build_Documentation">others</a>.</p>
<p>Then, download and unzip the SpiderMonkey 1.7 source code:</p>
<pre class="eval">mkdir mozilla
cd mozilla
wget <a class=" external" href="http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz" rel="freelink">http://ftp.mozilla.org/pub/mozilla.o...s-1.7.0.tar.gz</a>
tar xzf js-1.7.0.tar.gz
</pre>
<p>SpiderMonkey 1.7 is the most recent official SpiderMonkey release. Alternatively, you can get the latest SpiderMonkey source code from Mercurial, as described below.</p>
<h3 name="Getting_the_latest_SpiderMonkey_source_code">Getting the latest SpiderMonkey source code</h3>
<p>The <a href="/en/Mercurial" title="en/Mercurial">Mercurial</a> repository at <a class=" external" href="http://hg.mozilla.org/mozilla-central/" rel="freelink">http://hg.mozilla.org/mozilla-central/</a> hosts the latest SpiderMonkey sources.</p>
<pre class="eval">hg clone <span class="nowiki">http://hg.mozilla.org/mozilla-central/</span>
cd js/src
</pre>
<p>(This downloads the entire Mozilla repository, including the full change history and a lot of Gecko and Firefox source code that isn't part of SpiderMonkey. To avoid getting the full change history, click the zip or gz links at <a class=" external" href="http://hg.mozilla.org/index.cgi/mozilla-central/file/tip" rel="freelink">http://hg.mozilla.org/index.cgi/mozi...ntral/file/tip</a> . This fetches a snapshot of the current Mozilla tree.)</p>
<h3 name="Getting_older_SpiderMonkey_sources_from_CVS">Getting older SpiderMonkey sources from CVS</h3>
<div class="note"><strong>Note:</strong> You will need to explicitly fetch the JavaScript shell sources even if you currently build another Mozilla project, as there are files specific to the shell that are not normally found in a Mozilla source tree.</div>
<p>Just like when you're fetching any other Mozilla project from CVS, you need to log into the CVS server first. To do this, <code>cd</code> into the base directory you'd like to check out the code into, then enter the following command at your command line:</p>
<pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login
</pre>
<p>When prompted, enter the password, <code>anonymous</code>.</p>
<p>Once you've logged in, <code>cd</code> into the root of your CVS tree and enter the following command:</p>
<pre>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
</pre>
<p>This checks out all the files needed in order to build the JavaScript shell.</p>
<p>If you also want the regression tests, add this command:</p>
<pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/js/tests
</pre>
<h3 name="Getting_older_branch_versions_of_SpiderMonkey">Getting older branch versions of SpiderMonkey</h3>
<p>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 <code>editline</code> and <code>config</code> from trunk:</p>
<pre>cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -l -r <var>BRANCH_NAME</var> 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
</pre>
<p>Change <var>BRANCH_NAME</var> to the name of the branch you want to check out. You can use a JavaScript branch name (e.g. <code>JS_1_7_ALPHA_BRANCH</code>) or a Mozilla branch name (e.g. <code>MOZILLA_1_8_BRANCH</code>).</p>
<h3 name="Using_MacPorts">Using MacPorts</h3>
<p>For MacOS, you can also use MacPorts to install SpiderMonkey. First install <a class="external" href="http://www.macports.org">MacPorts,</a> and then:</p>
<pre class="eval"> sudo port install spidermonkey
</pre><h2 name="Build">Build</h2>
<p>Once you have the source code, you can build SpiderMonkey by running the following two commands:</p>
<pre class="eval">cd mozilla/js/src
make -f Makefile.ref
</pre>
<p>When compilation is complete, you should have an executable named <code>js</code> in a directory whose name depends on the system you're building on. For example, on Mac OS X, the executable is located at <code>Darwin_DBG.OBJ/js</code>.</p>
<p>At this point, you're ready to <a href="/en/Introduction_to_the_JavaScript_shell" title="en/Introduction_to_the_JavaScript_shell">run and try out the shell</a>.</p>
<p>By default, this makes a debug build. For an optimized build, add <code>BUILD_OPT=1</code> to the <code>make</code> command line.</p>
<h2 name="Test">Test</h2>
<ul> <li>Run <code>cd js/src; ./Linux_All_DBG.OBJ/js perfect.js</code> (or using a similar directory with your platform's name) and check if appropriate output is printed.</li> <li>Run the following command to start the test suite. <dl><dd> <blockquote> <pre>cd ../tests; perl jsDriver.pl -L slow-n.tests -L spidermonkey-n.tests -k -e smdebug</pre> </blockquote> </dd></dl> <ul> <li><em>Warning</em>: The test suite could run up to 30-40 minutes and eats up a lot of CPU cycles.</li> <li>If you compile SpiderMonkey with <code>BUILD_OPT=1</code>, you can use <code>-e smopt</code> instead of <code>-e smdebug</code>. The tests run noticeably faster that way.</li> </ul> </li> <li>If there are any failures, they will be recorded in a file, something like <code>results-2007-08-23-010815-smdebug-failures.txt</code>. Rename this file to <code>spidermonkey-known-failures-n.tests</code>. <ul> <li>As of 2007-08-23, there are around 175-200 failing tests.</li> </ul> </li> <li>In subsequent test runs, you can add the option <code>-L spidermonkey-known-failures-n.tests</code> 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.</li>
</ul>
<p>{{ jsapi_todo("public-failures.txt should be documented here.") }}</p>
Revert to this revision