Skip to content

Using Rust Spidermonkey Prototype

fzzzy edited this page Feb 21, 2012 · 1 revision

Servo will eventually be implemented in Rust. The initial plan is to reuse several existing parts of the Mozilla codebase by writing Rust bindings for them and incorporating them into the Rust Servo binary. The SpiderMonkey JavaScript engine and the Azure cross-platform drawing library are the first such targets.

There is an early Rust binding for the SpiderMonkey library (libmozjs) here:

https://github.com/fzzzy/rust-spidermonkey

Building rust-spidermonkey:

First, check out mozilla-central and build libmozjs by running 'autoconf2.13; ./configure; make; make install' in the lib/js directory. (Currently, this does not seem to properly install all the headers globally -- see below)

rust-spidermonkey has a Makefile which can build the shared library and a test binary. Run 'make test; ./test' to make sure everything is working.

Unfortunately, at the moment the jsapi headers are not properly installed for rust-spidermonkey to build against. My current strategy for building rust-spidermonkey is to edit the Makefile and modify the CXXFLAGS to add the path to the headers inside the build directory:

-I ../mozilla-central/js/src/build/dist/include

If anyone can shed light on why the headers installed in /usr/local/bin/include/js by make install are not enough for rust-spidermonkey to build successfully, please file a bug or just fix the header install process.