diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-01-19 11:47:48 -0800 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-01-19 11:47:48 -0800 |
commit | 78235aa0e03774fd8a228ca1741b04241fe94387 (patch) | |
tree | cc78527501dfd75a9e2d959b5e8304cc3efb1ae0 | |
parent | 0409c2cb10f6827cc711704bc555522d34997d1e (diff) |
Move the building instructions from README.md to CONTRIBUTING.md
-rw-r--r-- | CONTRIBUTING.md | 46 | ||||
-rw-r--r-- | README.md | 21 |
2 files changed, 38 insertions, 29 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4515d7a..c1ec96d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,9 +42,37 @@ issue, provide us with: ## Building -Build instructions are in the [README](./README.md). +To build `libbindgen`: -Additionally, you may want to build and test with the `_docs` feature to ensure +``` +$ cd bindgen/libbindgen +$ cargo build +``` + +To build the `bindgen` executable: + +``` +$ cd bindgen/bindgen +$ cargo build +``` + +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: + +``` +$ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux +$ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS +``` + +Additionally, you may want to build and test with the `docs_` feature to ensure that you aren't forgetting to document types and functions. CI will catch it if you forget, but the turn around will be a lot slower ;) @@ -59,10 +87,11 @@ The following sections assume you are working in that subdirectory. ### Overview -Input C/C++ test headers reside in the `tests/headers` directory. Expected -output Rust bindings live in `tests/expectations/tests`. For example, -`tests/headers/my_header.h`'s expected generated Rust bindings would be -`tests/expectations/tests/my_header.rs`. +Input C/C++ test headers reside in the `libbindgen/tests/headers` +directory. Expected output Rust bindings live in +`libbindgen/tests/expectations/tests`. For example, +`libbindgen/tests/headers/my_header.h`'s expected generated Rust bindings would +be `libbindgen/tests/expectations/tests/my_header.rs`. Run `cargo test` to compare generated Rust bindings to the expectations. @@ -115,7 +144,7 @@ And ensure `~/.cargo/bin` is on your path. ## Debug Logging To help debug what `bindgen` is doing, you can define the environment variable -`RUST_LOG=bindgen` to get a bunch of debugging log spew. +`RUST_LOG=libbindgen` to get a bunch of debugging log spew. ``` $ RUST_LOG=libbindgen ./target/debug/bindgen [flags...] ~/path/to/some/header.h @@ -124,7 +153,8 @@ $ RUST_LOG=libbindgen ./target/debug/bindgen [flags...] ~/path/to/some/header.h This logging can also be used when debugging failing tests: ``` -$ RUST_LOG=libbindgen cd libbindgen && cargo test +$ cd libbindgen +$ RUST_LOG=libbindgen cargo test ``` ## Using `creduce` to Minimize Test Cases @@ -212,24 +212,3 @@ the ones that would be generated for `nsTArray_Simple`. The `nocopy` annotation is used to prevent bindgen to autoderive the `Copy` and `Clone` traits for a type. - -## Building From Source - -``` -$ cd bindgen -$ cargo build -``` - -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: -``` -$ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux -$ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS -``` |