rust-bindgen: link directly with libclang

There's not really any reason for bindgen to dlopen libclang at all in
Nixpkgs. Moving this out of the wrapper means that it will still work
even when we don't want all the standard Nixpkgs cflags behavior, like
in the Linux kernel build.

Changed files
+6 -6
pkgs
development
tools
-2
pkgs/development/tools/rust/bindgen/default.nix
···
{
-
lib,
rust-bindgen-unwrapped,
zlib,
bash,
···
#for substituteAll
inherit bash;
unwrapped = rust-bindgen-unwrapped;
-
libclang = (lib.getLib clang.cc);
meta = rust-bindgen-unwrapped.meta // {
longDescription = rust-bindgen-unwrapped.meta.longDescription + ''
This version of bindgen is wrapped with the required compiler flags
+6 -2
pkgs/development/tools/rust/bindgen/unwrapped.nix
···
cargoHash = "sha256-K/iM79RfNU+3f2ae6wy/FMFAD68vfqzSUebqALPJpJY=";
-
buildInputs = [ (lib.getLib clang.cc) ];
-
preConfigure = ''
export LIBCLANG_PATH="${lib.getLib clang.cc}/lib"
'';
+
+
# Disable the "runtime" feature, so libclang is linked.
+
buildNoDefaultFeatures = true;
+
buildFeatures = [ "logging" ];
+
checkNoDefaultFeatures = buildNoDefaultFeatures;
+
checkFeatures = buildFeatures;
doCheck = true;
nativeCheckInputs = [ clang ];
-2
pkgs/development/tools/rust/bindgen/wrapper.sh
···
if [[ -n "$NIX_DEBUG" ]]; then
set -x;
fi;
-
export LIBCLANG_PATH="@libclang@/lib"
# shellcheck disable=SC2086
# cxxflags and NIX_CFLAGS_COMPILE should be word-split
exec -a "$0" @unwrapped@/bin/bindgen "$@" $sep $cxxflags @cincludes@ $NIX_CFLAGS_COMPILE
# note that we add the flags after $@ which is incorrect. This is only for the sake
# of simplicity.
-