treewide: use bindgenhook where possible

This commit is contained in:
Guillaume Girol 2022-11-29 12:00:00 +00:00
parent 93706c0f1a
commit df6a7e941a
11 changed files with 14 additions and 39 deletions

View File

@ -24,8 +24,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-p4t+G13XaCl7+IbX5YyBFF0PmARbw4XlRvnA0PRcjvQ=";
# needed for librocksdb-sys
nativeBuildInputs = [ llvmPackages.clang ];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
nativeBuildInputs = [ rustPlatform.bindgenHook ];
# link rocksdb dynamically
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";

View File

@ -34,14 +34,12 @@ rustPlatform.buildRustPackage rec {
buildFeatures = [ "modern" "gnosis" ];
nativeBuildInputs = [ clang cmake perl protobuf ];
nativeBuildInputs = [ rustPlatform.bindgenHook cmake perl protobuf ];
buildInputs = lib.optionals stdenv.isDarwin [
Security
];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
depositContractSpec = fetchurl {
url = "https://raw.githubusercontent.com/ethereum/eth2.0-specs/v${depositContractSpecVersion}/deposit_contract/contracts/validator_registration.json";
hash = "sha256-ZslAe1wkmkg8Tua/AmmEfBmjqMVcGIiYHwi+WssEwa8=";

View File

@ -42,14 +42,12 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
pkg-config
protobuf
rustPlatform.bindgenHook
];
# fat LTO requires ~3.4GB RAM
requiredSystemFeatures = [ "big-parallel" ];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion llvmPackages.clang}/include";
meta = with lib; {
description = "Reference client for NEAR Protocol";
homepage = "https://github.com/near/nearcore";

View File

@ -36,14 +36,13 @@ rustPlatform.buildRustPackage rec {
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
nativeBuildInputs = [ clang ];
nativeBuildInputs = [ rustPlatform.bindgenHook ];
preBuild = ''
export SUBSTRATE_CLI_GIT_COMMIT_HASH=$(cat .git_commit)
rm .git_commit
'';
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
PROTOC = "${protobuf}/bin/protoc";
# NOTE: We don't build the WASM runtimes since this would require a more

View File

@ -23,15 +23,13 @@ rustPlatform.buildRustPackage rec {
# buildAndTestSubdir = "cli";
nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config llvmPackages.clang ];
nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config rustPlatform.bindgenHook ];
# Needed to get openssl-sys to use pkg-config.
OPENSSL_NO_VENDOR = 1;
OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";
OPENSSL_DIR="${lib.getDev openssl}";
LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
# TODO check why rust compilation fails by including the rocksdb from nixpkgs
# Used by build.rs in the rocksdb-sys crate. If we don't set these, it would
# try to build RocksDB from source.

View File

@ -68,12 +68,9 @@ rustPlatform.buildRustPackage rec {
cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs;
# weird errors. see https://github.com/NixOS/nixpkgs/issues/52447#issuecomment-852079285
LIBCLANG_PATH = "${libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS =
"-isystem ${libclang.lib}/lib/clang/${lib.getVersion clang}/include";
LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config";
# LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config";
nativeBuildInputs = [ clang llvm pkg-config protobuf rustfmt perl ];
nativeBuildInputs = [ pkg-config protobuf rustfmt perl rustPlatform.bindgenHook ];
buildInputs =
[ openssl zlib libclang hidapi ] ++ (lib.optionals stdenv.isLinux [ udev ]);
strictDeps = true;

View File

@ -38,11 +38,8 @@ let
perl # used by openssl-sys to configure
protobuf
rustfmt
llvmPackages.clang
rustPlatform.bindgenHook
];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
in
{
teos = rustPlatform.buildRustPackage {
@ -50,7 +47,7 @@ in
cargoSha256 = "sha256-7VYYYSMJ2JP1KuA8sD0X3wInubH/jbA/sgzsTsomyEc=";
buildAndTestSubdir = "teos";
inherit version src cargoPatches buildInputs nativeBuildInputs LIBCLANG_PATH;
inherit version src cargoPatches buildInputs nativeBuildInputs;
meta = common.meta // {
description = "A Lightning watchtower compliant with BOLT13, written in Rust";
@ -66,7 +63,7 @@ in
cargoSha256 = "sha256-xL+DiEfgBYJQ1UJm7LAr1/f34pkU8FRl4Seic8MFAlM=";
buildAndTestSubdir = "watchtower-plugin";
inherit version src cargoPatches buildInputs nativeBuildInputs LIBCLANG_PATH;
inherit version src cargoPatches buildInputs nativeBuildInputs;
meta = common.meta // {
description = "A Lightning watchtower plugin for clightning";

View File

@ -43,13 +43,9 @@ let
pname = "tsc-dyn";
nativeBuildInputs = [ clang ];
nativeBuildInputs = [ rustPlatform.bindgenHook ];
sourceRoot = "source/core";
configurePhase = ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
'';
postInstall = ''
LIB=($out/lib/libtsc_dyn.*)
TSC_PATH=$out/share/emacs/site-lisp/elpa/tsc-${version}

View File

@ -42,7 +42,6 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
appstream-glib
clang
desktop-file-utils
meson
ninja
@ -52,6 +51,7 @@ stdenv.mkDerivation rec {
cargoSetupHook
rust.cargo
rust.rustc
bindgenHook
]);
buildInputs = [
@ -69,8 +69,6 @@ stdenv.mkDerivation rec {
zbar
];
LIBCLANG_PATH = "${lib.getLib libclang}/lib";
meta = {
description = "Two-factor authentication code generator for GNOME";
homepage = "https://gitlab.gnome.org/World/Authenticator";

View File

@ -14,8 +14,6 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "1n4il3l59m2a6ca54vfaivzg25abf8s4w5kpd5q51p13624iz0kb";
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
# needed for internal protobuf c wrapper library
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
@ -23,8 +21,7 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
pkg-config
clang
llvmPackages.libclang
rustPlatform.bindgenHook
rustfmt
protobuf

View File

@ -21,13 +21,11 @@ rustPlatform.buildRustPackage rec {
sha256 = "0f9915f083z5qqcxyavj0w6m973c8m1x7kfb89pah5agryy5mkaq";
};
nativeBuildInputs = [ installShellFiles pkg-config ];
nativeBuildInputs = [ installShellFiles pkg-config rustPlatform.bindgenHook ];
buildInputs = [ openssl ]
++ lib.optional stdenv.isDarwin Security;
checkInputs = [ gitMinimal util-linuxMinimal ];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
cargoSha256 = "1vnrc72g2271i2p847z30kplxmdpi60n3dzpw0s7dahg33g14ai6";
checkPhase = ''