#javascriptcore #version #bindings

sys rust_jsc_sys

Low-level bindings to JavaScriptCore

6 releases

0.1.6 May 19, 2024
0.1.5 May 17, 2024

#1627 in Rust patterns

Download history 554/week @ 2024-05-13 61/week @ 2024-05-20

615 downloads per month
Used in rust_jsc

MIT license

1MB
31K SLoC

rust-jsc-sys

This crate provides the raw bindings to the JavaScriptCore library. The bindings are generated using the bindgen crate. This crate for now only supports macOS and linux. and use a custom version of WebKit to generate the bindings.

Usage

Add the following to your Cargo.toml file:

[dependencies]
rust_jsc_sys = { features = ["patches"], version = "0.1.2" }

Custom static libs

For custom static libs, you can set the following environment variable:

export RUST_JSC_CUSTOM_BUILD_PATH=/Users/${user}/Documents/path/to/static/libs

or set the env variable in .cargo/config file.=

by default this library will try to donwload the static libraries from github mirror. If you want to build the static libraries yourself, you can build the docker image from the Dockerfile it will build the static libraries for you. and copy the static libraries to the provide path DOCKER_BUILDKIT=1 docker build -o ./.libs -t $(IMAGE_NAME) . this will only works on linux for macos you should build the Javascript Core static libraries running this command from the makefile make build-jsc or WebKit/Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF" then set the RUST_JSC_CUSTOM_BUILD_PATH to the path of the static libraries.

Make commands:

  • make build-docker-jsc - build the static libraries for linux
  • make build-jsc - build the static libraries for macos

Throuble shooting

if you encounter any problem, linking the static libs trying setting the following environment variables:

# for macOS
# Example path to the JavaScriptCore static libraries
DYLD_LIBRARY_PATH=/Users/${user}/Documents/Projects/WebKit/WebKitBuild/JSCOnly/Release/lib:$DYLD_LIBRARY_PATH
# for linux
# Example path to the JavaScriptCore static libraries
LD_LIBRARY_PATH=/Users/${user}/Documents/Projects/WebKit/WebKitBuild/JSCOnly/Release/lib:$LD_LIBRARY_PATH

No runtime deps