37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, llvmPackages }:
|
|
|
|
# Future work: Automatically communicate NIX_CFLAGS_COMPILE to bindgen's tests and the bindgen executable itself.
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
name = "rust-bindgen-${version}";
|
|
version = "0.31.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "rust-lang-nursery";
|
|
repo = "rust-bindgen";
|
|
rev = "v${version}";
|
|
sha256 = "0b0nr42vvxzrykzn11mwk1h9cqn87fh8423wwrs3h8vpk5jqg55i";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
buildInputs = [ llvmPackages.clang-unwrapped ];
|
|
|
|
configurePhase = ''
|
|
export LIBCLANG_PATH="${llvmPackages.clang-unwrapped}/lib"
|
|
'';
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/bindgen --set LIBCLANG_PATH "${llvmPackages.clang-unwrapped}/lib"
|
|
'';
|
|
|
|
cargoSha256 = "1pjyancb5w9rrxirwx8ghhjbnfcc2r0ha5bfnmlfamj8aaaqdc5w";
|
|
|
|
doCheck = false; # A test fails because it can't find standard headers in NixOS
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "C and C++ binding generator";
|
|
homepage = https://github.com/rust-lang-nursery/rust-bindgen;
|
|
license = with licenses; [ bsd3 ];
|
|
maintainers = [ maintainers.ralith ];
|
|
};
|
|
}
|