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-07-15 17:15:38 +00:00
|
|
|
version = "0.66.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-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-xVTVC3dNGIJeFm/v3swekzuJ2RQOe+wSh05vuWYTDRs=";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
cargoHash = "sha256-eIvl0RSKErNPip0r6iz7JVHm5YvuY3ke/6aMgkryRcI=";
|
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
|
|
|
};
|
|
|
|
}
|