summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md73
-rw-r--r--bindgen/src/main.rs2
-rw-r--r--libbindgen/src/codegen/mod.rs2
-rw-r--r--libbindgen/src/ir/context.rs2
-rw-r--r--libbindgen/src/ir/ty.rs4
-rw-r--r--libbindgen/src/regex_set.rs2
6 files changed, 47 insertions, 38 deletions
diff --git a/README.md b/README.md
index f25b815b..3b3f56e6 100644
--- a/README.md
+++ b/README.md
@@ -10,43 +10,42 @@ the [Stylo](https://public.etherpad-mozilla.org/p/stylo) project.
## Requirements
-The current generator runs on with clang 3.8, but can also run with clang 3.9
-with more features (such as detection of inlined functions).
+It is recommended to use clang 3.9 with the current generator. It can run with
+clang 3.8 with some features disabled.
-### Installing clang 3.8
+### Installing Clang 3.9
-#### OSX
+#### Windows
-```
-# brew install llvm38
-```
+Download and install the official pre-built binary from
+[LLVM download page](http://releases.llvm.org/download.html).
-#### On Debian-based Linuxes
+#### OSX
+If you use Homebrew:
```
-# apt-get install llvm-3.8-dev libclang-3.8-dev
+$ brew install llvm
```
-Adding the LLVM repos to get version 3.8 may be necessary, see http://apt.llvm.org/.
-#### Arch
+If you use MacPorts:
```
-# pacman -S clang clang-tools-extra
+$ port install clang-3.9
```
-### Getting clang 3.9
+#### Debian-based Linuxes
-#### From a package manager
+```
+# apt-get install llvm-3.9-dev libclang-3.9-dev
+```
-Clang 3.9 has ben released about a month ago, and some package managers already
-provide it.
+Ubuntu 16.10 provides the necessary packages directly. If you are using older
+version of Ubuntu or other Debian-based distros, you may need to add the LLVM
+repos to get version 3.9. See http://apt.llvm.org/.
-For example, for MacPorts:
+#### Arch
```
-$ port install clang-3.9
-$ LIBCLANG_PATH=/opt/local/libexec/llvm-3.9/lib \
- LD_LIBRARY_PATH=/opt/local/libexec/llvm-3.9/lib \
- cargo build
+# pacman -S clang
```
#### From source
@@ -65,19 +64,31 @@ Those instructions list optional steps. For bindgen:
## Building
```
-$ cargo build --features llvm_stable
+$ cd bindgen
+$ cargo build
```
-If you want a build with extra features (llvm 3.9) then you can use:
+If you installed multiple versions of llvm, it may not be able to locate the
+latest version of libclang. In that case, you may want to either uninstall
+other versions of llvm, or specify the path of the desired libclang explicitly:
+```
+$ export LIBCLANG_PATH=path/to/clang-3.9/lib
+```
+On Linux and macOS, you may also need to add a path to `libclang.so` (usually
+the same path as above) to library search path. This can be done as below:
```
-$ LIBCLANG_PATH=path/to/clang-3.9/build/lib \
- LD_LIBRARY_PATH=path/to/clang-3.9/build/lib \
- cargo build
+$ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux
+$ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS
```
# Library usage with `build.rs`
+See [the Stylo build script][stylo-script] to see how it is used inside the
+Servo organisation.
+
+[stylo-script]: https://github.com/servo/servo/blob/master/components/style/build_gecko.rs
+
In `Cargo.toml`:
```toml
@@ -85,9 +96,8 @@ In `Cargo.toml`:
# ...
build = "build.rs"
-[build-dependencies.libbindgen]
-git = "https://github.com/servo/rust-bindgen"
-features = ["llvm_stable"]
+[build-dependencies]
+libbindgen = "0.1"
```
In `build.rs`:
@@ -117,11 +127,10 @@ include!(concat!(env!("OUT_DIR"), "/example.rs"));
# Command Line Usage
There are a few options documented when running `./bindgen --help`. Other
-options might exist (see [the SpiderMonkey script][sm-script] and [the Stylo
-scripts][stylo-scripts] to see how is it used inside the Servo organisation.
+options might exist (see [the SpiderMonkey script][sm-script] to see how it
+is used inside the Servo organisation.
[sm-script]: https://github.com/servo/rust-mozjs/blob/master/etc/bindings.sh
-[stylo-scripts]: https://github.com/servo/servo/tree/master/components/style/binding_tools
## C++ Usage
diff --git a/bindgen/src/main.rs b/bindgen/src/main.rs
index b54d4af5..515d1d1a 100644
--- a/bindgen/src/main.rs
+++ b/bindgen/src/main.rs
@@ -35,7 +35,7 @@ pub fn main() {
match version.parsed {
None => warn!("Couldn't parse libclang version"),
Some(version) if version != expected_version => {
- error!("Using clang {:?}, expected {:?}",
+ warn!("Using clang {:?}, expected {:?}",
version,
expected_version);
}
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs
index b03c9f21..ae59bc52 100644
--- a/libbindgen/src/codegen/mod.rs
+++ b/libbindgen/src/codegen/mod.rs
@@ -528,7 +528,7 @@ impl CodeGenerator for Type {
if template_arg.is_named() {
let name = template_arg.name().unwrap();
if name.contains("typename ") {
- error!("Item contained `typename`'d template \
+ warn!("Item contained `typename`'d template \
parameter: {:?}", item);
return;
}
diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs
index 3ffe50c8..5a94dd40 100644
--- a/libbindgen/src/ir/context.rs
+++ b/libbindgen/src/ir/context.rs
@@ -226,7 +226,7 @@ impl<'ctx> BindgenContext<'ctx> {
} else if let Some(usr) = declaration.usr() {
TypeKey::USR(usr)
} else {
- error!("Valid declaration with no USR: {:?}, {:?}",
+ warn!("Valid declaration with no USR: {:?}, {:?}",
declaration,
location);
TypeKey::Declaration(declaration)
diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs
index 6859b753..d234caea 100644
--- a/libbindgen/src/ir/ty.rs
+++ b/libbindgen/src/ir/ty.rs
@@ -753,7 +753,7 @@ impl Type {
//
// https://github.com/jamesmunns/teensy3-rs/issues/9
if !ty.spelling().is_empty() {
- error!("invalid type {:?}", ty);
+ warn!("invalid type {:?}", ty);
} else {
warn!("invalid type {:?}", ty);
}
@@ -768,7 +768,7 @@ impl Type {
}
if !ty.spelling().is_empty() {
- error!("invalid type {:?}", ty);
+ warn!("invalid type {:?}", ty);
} else {
warn!("invalid type {:?}", ty);
}
diff --git a/libbindgen/src/regex_set.rs b/libbindgen/src/regex_set.rs
index 93130590..8747d285 100644
--- a/libbindgen/src/regex_set.rs
+++ b/libbindgen/src/regex_set.rs
@@ -37,7 +37,7 @@ impl RegexSet {
self.items.push(r);
}
Err(err) => {
- error!("Invalid pattern provided: {}, {:?}", s, err);
+ warn!("Invalid pattern provided: {}, {:?}", s, err);
}
}
}