2022-11-21 17:40:18 +00:00
|
|
|
{ lib, fetchCrate, rustPlatform, clang, rustfmt
|
2022-02-10 20:34:41 +00:00
|
|
|
, runtimeShell
|
|
|
|
, bash
|
|
|
|
}:
|
2022-04-15 01:41:22 +00:00
|
|
|
let
|
|
|
|
# bindgen hardcodes rustfmt outputs that use nightly features
|
|
|
|
rustfmt-nightly = rustfmt.override { asNightly = true; };
|
|
|
|
in rustPlatform.buildRustPackage rec {
|
2022-02-10 20:34:41 +00:00
|
|
|
pname = "rust-bindgen-unwrapped";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "0.61.0";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
src = fetchCrate {
|
|
|
|
pname = "bindgen-cli";
|
|
|
|
inherit version;
|
|
|
|
sha256 = "sha256-sKcKIAkUC2GfAZ4tJBNweXhoFzqO95iCpHgekpOyHzc=";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cargoSha256 = "sha256-P246tw5Kznpxav0LashIkLlmQGVB+aKbFUQQdmcASPw=";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
buildInputs = [ clang.cc.lib ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export LIBCLANG_PATH="${clang.cc.lib}/lib"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
2022-04-15 01:41:22 +00:00
|
|
|
checkInputs = [ clang ];
|
|
|
|
|
|
|
|
RUSTFMT = "${rustfmt-nightly}/bin/rustfmt";
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
preCheck = ''
|
|
|
|
# for the ci folder, notably
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = { inherit clang; };
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Automatically generates Rust FFI bindings to C (and some C++) libraries";
|
|
|
|
longDescription = ''
|
|
|
|
Bindgen takes a c or c++ header file and turns them into
|
|
|
|
rust ffi declarations.
|
|
|
|
'';
|
|
|
|
homepage = "https://github.com/rust-lang/rust-bindgen";
|
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ johntitor ralith ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "bindgen";
|
|
|
|
platforms = platforms.unix;
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
}
|