v8: fix darwin build

This commit is contained in:
Stanisław Pitucha 2022-09-01 14:55:06 +10:00 committed by Stanisław Pitucha
parent cc9c837aa2
commit 099df1f9ac
3 changed files with 14 additions and 7 deletions

View file

@ -2,6 +2,8 @@
, gn, ninja, python3, glib, pkg-config, icu
, xcbuild, darwin
, fetchpatch
, llvmPackages
, symlinkJoin
}:
# Use update.sh to update all checksums.
@ -106,6 +108,8 @@ stdenv.mkDerivation rec {
touch build/config/gclient_args.gni
'';
llvmCcAndBintools = symlinkJoin { name = "llvmCcAndBintools"; paths = [ stdenv.cc llvmPackages.llvm ]; };
gnFlags = [
"use_custom_libcxx=false"
"is_clang=${lib.boolToString stdenv.cc.isClang}"
@ -123,7 +127,8 @@ stdenv.mkDerivation rec {
# ''custom_toolchain="//build/toolchain/linux/unbundle:default"''
''host_toolchain="//build/toolchain/linux/unbundle:default"''
''v8_snapshot_toolchain="//build/toolchain/linux/unbundle:default"''
] ++ lib.optional stdenv.cc.isClang ''clang_base_path="${stdenv.cc}"'';
] ++ lib.optional stdenv.cc.isClang ''clang_base_path="${llvmCcAndBintools}"''
++ lib.optional stdenv.isDarwin ''use_lld=false'';
NIX_CFLAGS_COMPILE = "-O2";
FORCE_MAC_SDK_MIN = stdenv.targetPlatform.sdkVer or "10.12";
@ -135,7 +140,7 @@ stdenv.mkDerivation rec {
python3
] ++ lib.optionals stdenv.isDarwin [
xcbuild
darwin.DarwinTools
llvmPackages.llvm
python3.pkgs.setuptools
];
buildInputs = [ glib icu ];
@ -166,7 +171,5 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ cstrahan proglodyte matthewbauer ];
platforms = platforms.unix;
license = licenses.bsd3;
# Fails to build on Darwin, see https://github.com/NixOS/nixpkgs/issues/158076
broken = stdenv.isDarwin;
};
}

View file

@ -361,6 +361,12 @@ in
buildInputs = [ which v8 python2 ];
buildFlags = [ "--with-system-v8=true" ];
dontBuild = false;
# The gem includes broken symlinks which are ignored during unpacking, but
# then fail during build. Since the content is missing anyway, touching the
# files is enough to unblock the build.
preBuild = ''
touch vendor/depot_tools/cbuildbot vendor/depot_tools/chrome_set_ver vendor/depot_tools/cros_sdk
'';
postPatch = ''
substituteInPlace ext/libv8/extconf.rb \
--replace "location = Libv8::Location::Vendor.new" \

View file

@ -15260,8 +15260,6 @@ with pkgs;
inherit (darwin) libobjc;
};
defaultGemConfig = callPackage ../development/ruby-modules/gem-config {
# recent v8 doesn't build on nixpkgs Darwin yet. https://github.com/NixOS/nixpkgs/issues/158076
v8 = if stdenv.isDarwin then v8_8_x else v8;
inherit (darwin) DarwinTools cctools;
inherit (darwin.apple_sdk.frameworks) CoreServices;
};
@ -21813,7 +21811,7 @@ with pkgs;
ucommon = callPackage ../development/libraries/ucommon { };
v8 = callPackage ../development/libraries/v8 { };
v8 = darwin.apple_sdk_11_0.callPackage ../development/libraries/v8 { };
v8_8_x = callPackage ../development/libraries/v8/8_x.nix { };