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";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "0.65.1";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
src = fetchCrate {
|
|
|
|
pname = "bindgen-cli";
|
|
|
|
inherit version;
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "9JJXQQSbCxTh3fIbVSrc6WAYGivwomkoB8ZIquUNr9o=";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
cargoSha256 = "Kz6Y+4F9Yu5oKYI9LgZKLh0AkQTwerPS4A758TZrkoc=";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
buildInputs = [ clang.cc.lib ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export LIBCLANG_PATH="${clang.cc.lib}/lib"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ clang ];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|