25 releases

Uses old Rust 2015

0.67.1 Sep 24, 2019
0.61.13 May 4, 2019
0.61.12 Apr 25, 2019
0.61.8 Mar 25, 2019
0.1.0 Nov 30, 2015

#24 in #javascript-engine

Download history 23/week @ 2024-02-17 61/week @ 2024-02-24 16/week @ 2024-03-02 18/week @ 2024-03-09 9/week @ 2024-03-16 4/week @ 2024-03-23 66/week @ 2024-03-30 18/week @ 2024-04-06

100 downloads per month
Used in 4 crates (via mozjs)

MPL-2.0 license

74MB
1.5M SLoC

C++ 710K SLoC // 0.1% comments Python 494K SLoC // 0.3% comments C 178K SLoC // 0.2% comments JavaScript 29K SLoC // 0.2% comments GNU Style Assembly 14K SLoC // 0.2% comments M4 11K SLoC // 0.2% comments Shell 9K SLoC // 0.2% comments Rust 9K SLoC // 0.1% comments Visual Studio Project 7.5K SLoC // 0.0% comments Perl 2K SLoC // 0.2% comments Cython 1.5K SLoC // 0.1% comments Batch 1.5K SLoC // 0.0% comments INI 1K SLoC // 0.1% comments Forge Config 567 SLoC // 0.9% comments Visual Studio Solution 544 SLoC Korn shell 448 SLoC // 0.2% comments Automake 309 SLoC // 0.0% comments Emacs Lisp 258 SLoC // 0.1% comments Objective-C 242 SLoC // 0.3% comments Bitbake 112 SLoC // 0.2% comments Assembly 111 SLoC // 0.5% comments VBScript 84 SLoC // 0.2% comments Objective-C++ 73 SLoC // 0.1% comments ReScript 59 SLoC RPM Specfile 38 SLoC PowerShell 34 SLoC // 0.8% comments R 12 SLoC // 0.6% comments D 8 SLoC // 0.7% comments Swift 7 SLoC

Contains (Python package, 1.5MB) pip-9.0.3-py2.py3-none-any.whl, (autotools obfuscated code, 665KB) mozjs/js/src/ctypes/libffi/configure, (Python package, 570KB) setuptools-39.0.1-py2.py3-none-any.whl, (autotools obfuscated code, 270KB) mozjs/intl/icu/source/configure, (autotools obfuscated code, 275KB) mozjs/nsprpub/configure, (Python package, 485KB) setuptools-36.8.0-py2.py3-none-any.whl and 26 more.

This repository contains Rust bindings for SpiderMonkey for use with Servo.

The bindings are to the raw SpiderMonkey API, higher-level bindings are in the rust-mozjs repository.

Building

Under Linux:

Install Clang (at least version 3.9) and autoconf v 2.13, for example in a Debian-based Linux:

sudo apt-get install clang-6.0 autoconf2.13

If you have more than one version of Clang installed, you can set the LIBCLANG_PATH environment variable, for example:

export LIBCLANG_PATH=/usr/lib/clang/4.0/lib

Under Windows:

  1. Follow the directions at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites

  2. Open up a shell configured to use Visual Studio. This could be the one included with Visual Studio (e.g. Visual Studio 2017 / X64 Native Tools Command Prompt for VS 2017) or a shell in which you have run

"c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
  1. Set the MOZTOOLS_PATH environment variable to point to the tools from the Mozilla Build Package:
set MOZTOOLS_PATH=C:\mozilla-build\msys\bin;C:\mozilla-build\bin
  1. Download and install Clang for Windows (64 bit) from https://releases.llvm.org/download.html and set the LIBCLANG_PATH environment variable to its lib directory:
set LIBCLANG_PATH=C:\Program Files\LLVM\lib
  1. Set environment variables so the build script can find Python 2.7 and Autoconf 2.13:
set AUTOCONF=C:\mozilla-build\msys\local\bin\autoconf-2.13
set NATIVE_WIN32_PYTHON=C:\mozilla-build\python\python2.7.exe

You can now build and test the crate using cargo:

cargo build
cargo test
cargo build --features debugmozjs
cargo test --features debugmozjs

Upgrading

In order to upgrade to a new version of SpiderMonkey:

  1. Find the mozilla-release commit for the desired version of SpiderMonkey, at https://treeherder.mozilla.org/#/jobs?repo=mozilla-release&filter-searchStr=spidermonkey%20pkg. You are looking for an SM(pkg) tagged with FIREFOX_RELEASE. Take a note of the commit number to the left (a hex number such as ac4fbb7aaca0).

  2. Click on the SM(pkg) link, which will open a panel with details of the commit, including an artefact uploaded link, with a name of the form mozjs-version.tar.bz2. Download it and save it locally.

  3. Look at the patches in etc/patches/*.patch, and remove any that no longer apply (with a bit of luck this will be all of them).

  4. Run python3 ./etc/update.py path/to/tarball.

  5. Update etc/COMMIT with the commit number.

  6. Build and test the bindings as above, then submit a PR!

Dependencies

~4–6MB
~92K SLoC