Skip to content

Commit 78235aa

Browse files
committed
Move the building instructions from README.md to CONTRIBUTING.md
1 parent 0409c2c commit 78235aa

File tree

2 files changed

+38
-29
lines changed

2 files changed

+38
-29
lines changed

CONTRIBUTING.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,37 @@ issue, provide us with:
4242

4343
## Building
4444

45-
Build instructions are in the [README](./README.md).
45+
To build `libbindgen`:
4646

47-
Additionally, you may want to build and test with the `_docs` feature to ensure
47+
```
48+
$ cd bindgen/libbindgen
49+
$ cargo build
50+
```
51+
52+
To build the `bindgen` executable:
53+
54+
```
55+
$ cd bindgen/bindgen
56+
$ cargo build
57+
```
58+
59+
If you installed multiple versions of llvm, it may not be able to locate the
60+
latest version of libclang. In that case, you may want to either uninstall other
61+
versions of llvm, or specify the path of the desired libclang explicitly:
62+
63+
```
64+
$ export LIBCLANG_PATH=path/to/clang-3.9/lib
65+
```
66+
67+
On Linux and macOS, you may also need to add a path to `libclang.so` (usually
68+
the same path as above) to library search path. This can be done as below:
69+
70+
```
71+
$ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux
72+
$ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS
73+
```
74+
75+
Additionally, you may want to build and test with the `docs_` feature to ensure
4876
that you aren't forgetting to document types and functions. CI will catch it if
4977
you forget, but the turn around will be a lot slower ;)
5078

@@ -59,10 +87,11 @@ The following sections assume you are working in that subdirectory.
5987

6088
### Overview
6189

62-
Input C/C++ test headers reside in the `tests/headers` directory. Expected
63-
output Rust bindings live in `tests/expectations/tests`. For example,
64-
`tests/headers/my_header.h`'s expected generated Rust bindings would be
65-
`tests/expectations/tests/my_header.rs`.
90+
Input C/C++ test headers reside in the `libbindgen/tests/headers`
91+
directory. Expected output Rust bindings live in
92+
`libbindgen/tests/expectations/tests`. For example,
93+
`libbindgen/tests/headers/my_header.h`'s expected generated Rust bindings would
94+
be `libbindgen/tests/expectations/tests/my_header.rs`.
6695

6796
Run `cargo test` to compare generated Rust bindings to the expectations.
6897

@@ -115,7 +144,7 @@ And ensure `~/.cargo/bin` is on your path.
115144
## Debug Logging
116145

117146
To help debug what `bindgen` is doing, you can define the environment variable
118-
`RUST_LOG=bindgen` to get a bunch of debugging log spew.
147+
`RUST_LOG=libbindgen` to get a bunch of debugging log spew.
119148

120149
```
121150
$ 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
124153
This logging can also be used when debugging failing tests:
125154

126155
```
127-
$ RUST_LOG=libbindgen cd libbindgen && cargo test
156+
$ cd libbindgen
157+
$ RUST_LOG=libbindgen cargo test
128158
```
129159

130160
## Using `creduce` to Minimize Test Cases

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,3 @@ the ones that would be generated for `nsTArray_Simple`.
212212
213213
The `nocopy` annotation is used to prevent bindgen to autoderive the `Copy`
214214
and `Clone` traits for a type.
215-
216-
## Building From Source
217-
218-
```
219-
$ cd bindgen
220-
$ cargo build
221-
```
222-
223-
If you installed multiple versions of llvm, it may not be able to locate the
224-
latest version of libclang. In that case, you may want to either uninstall
225-
other versions of llvm, or specify the path of the desired libclang explicitly:
226-
```
227-
$ export LIBCLANG_PATH=path/to/clang-3.9/lib
228-
```
229-
230-
On Linux and macOS, you may also need to add a path to `libclang.so` (usually
231-
the same path as above) to library search path. This can be done as below:
232-
```
233-
$ export LD_LIBRARY_PATH=path/to/clang-3.9/lib # for Linux
234-
$ export DYLD_LIBRARY_PATH=path/to/clang-3.9/lib # for macOS
235-
```

0 commit comments

Comments
 (0)