Unverified Commit a9ee50d9 authored by Olivér Falvai's avatar Olivér Falvai
Browse files

deno: fix clang build failure

parent 69186691
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
  librusty_v8 ? callPackage ./librusty_v8.nix {
    inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8;
  },
  libffi,
}:

let
@@ -33,7 +34,10 @@ rustPlatform.buildRustPackage rec {
  postPatch = ''
    # upstream uses lld on aarch64-darwin for faster builds
    # within nix lld looks for CoreFoundation rather than CoreFoundation.tbd and fails
    substituteInPlace .cargo/config.toml --replace "-fuse-ld=lld " ""
    substituteInPlace .cargo/config.toml --replace-fail "-fuse-ld=lld " ""

    # Use patched nixpkgs libffi in order to fix https://github.com/libffi/libffi/pull/857
    substituteInPlace ext/ffi/Cargo.toml --replace-fail "libffi = \"=3.2.0\"" "libffi = { version = \"3.2.0\", features = [\"system\"] }"
  '';

  # uses zlib-ng but can't dynamically link yet
@@ -46,7 +50,12 @@ rustPlatform.buildRustPackage rec {
    installShellFiles
  ];

  buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
  configureFlags = lib.optionals stdenv.cc.isClang [
    # This never worked with clang, but became a hard error recently: https://github.com/llvm/llvm-project/commit/3d5b610c864c8f5980eaa16c22b71ff1cf462fae
    "--disable-multi-os-directory"
  ];

  buildInputs = [ libffi ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
    apple-sdk_11
    # V8 supports 10.15+; binary references `aligned_alloc` directly
    (darwinMinVersionHook "10.15")