2017-05-05 06:17:56 +01:00
|
|
|
{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, llvmPackages }:
|
2016-11-23 17:09:29 +00:00
|
|
|
|
|
|
|
# Future work: Automatically communicate NIX_CFLAGS_COMPILE to bindgen's tests and the bindgen executable itself.
|
|
|
|
|
2017-03-22 02:00:11 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2016-11-23 17:09:29 +00:00
|
|
|
name = "rust-bindgen-${version}";
|
2018-05-22 01:07:27 +01:00
|
|
|
version = "0.37.0";
|
2016-11-23 17:09:29 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2017-07-28 11:33:03 +01:00
|
|
|
owner = "rust-lang-nursery";
|
2016-11-23 17:09:29 +00:00
|
|
|
repo = "rust-bindgen";
|
2018-03-26 00:08:04 +01:00
|
|
|
rev = "v${version}";
|
2018-05-22 01:07:27 +01:00
|
|
|
sha256 = "0cqjr7qspjrfgqcp4nqxljmhhbqyijb2jpw3lajgjj48y6wrnw93";
|
2016-11-23 17:09:29 +00:00
|
|
|
};
|
|
|
|
|
2017-05-05 06:17:56 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2018-03-26 00:08:04 +01:00
|
|
|
buildInputs = [ llvmPackages.clang-unwrapped.lib ];
|
2016-11-23 17:09:29 +00:00
|
|
|
|
|
|
|
configurePhase = ''
|
2018-03-26 00:08:04 +01:00
|
|
|
export LIBCLANG_PATH="${llvmPackages.clang-unwrapped.lib}/lib"
|
2016-11-23 17:09:29 +00:00
|
|
|
'';
|
|
|
|
|
2017-05-05 06:17:56 +01:00
|
|
|
postInstall = ''
|
2018-03-26 00:08:04 +01:00
|
|
|
wrapProgram $out/bin/bindgen --set LIBCLANG_PATH "${llvmPackages.clang-unwrapped.lib}/lib"
|
2017-05-05 06:17:56 +01:00
|
|
|
'';
|
|
|
|
|
2018-04-12 21:01:03 +01:00
|
|
|
cargoSha256 = "0b8v6c7q1abibzygrigldpd31lyd5ngmj4vq5d7zni96m20mm85w";
|
2016-11-23 17:09:29 +00:00
|
|
|
|
|
|
|
doCheck = false; # A test fails because it can't find standard headers in NixOS
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2017-07-28 11:33:03 +01:00
|
|
|
description = "C and C++ binding generator";
|
|
|
|
homepage = https://github.com/rust-lang-nursery/rust-bindgen;
|
2016-11-23 17:09:29 +00:00
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = [ maintainers.ralith ];
|
|
|
|
};
|
|
|
|
}
|