2019-03-01 00:19:04 +00:00
|
|
|
{ stdenv, lib, fetchgit, fetchFromGitHub
|
|
|
|
, gn, ninja, python, glib, pkgconfig, icu
|
|
|
|
, xcbuild, darwin
|
|
|
|
, fetchpatch
|
2016-07-23 18:17:13 +01:00
|
|
|
}:
|
2012-01-18 20:32:23 +00:00
|
|
|
|
2016-07-23 18:17:13 +01:00
|
|
|
let
|
|
|
|
git_url = "https://chromium.googlesource.com";
|
|
|
|
|
2019-03-01 00:19:04 +00:00
|
|
|
# This data is from the DEPS file in the root of a V8 checkout
|
2016-07-23 18:17:13 +01:00
|
|
|
deps = {
|
2016-07-24 00:03:24 +01:00
|
|
|
"base/trace_event/common" = fetchgit {
|
2019-03-01 00:19:04 +00:00
|
|
|
url = "${git_url}/chromium/src/base/trace_event/common.git";
|
|
|
|
rev = "936ba8a963284a6b3737cf2f0474a7131073abee";
|
|
|
|
sha256 = "14nr22fqdpxma1kzjflj6a865vr3hfnnm2gs4vcixyq4kmfzfcy2";
|
2016-07-24 00:03:24 +01:00
|
|
|
};
|
2019-08-13 22:52:01 +01:00
|
|
|
build = fetchgit {
|
2019-03-01 00:19:04 +00:00
|
|
|
url = "${git_url}/chromium/src/build.git";
|
|
|
|
rev = "325e95d6dae64f35b160b3dc7d73218cee5ec079";
|
|
|
|
sha256 = "0dddyxa76p2xpjhmxif05v63i5ar6h5v684fdl667sg84f5bhhxf";
|
2016-07-24 00:03:24 +01:00
|
|
|
};
|
2019-03-01 00:19:04 +00:00
|
|
|
"third_party/googletest/src" = fetchgit {
|
|
|
|
url = "${git_url}/external/github.com/google/googletest.git";
|
|
|
|
rev = "5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081";
|
|
|
|
sha256 = "0gmr10042c0xybxnn6g7ndj1na1mmd3l9w7449qlcv4s8gmfs7k6";
|
2016-07-24 00:03:24 +01:00
|
|
|
};
|
2019-03-01 00:19:04 +00:00
|
|
|
"third_party/icu" = fetchgit {
|
|
|
|
url = "${git_url}/chromium/deps/icu.git";
|
|
|
|
rev = "960f195aa87acaec46e6104ec93a596da7ae0843";
|
|
|
|
sha256 = "073kh6gpcairgjxf3hlhpqljc13gwl2aj8fz91fv220xibwqs834";
|
2016-07-24 00:03:24 +01:00
|
|
|
};
|
2019-03-01 00:19:04 +00:00
|
|
|
"third_party/jinja2" = fetchgit {
|
|
|
|
url = "${git_url}/chromium/src/third_party/jinja2.git";
|
|
|
|
rev = "b41863e42637544c2941b574c7877d3e1f663e25";
|
|
|
|
sha256 = "1qgilclkav67m6cl2xq2kmzkswrkrb2axc2z8mw58fnch4j1jf1r";
|
2016-07-23 18:17:13 +01:00
|
|
|
};
|
2019-03-01 00:19:04 +00:00
|
|
|
"third_party/markupsafe" = fetchgit {
|
|
|
|
url = "${git_url}/chromium/src/third_party/markupsafe.git";
|
|
|
|
rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783";
|
|
|
|
sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz";
|
2016-07-23 18:17:13 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "v8";
|
2019-03-01 00:19:04 +00:00
|
|
|
version = "7.4.255";
|
2016-07-23 18:17:13 +01:00
|
|
|
|
2019-03-01 00:19:04 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/RPi-Distro/chromium-browser/master/debian/patches/revert-Xclang-instcombine-lower-dbg-declare.patch";
|
|
|
|
sha256 = "02hczcg43m36q8j1kv5j3hq9czj9niiil9w13w22vzv2f3c67dvn";
|
|
|
|
})
|
|
|
|
./darwin.patch
|
|
|
|
];
|
2016-07-23 18:17:13 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "v8";
|
|
|
|
repo = "v8";
|
|
|
|
rev = version;
|
2019-03-01 00:19:04 +00:00
|
|
|
sha256 = "14i0c71hmffzqnq9n73dh9dnabdxhbjhzkhqpk5yv9y90bwrzi2n";
|
2016-07-23 18:17:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
${lib.concatStringsSep "\n" (
|
|
|
|
lib.mapAttrsToList (n: v: ''
|
|
|
|
mkdir -p $sourceRoot/${n}
|
|
|
|
cp -r ${v}/* $sourceRoot/${n}
|
|
|
|
'') deps)}
|
2019-03-01 00:19:04 +00:00
|
|
|
chmod u+w -R .
|
2016-07-23 18:17:13 +01:00
|
|
|
'';
|
|
|
|
|
2019-09-12 13:13:26 +01:00
|
|
|
postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
|
|
|
|
substituteInPlace build/toolchain/linux/BUILD.gn \
|
|
|
|
--replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
|
|
|
|
'';
|
|
|
|
|
2019-03-01 00:19:04 +00:00
|
|
|
gnFlags = [
|
|
|
|
"use_custom_libcxx=false"
|
|
|
|
"is_clang=${if stdenv.cc.isClang then "true" else "false"}"
|
|
|
|
"use_sysroot=false"
|
|
|
|
# "use_system_icu=true"
|
|
|
|
"is_component_build=false"
|
|
|
|
"v8_use_external_startup_data=false"
|
|
|
|
"v8_monolithic=true"
|
|
|
|
"is_debug=true"
|
|
|
|
"is_official_build=false"
|
|
|
|
"treat_warnings_as_errors=false"
|
|
|
|
"v8_enable_i18n_support=true"
|
|
|
|
"use_gold=false"
|
|
|
|
"use_system_xcode=true"
|
|
|
|
# ''custom_toolchain="//build/toolchain/linux/unbundle:default"''
|
|
|
|
''host_toolchain="//build/toolchain/linux/unbundle:default"''
|
|
|
|
''v8_snapshot_toolchain="//build/toolchain/linux/unbundle:default"''
|
|
|
|
] ++ stdenv.lib.optional stdenv.cc.isClang ''clang_base_path="${stdenv.cc}"'';
|
|
|
|
|
2019-10-07 00:16:08 +01:00
|
|
|
# with gcc8, -Wclass-memaccess became part of -Wall and causes logging limit
|
|
|
|
# to be exceeded
|
|
|
|
NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.cc.isGNU "-Wno-class-memaccess";
|
|
|
|
|
2019-03-01 00:19:04 +00:00
|
|
|
nativeBuildInputs = [ gn ninja pkgconfig python ]
|
|
|
|
++ stdenv.lib.optionals stdenv.isDarwin [ xcbuild darwin.DarwinTools ];
|
|
|
|
buildInputs = [ glib icu ];
|
|
|
|
|
|
|
|
ninjaFlags = [ ":d8" "v8_monolith" ];
|
2016-07-23 18:17:13 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2019-03-01 00:19:04 +00:00
|
|
|
install -D d8 $out/bin/d8
|
|
|
|
install -D obj/libv8_monolith.a $out/lib/libv8.a
|
|
|
|
cp -r ../../include $out
|
2019-09-08 02:09:13 +01:00
|
|
|
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
cat > $out/lib/pkgconfig/v8.pc << EOF
|
|
|
|
Name: v8
|
|
|
|
Description: V8 JavaScript Engine
|
|
|
|
Version: ${version}
|
|
|
|
Libs: -L$out/lib -lv8 -pthread
|
|
|
|
Cflags: -I$out/include
|
|
|
|
Libs: -L$out/lib -lpulse
|
|
|
|
Cflags: -I$out/include
|
|
|
|
EOF
|
2016-07-23 18:17:13 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Google's open source JavaScript engine";
|
2019-03-01 00:19:04 +00:00
|
|
|
maintainers = with maintainers; [ cstrahan proglodyte matthewbauer ];
|
|
|
|
platforms = platforms.unix;
|
2016-07-23 18:17:13 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
|
|
|
}
|