Skip to content

Commit 5574096

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! The file blocklist is a lost less unmaintainable then the more fine-grained one we had before. Fix #9
1 parent 351a206 commit 5574096

File tree

54 files changed

+537
-144
lines changed

Some content is hidden

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

54 files changed

+537
-144
lines changed

Cargo.lock

Lines changed: 63 additions & 9 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+
"nix-bindings-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",

nix-bindings-bdwgc-sys/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "nix-bindings-bdwgc-sys"
3+
version = "0.1.0"
4+
edition = "2021"
5+
build = "build.rs"
6+
license = "LGPL-2.1"
7+
8+
[lib]
9+
path = "src/lib.rs"
10+
11+
[dependencies]
12+
13+
[build-dependencies]
14+
bindgen = "0.69"
15+
pkg-config = "0.3"

nix-bindings-bdwgc-sys/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# nix-bindings-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.

nix-bindings-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+
}
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>

nix-bindings-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/include/nix-c-raw.h

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

0 commit comments

Comments
 (0)