Skip to content

Commit

Permalink
Update bindgen to 0.71
Browse files Browse the repository at this point in the history
This commit updates bindgen to 0.71. It also adds a test that verifies that the bundled bindings match the generated ones. Additionally it cleans up the generated bindings to only include items that are relevant for libpq
  • Loading branch information
weiznich committed Jan 8, 2025
1 parent 2f5bfc3 commit 5b7911e
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 5,693 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ jobs:
- name: Tests
shell: bash
run: |
ls /home/runner/work/pq-sys/pq-sys/
ls /home/runner/work/pq-sys/pq-sys/pq-src/
ls /home/runner/work/pq-sys/pq-sys/pq-src/source/
ls /home/runner/work/pq-sys/pq-sys/pq-src/source/src/
ls /home/runner/work/pq-sys/pq-sys/pq-src/source/src/interfaces/
ls /home/runner/work/pq-sys/pq-sys/pq-src/source/src/interfaces/libpq
cargo test --no-default-features --features "${{ matrix.features }}"
- name: Test compile diesel
Expand Down
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/sgrif/pq-sys"
links = "pq"
build = "build.rs"
edition = "2021"

[workspace]
members = ["pq-src"]
Expand All @@ -15,14 +16,19 @@ name = "pq_sys"

[dependencies]
pq-src = { path = "pq-src", version = ">=0.2, <0.4", optional = true , default-features = false }
libc = "0.2.100"

[build-dependencies]
pkg-config = { version = "0.3.0", optional = true }
bindgen = { version = "0.69.1", optional = true }
bindgen = { version = "0.71.0", optional = true }

[target.'cfg(target_env = "msvc")'.build-dependencies]
vcpkg = "0.2.6"

[dev-dependencies]
similar-asserts = "1.6.0"
bindgen = "0.71.0"

[features]
default = []
bundled = ["bundled_without_openssl", "pq-src/with-openssl"]
Expand Down
27 changes: 27 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# DEVELOPMENT NOTES

Use the following command to generate a new bindings file:
```sh
# keep the command in sync with the command in `src/make_bindings.rs"
bindgen wrapper.h \
--rustified-enum ".*"
--no-derive-default \
--generate "functions,types,vars,methods,constructors,destructors" \
--allowlist-var "PG_.*" \
--allowlist-var "LIBPQ_.*" \
--allowlist-var "PQ.*" \
--allowlist-type "Oid" \
--allowlist-type "ConnStatusType" \
--allowlist-type "Postgres.*" \
--allowlist-type "pg.*" \
--allowlist-type "PG.*" \
--allowlist-type "PQ.*" \
--allowlist-type "pq.*" \
--allowlist-function "PQ.*" \
--allowlist-function "lo_.*" \
--allowlist-function "pg_.*" \
--opaque-type "FILE" \
--blocklist-type "FILE" \
--raw-line "use libc::FILE;" \
-- -I pq-src/source/src/interfaces/libpq/
```
4 changes: 1 addition & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ fn main() {
}
#[cfg(feature = "buildtime_bindgen")]
{
let bindings = bindgen::Builder::default()
.rustified_enum(".*")
.header("wrapper.h")
let bindings = include!("src/make_bindings.rs")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
Expand Down
Loading

0 comments on commit 5b7911e

Please sign in to comment.