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.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
{
|
||||
lib,
|
||||
rust-bindgen-unwrapped,
|
||||
zlib,
|
||||
bash,
|
||||
@@ -14,7 +13,6 @@ let
|
||||
#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
|
||||
|
||||
@@ -21,12 +21,16 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
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 ];
|
||||
|
||||
|
||||
@@ -27,10 +27,8 @@ fi;
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user