@@ -10,84 +10,77 @@ the [Stylo](https://public.etherpad-mozilla.org/p/stylo) project.
10
10
11
11
## Requirements
12
12
13
- The current generator runs on with clang 3.8, but can also run with clang 3.9
14
- with more features (such as detection of inlined functions) .
13
+ It is recommended to use clang 3.9 with the current generator. It can run with
14
+ clang 3.8 with some features unavailable .
15
15
16
- ### Installing clang 3.8
16
+ ### Installing Clang 3.9
17
17
18
- #### OSX
18
+ #### Windows
19
19
20
- ```
21
- # brew install llvm38
22
- ```
20
+ Download and install the official pre-built binary from
21
+ [ LLVM download page] ( http://releases.llvm.org/download.html ) .
23
22
24
- #### On Debian-based Linuxes
23
+ #### OSX
25
24
25
+ If you use Homebrew:
26
26
```
27
- # apt-get install llvm-3.8-dev libclang-3.8-dev
27
+ $ brew install llvm
28
28
```
29
- Adding the LLVM repos to get version 3.8 may be necessary, see http://apt.llvm.org/ .
30
- #### Arch
31
29
30
+ If you use MacPorts:
32
31
```
33
- # pacman -S clang clang-tools-extra
32
+ $ port install clang-3.9
34
33
```
35
34
36
- ### Getting clang 3.9
37
-
38
- #### From a package manager
39
-
40
- Clang 3.9 has ben released about a month ago, and some package managers already
41
- provide it.
42
-
43
- For example, for MacPorts:
35
+ #### Debian-based Linuxes
44
36
45
37
```
46
- $ port install clang-3.9
47
- $ LIBCLANG_PATH=/opt/local/libexec/llvm-3.9/lib \
48
- LD_LIBRARY_PATH=/opt/local/libexec/llvm-3.9/lib \
49
- cargo build
38
+ # apt-get install llvm-3.9-dev libclang-3.9-dev
50
39
```
51
40
52
- #### From source
53
-
54
- If your package manager doesn't yet offer Clang 3.9, you'll need to build from
55
- source. For that, follow the instructions
56
- [ here] ( http://clang.llvm.org/get_started.html ) .
41
+ Ubuntu 16.10 provides the necessary packages directly. If you are using older
42
+ version of Ubuntu or other Debian-based distros, you may need to add the LLVM
43
+ repos to get version 3.9. See http://apt.llvm.org/ .
57
44
58
- Those instructions list optional steps. For bindgen:
45
+ #### Arch
59
46
60
- * Checkout and build clang
61
- * Checkout and build the extra-clang-tools
62
- * Checkout and build the compiler-rt
63
- * You do not need to checkout or build libcxx
47
+ ```
48
+ # pacman -S clang
49
+ ```
64
50
65
51
## Building
66
52
67
53
```
68
- $ cargo build --features llvm_stable
54
+ $ cd bindgen
55
+ $ cargo build
69
56
```
70
57
71
- If you want a build with extra features (llvm 3.9) then you can use:
72
-
58
+ If you installed multiple versions of llvm, it may not be able to locate the
59
+ latest version of libclang. In that case, you may want to either uninstall
60
+ other versions of llvm, or specify the path of the desired libclang explicitly:
73
61
```
74
- $ LIBCLANG_PATH=path/to/clang-3.9/build/lib \
75
- LD_LIBRARY_PATH=path/to/clang-3.9/build/lib \
76
- cargo build
62
+ $ export LIBCLANG_PATH=path/to/clang-3.9/lib
77
63
```
78
64
65
+ To build with Clang 3.8, you need to append ` --feature llvm_stable ` in addition
66
+ to ` cargo build ` above.
67
+
79
68
# Library usage with ` build.rs `
80
69
70
+ See [ the Stylo build script] [ stylo-script ] to see how is it used inside the
71
+ Servo organisation.
72
+
73
+ [ stylo-script ] : https://github.com/servo/servo/blob/master/components/style/build_gecko.rs
74
+
81
75
In ` Cargo.toml ` :
82
76
83
77
``` toml
84
78
[package ]
85
79
# ...
86
80
build = " build.rs"
87
81
88
- [build-dependencies .libbindgen ]
89
- git = " https://github.com/servo/rust-bindgen"
90
- features = [" llvm_stable" ]
82
+ [build-dependencies ]
83
+ libbindgen = " 0.1"
91
84
```
92
85
93
86
In ` build.rs ` :
@@ -117,11 +110,10 @@ include!(concat!(env!("OUT_DIR"), "/example.rs"));
117
110
# Command Line Usage
118
111
119
112
There are a few options documented when running ` ./bindgen --help ` . Other
120
- options might exist (see [ the SpiderMonkey script] [ sm-script ] and [ the Stylo
121
- scripts ] [ stylo-scripts ] to see how is it used inside the Servo organisation.
113
+ options might exist (see [ the SpiderMonkey script] [ sm-script ] to see how is
114
+ it used inside the Servo organisation.
122
115
123
116
[ sm-script ] : https://github.com/servo/rust-mozjs/blob/master/etc/bindings.sh
124
- [ stylo-scripts ] : https://github.com/servo/servo/tree/master/components/style/binding_tools
125
117
126
118
## C++ Usage
127
119
0 commit comments