@@ -10,43 +10,42 @@ 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 disabled .
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
35
+ #### Debian-based Linuxes
37
36
38
- #### From a package manager
37
+ ```
38
+ # apt-get install llvm-3.9-dev libclang-3.9-dev
39
+ ```
39
40
40
- Clang 3.9 has ben released about a month ago, and some package managers already
41
- provide it.
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/ .
42
44
43
- For example, for MacPorts:
45
+ #### Arch
44
46
45
47
```
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
48
+ # pacman -S clang
50
49
```
51
50
52
51
#### From source
@@ -65,29 +64,40 @@ Those instructions list optional steps. For bindgen:
65
64
## Building
66
65
67
66
```
68
- $ cargo build --features llvm_stable
67
+ $ cd bindgen
68
+ $ cargo build
69
69
```
70
70
71
- If you want a build with extra features (llvm 3.9) then you can use:
71
+ If you installed multiple versions of llvm, it may not be able to locate the
72
+ latest version of libclang. In that case, you may want to either uninstall
73
+ other versions of llvm, or specify the path of the desired libclang explicitly:
74
+ ```
75
+ $ export LIBCLANG_PATH=path/to/clang-3.9/lib
76
+ ```
72
77
78
+ On Linux and macOS, you may also need to add a path to ` libclang.so ` (usually
79
+ the same path as above) to library search path. This can be done as below:
73
80
```
74
- $ LIBCLANG_PATH=path/to/clang-3.9/build/lib \
75
- LD_LIBRARY_PATH=path/to/clang-3.9/build/lib \
76
- cargo build
81
+ $ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux
82
+ $ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS
77
83
```
78
84
79
85
# Library usage with ` build.rs `
80
86
87
+ See [ the Stylo build script] [ stylo-script ] to see how it is used inside the
88
+ Servo organisation.
89
+
90
+ [ stylo-script ] : https://github.com/servo/servo/blob/master/components/style/build_gecko.rs
91
+
81
92
In ` Cargo.toml ` :
82
93
83
94
``` toml
84
95
[package ]
85
96
# ...
86
97
build = " build.rs"
87
98
88
- [build-dependencies .libbindgen ]
89
- git = " https://github.com/servo/rust-bindgen"
90
- features = [" llvm_stable" ]
99
+ [build-dependencies ]
100
+ libbindgen = " 0.1"
91
101
```
92
102
93
103
In ` build.rs ` :
@@ -117,11 +127,10 @@ include!(concat!(env!("OUT_DIR"), "/example.rs"));
117
127
# Command Line Usage
118
128
119
129
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.
130
+ options might exist (see [ the SpiderMonkey script] [ sm-script ] to see how it
131
+ is used inside the Servo organisation.
122
132
123
133
[ 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
134
126
135
## C++ Usage
127
136
0 commit comments