depot/third_party/nixpkgs/pkgs/development/tools/rust/bindgen/unwrapped.nix
Default email 01ed8ef136 Project import generated by Copybara.
GitOrigin-RevId: 20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8
2022-11-21 19:40:18 +02: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.61.0";
src = fetchCrate {
pname = "bindgen-cli";
inherit version;
sha256 = "sha256-sKcKIAkUC2GfAZ4tJBNweXhoFzqO95iCpHgekpOyHzc=";
};
cargoSha256 = "sha256-P246tw5Kznpxav0LashIkLlmQGVB+aKbFUQQdmcASPw=";
buildInputs = [ clang.cc.lib ];
preConfigure = ''
export LIBCLANG_PATH="${clang.cc.lib}/lib"
'';
doCheck = true;
checkInputs = [ 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;
};
}