diff options
author | Guillaume Girol <symphorien+git@xlumurb.eu> | 2022-02-03 12:00:00 +0000 |
---|---|---|
committer | Guillaume Girol <symphorien+git@xlumurb.eu> | 2022-02-03 12:00:00 +0000 |
commit | 7283e2dd066ef6b330fde65476da192fa92e77e1 (patch) | |
tree | ca6f2bbc793c267df1a3f80d456247c9fef6ce20 /pkgs/development/tools/rust/bindgen/default.nix | |
parent | efeefb2af1469a5d1f0ae7ca8f0dfd9bb87d5cfb (diff) |
rust-bindgen: fix c++ includes
NIX_CXXSTDLIB_COMPILE has been removed in https://github.com/NixOS/nixpkgs/pull/85189 and https://github.com/NixOS/nixpkgs/pull/85189#commitcomment-40987154 remommends using the files in ${clang}/nix-support to find the correct flags to pass to libclang.
Diffstat (limited to 'pkgs/development/tools/rust/bindgen/default.nix')
-rw-r--r-- | pkgs/development/tools/rust/bindgen/default.nix | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pkgs/development/tools/rust/bindgen/default.nix b/pkgs/development/tools/rust/bindgen/default.nix index 2c69ad9876ecb..0da7303a36fbc 100644 --- a/pkgs/development/tools/rust/bindgen/default.nix +++ b/pkgs/development/tools/rust/bindgen/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, rustPlatform, clang, llvmPackages_latest, rustfmt, writeTextFile +{ lib, fetchFromGitHub, rustPlatform, clang, rustfmt, writeTextFile , runtimeShell , bash }: @@ -19,19 +19,19 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "sha256-zhENlrqj611RkKDvpDtDFWc58wfQVamkJnpe2nvRieE="; #for substituteAll - libclang = llvmPackages_latest.libclang.lib; + libclang = clang.cc.lib; # use the same version of clang for cxxincludes and libclang inherit bash; buildInputs = [ libclang ]; - propagatedBuildInputs = [ clang ]; # to populate NIX_CXXSTDLIB_COMPILE - - configurePhase = '' - export LIBCLANG_PATH="${libclang.lib}/lib" + preConfigure = '' + export LIBCLANG_PATH="${lib.getLib libclang}/lib" ''; postInstall = '' mv $out/bin/{bindgen,.bindgen-wrapped}; + export cincludes="$(< ${clang}/nix-support/cc-cflags) $(< ${clang}/nix-support/libc-cflags)" + export cxxincludes="$(< ${clang}/nix-support/libcxx-cxxflags)" substituteAll ${./wrapper.sh} $out/bin/bindgen chmod +x $out/bin/bindgen ''; @@ -66,6 +66,9 @@ rustPlatform.buildRustPackage rec { rust ffi declarations. As with most compiler related software, this will only work inside a nix-shell with the required libraries as buildInputs. + This version of bindgen is wrapped with the required compiler flags + required to find the c and c++ standard libary of the input clang + derivation. ''; homepage = "https://github.com/rust-lang/rust-bindgen"; license = with licenses; [ bsd3 ]; |