depot/third_party/nixpkgs/pkgs/development/tools/rust/bindgen/unwrapped.nix
Default email 4d5a95770c Project import generated by Copybara.
GitOrigin-RevId: 3c5319ad3aa51551182ac82ea17ab1c6b0f0df89
2023-03-04 15:14:45 +03:00

50 lines
1.3 KiB
Nix

{ lib, fetchCrate, rustPlatform, clang, rustfmt
, runtimeShell
, bash
}:
let
# bindgen hardcodes rustfmt outputs that use nightly features
rustfmt-nightly = rustfmt.override { asNightly = true; };
in rustPlatform.buildRustPackage rec {
pname = "rust-bindgen-unwrapped";
version = "0.64.0";
src = fetchCrate {
pname = "bindgen-cli";
inherit version;
sha256 = "JfR4NDrU86npU+zJ80YKhCn2+hNirzL+0mzLyDHJQjU=";
};
cargoSha256 = "e1Dqv3lA8WeVF/bxBedntk2nCWk9pUs6LkgP3svNI0w=";
buildInputs = [ clang.cc.lib ];
preConfigure = ''
export LIBCLANG_PATH="${clang.cc.lib}/lib"
'';
doCheck = true;
nativeCheckInputs = [ clang ];
RUSTFMT = "${rustfmt-nightly}/bin/rustfmt";
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 ];
mainProgram = "bindgen";
platforms = platforms.unix;
};
}