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
This commit is contained in:
parent
485070ffa9
commit
dbb00333b1
51 changed files with 571 additions and 104 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "nix-bindings-util-sys"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
license = "LGPL-2.1"
|
||||
|
|
@ -10,6 +10,8 @@ repository = "https://github.com/nixops4/nix-bindings-rust"
|
|||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.69"
|
||||
pkg-config = "0.3"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
# nix-bindings-util-sys
|
||||
|
||||
This crate contains generated bindings for the Nix C API.
|
||||
This crate contains generated bindings for the Nix C API (`nix-util-c`).
|
||||
**You should not have to use this crate directly,** and so you should probably not add it to your dependencies.
|
||||
Instead, use the `nix-bindings-util`, `nix-bindings-store` and `nix-bindings-expr` crates, which _should_ be sufficient.
|
||||
|
||||
## Design
|
||||
|
||||
Rust bindgen currently does not allow "layered" libraries to be split into separate crates.
|
||||
For example, the expr crate would have all-new types that are distinct and incompatible with the store crate.
|
||||
|
||||
Ideally bindgen will support reusing already generated modules, and we could move the code generation into the appropriate crates, so that the system dependencies of each crate become accurate.
|
||||
Instead, use the `nix-bindings-util` crate, which _should_ be sufficient.
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ impl bindgen::callbacks::ParseCallbacks for StripNixPrefix {
|
|||
|
||||
fn main() {
|
||||
// Tell cargo to invalidate the built crate whenever the wrapper changes
|
||||
println!("cargo:rerun-if-changed=include/nix-c-raw.h");
|
||||
println!("cargo:rustc-link-lib=nixflake");
|
||||
println!("cargo:rerun-if-changed=include/nix-c-util.h");
|
||||
println!("cargo:rustc-link-lib=nixutil");
|
||||
|
||||
// https://rust-lang.github.io/rust-bindgen/library-usage.html
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("include/nix-c-raw.h")
|
||||
.header("include/nix-c-util.h")
|
||||
// Find the includes
|
||||
.clang_args(c_headers())
|
||||
// Tell cargo to invalidate the built crate whenever any of the
|
||||
|
|
@ -38,15 +38,7 @@ fn main() {
|
|||
fn c_headers() -> Vec<String> {
|
||||
let mut args = Vec::new();
|
||||
// args.push("-isystem".to_string());
|
||||
for path in pkg_config::probe_library("nix-flake-c")
|
||||
.unwrap()
|
||||
.include_paths
|
||||
.iter()
|
||||
{
|
||||
args.push(format!("-I{}", path.to_str().unwrap()));
|
||||
}
|
||||
|
||||
for path in pkg_config::probe_library("bdw-gc")
|
||||
for path in pkg_config::probe_library("nix-util-c")
|
||||
.unwrap()
|
||||
.include_paths
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
#include <nix_api_util.h>
|
||||
#include <nix_api_store.h>
|
||||
#define GC_THREADS
|
||||
#include <gc/gc.h>
|
||||
#include <nix_api_expr.h>
|
||||
#include <nix_api_value.h>
|
||||
#include <nix_api_flake.h>
|
||||
1
nix-bindings-util-sys/include/nix-c-util.h
Normal file
1
nix-bindings-util-sys/include/nix-c-util.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include <nix_api_util.h>
|
||||
Loading…
Add table
Add a link
Reference in a new issue