Skip to content

Commit d49bae2

Browse files
author
bors-servo
authored
Auto merge of #366 - upsuper:update-readme, r=emilio
Update README.md to reflect the current situation There are several changes: * Announce that Clang 3.9 is the new default * Update the install steps for 3.9 * Add installing steps for Windows * Update stylo's usage of bindgen
2 parents ce5d5c8 + a65e825 commit d49bae2

File tree

1 file changed

+41
-32
lines changed

1 file changed

+41
-32
lines changed

README.md

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,42 @@ the [Stylo](https://public.etherpad-mozilla.org/p/stylo) project.
1010

1111
## Requirements
1212

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.
1515

16-
### Installing clang 3.8
16+
### Installing Clang 3.9
1717

18-
#### OSX
18+
#### Windows
1919

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).
2322

24-
#### On Debian-based Linuxes
23+
#### OSX
2524

25+
If you use Homebrew:
2626
```
27-
# apt-get install llvm-3.8-dev libclang-3.8-dev
27+
$ brew install llvm
2828
```
29-
Adding the LLVM repos to get version 3.8 may be necessary, see http://apt.llvm.org/.
30-
#### Arch
3129

30+
If you use MacPorts:
3231
```
33-
# pacman -S clang clang-tools-extra
32+
$ port install clang-3.9
3433
```
3534

36-
### Getting clang 3.9
35+
#### Debian-based Linuxes
3736

38-
#### From a package manager
37+
```
38+
# apt-get install llvm-3.9-dev libclang-3.9-dev
39+
```
3940

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/.
4244

43-
For example, for MacPorts:
45+
#### Arch
4446

4547
```
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
5049
```
5150

5251
#### From source
@@ -65,29 +64,40 @@ Those instructions list optional steps. For bindgen:
6564
## Building
6665

6766
```
68-
$ cargo build --features llvm_stable
67+
$ cd bindgen
68+
$ cargo build
6969
```
7070

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+
```
7277

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:
7380
```
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
7783
```
7884

7985
# Library usage with `build.rs`
8086

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+
8192
In `Cargo.toml`:
8293

8394
```toml
8495
[package]
8596
# ...
8697
build = "build.rs"
8798

88-
[build-dependencies.libbindgen]
89-
git = "https://github.com/servo/rust-bindgen"
90-
features = ["llvm_stable"]
99+
[build-dependencies]
100+
libbindgen = "0.1"
91101
```
92102

93103
In `build.rs`:
@@ -117,11 +127,10 @@ include!(concat!(env!("OUT_DIR"), "/example.rs"));
117127
# Command Line Usage
118128

119129
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.
122132

123133
[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
125134

126135
## C++ Usage
127136

0 commit comments

Comments
 (0)