forked from servo/rust-mozjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen.py
35 lines (28 loc) · 1.2 KB
/
gen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse, subprocess;
bindgen = "bindgen";
jsapi = "../mozjs/js/src/jsapi.h"
includes = [
"-I", "../mozjs/js/src/dist/include",
]
sysincludes = [
"-isystem", "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/include",
"-isystem", "/usr/lib/gcc/x86_64-redhat-linux/4.7.0/include",
]
args = [
bindgen,
"-l", "mozjs",
"-o", "jsapi.rs",
"-match" ,"js",
jsapi]
args += includes + sysincludes
subprocess.call(args)
# To generate jsglue:
# DYLD_LIBRARY_PATH=~/versioned/rust-mozilla/build/llvm/x86_64-apple-darwin/Release+Asserts/lib/ ~/versioned/rust-bindgen/bindgen ./jsglue.c -I ../../build/src/mozjs/dist/include/ -match glue > glue.rs
# jdm used
# LD_LIBRARY_PATH=~/sdb/rust/build/llvm/x86_64-unknown-linux-gnu/Release+Asserts/lib/ ~/sdb/rust-bindgen/bindgen ./jsglue.c -I ../../build/src/mozjs/dist/include/ -isystem /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/ -match glue >glue.rs
# on Fedora 17
#
# and remember to mark all generated functions as #[rust_stack]