1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

Temporary workaround to fix bindgen on Darwin

https://github.com/NixOS/nixpkgs/pull/207352#issuecomment-1418363441
This commit is contained in:
Zhaofeng Li 2023-02-06 13:54:21 -07:00
parent 1ffa429a9b
commit 9869ab4a85
2 changed files with 14 additions and 2 deletions

View file

@ -8,6 +8,7 @@
{ stdenv
, lib
, craneLib
, llvmPackages
, rustPlatform
, runCommand
, writeReferencesToFile
@ -32,7 +33,6 @@ let
};
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
installShellFiles
];
@ -68,6 +68,12 @@ let
cargoExtraArgs = "-p attic-client -p attic-server";
# Temporary workaround for https://github.com/NixOS/nixpkgs/pull/207352#issuecomment-1418363441
preBuild = ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${llvmPackages.clang}/nix-support/cc-cflags) $(< ${llvmPackages.clang}/nix-support/libc-cflags) $(< ${llvmPackages.clang}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE"
'';
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
if [[ -f $out/bin/attic ]]; then
installShellCompletion --cmd attic \

View file

@ -7,6 +7,7 @@
{ lib, stdenv, rustPlatform
, pkg-config
, installShellFiles
, llvmPackages
, nix
, boost
, darwin
@ -31,7 +32,6 @@ in rustPlatform.buildRustPackage rec {
};
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
installShellFiles
];
@ -50,6 +50,12 @@ in rustPlatform.buildRustPackage rec {
ATTIC_DISTRIBUTOR = "attic";
# Temporary workaround for https://github.com/NixOS/nixpkgs/pull/207352#issuecomment-1418363441
preBuild = ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${llvmPackages.clang}/nix-support/cc-cflags) $(< ${llvmPackages.clang}/nix-support/libc-cflags) $(< ${llvmPackages.clang}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE"
'';
# Recursive Nix is not stable yet
doCheck = false;