Skip to content

Commit bdb5c44

Browse files
committed
Split monolithic raw crates into sys crates
Creating a crate for bwd-gc highlights the fact that it would be nice to fix 2! Fix #9
1 parent 5055f17 commit bdb5c44

File tree

53 files changed

+735
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+735
-142
lines changed

Cargo.lock

Lines changed: 68 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[workspace]
22
members = [
3-
"nix-bindings-bindgen-raw",
3+
"bdwgc-sys",
4+
"nix-bindings-util-sys",
5+
"nix-bindings-store-sys",
6+
"nix-bindings-expr-sys",
7+
"nix-bindings-fetchers-sys",
8+
"nix-bindings-flake-sys",
49
"nix-bindings-expr",
510
"nix-bindings-fetchers",
611
"nix-bindings-flake",
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "nix-bindings-bindgen-raw"
2+
name = "bdwgc-sys"
33
version = "0.1.0"
44
edition = "2021"
55
build = "build.rs"
@@ -8,6 +8,8 @@ license = "LGPL-2.1"
88
[lib]
99
path = "src/lib.rs"
1010

11+
[dependencies]
12+
1113
[build-dependencies]
1214
bindgen = "0.69"
1315
pkg-config = "0.3"

bdwgc-sys/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# bdwgc-sys
2+
3+
This crate contains generated bindings for the Boehm-Demers-Weiser garbage collector (`bdw-gc`).
4+
**You should not have to use this crate directly,** and so you should probably not add it to your dependencies.

bdwgc-sys/build.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use std::env;
2+
use std::path::PathBuf;
3+
4+
fn main() {
5+
println!("cargo:rerun-if-changed=include/bdwgc.h");
6+
7+
let mut args = Vec::new();
8+
for path in pkg_config::probe_library("bdw-gc")
9+
.unwrap()
10+
.include_paths
11+
.iter()
12+
{
13+
args.push(format!("-I{}", path.to_str().unwrap()));
14+
}
15+
16+
let bindings = bindgen::Builder::default()
17+
.header("include/bdwgc.h")
18+
.clang_args(args)
19+
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
20+
.generate()
21+
.expect("Unable to generate bindings");
22+
23+
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
24+
bindings
25+
.write_to_file(out_path.join("bindings.rs"))
26+
.expect("Couldn't write bindings!");
27+
}

bdwgc-sys/include/bdwgc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define GC_THREADS
2+
#include <gc/gc.h>

bdwgc-sys/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![allow(non_upper_case_globals)]
2+
#![allow(non_camel_case_types)]
3+
#![allow(non_snake_case)]
4+
#![allow(dead_code)]
5+
#![allow(clippy::all)]
6+
7+
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

nix-bindings-bindgen-raw/README.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

nix-bindings-bindgen-raw/build.rs

Lines changed: 0 additions & 60 deletions
This file was deleted.

nix-bindings-bindgen-raw/src/lib.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)