servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 122 forks source link

Add a script to regenerate the bindings. #215

Closed Ms2ger closed 4 years ago

Ms2ger commented 8 years ago

Right now, the necessary knowledge is hidden in the minds of @michaelwu and maybe @vvuk. This is not a sustainable situation. We should ensure anyone can update the bindings with minimal work ASAP.

Ms2ger commented 8 years ago

@michaelwu this is waiting for you.

Ms2ger commented 8 years ago

Apparently @tschneidereit is planning to do this.

tschneidereit commented 8 years ago

I want to have this happen automatically, including an upload to a public place, as happens for the jsshell packages.

Ms2ger commented 8 years ago

I'm all for it happening automatically, but unless that will happen soon, I'd like to at least be able to do a manual upgrade.

tschneidereit commented 8 years ago

Doing one more manual upgrade is all but required anyway. I'd like to do it in a slightly more useful way than just mergin in a new SM dump, though: by getting rid of the patches that're no longer required and upstreaming (clean versions of) those that are. We have buy-in for that from the SM team.

If you're blocked on this right now, I'm not opposed to a further "quick and dirty" update before that, though. Otherwise: first half of January.

Ms2ger commented 8 years ago
# Download and build mozjs
git clone git@github.com:servo/mozjs.git
cd mozjs
cargo build
cd ..

# Download and build clang
git clone https://github.com/llvm-mirror/llvm
cd llvm
git checkout release_37
cd tools
git clone https://github.com/llvm-mirror/clang
cd clang
git remote add mwu https://github.com/michaelwu/clang
git fetch mwu
git checkout release_37_smhacks
cd ../.. # llvm root dir
mkdir build
cd build
../configure --enable-optimized
make -sj8
cd ../..

# Download and build bindgen
git clone git@github.com:michaelwu/rust-bindgen.git
cd rust-bindgen
git checkout sm-hacks
# Fix to build with current master
LIBCLANG_PATH=../llvm/build/Release+Asserts/lib cargo build

# Generate bindings
LIBCLANG_PATH=../llvm/build/Release+Asserts/lib \
LD_LIBRARY_PATH=../llvm/build/Release+Asserts/lib \
cargo run \
../mozjs/mozjs/js/src/jsapi.hpp \
-allow-unknown-types \
-- \
-I ../mozjs/target/debug/build/mozjs_sys-*/out/dist/include/ \
-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8.4/include \
-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8.4/include-fixed/ \
-std=c++11 \
> jsapi.rs
Ms2ger commented 8 years ago

Fixes: https://github.com/michaelwu/rust-bindgen/compare/sm-hacks...servo:upp

nox commented 8 years ago

AFAICT, all the patches on release_37_smhacks are already in LLVM's master.

michaelwu commented 8 years ago

I upstreamed both of them. LLVM master isn't a release though, so that branch is still useful until a release is made with the patches. (if one hasn't been made yet)

jdm commented 4 years ago

Bindings are generated automatically.