nixpkgs/pkgs/development/libraries/v8/6_x.nix

194 lines
7.1 KiB
Nix
Raw Normal View History

2017-07-18 19:33:52 +01:00
{ stdenv, lib, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkgconfig
, doCheck ? false
, snapshot ? true
}:
let
arch = if stdenv.isAarch32
2017-07-18 19:33:52 +01:00
then if stdenv.is64bit
then"arm64"
else "arm"
else if stdenv.is64bit
then"x64"
else "ia32";
git_url = "https://chromium.googlesource.com";
2018-09-05 00:31:32 +01:00
# This data is from the DEPS file in the root of a V8 checkout
2017-07-18 19:33:52 +01:00
deps = {
"base/trace_event/common" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/src/base/trace_event/common.git";
rev = "211b3ed9d0481b4caddbee1322321b86a483ca1f";
sha256 = "080sya1dg32hi5gj7zr3r5l18r6w8g0imajyf3xfvnz67a2i8dd7";
2017-07-18 19:33:52 +01:00
};
"build" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/src/build.git";
rev = "7315579e388589b62236ad933f09afd1e838d234";
sha256 = "14gsigyjfm03kfzmz0v6429b6qnycvzx0yj3vwaks8may26aiv71";
2017-07-18 19:33:52 +01:00
};
"buildtools" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/buildtools.git";
rev = "0dd5c6f980d22be96b728155249df2da355989d9";
sha256 = "0m1fh0qjcx9c69khnqcsqvrnqs7ji6wfxns9vv9mknj20sph5ydr";
2017-07-18 19:33:52 +01:00
};
"test/benchmarks/data" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/v8/deps/third_party/benchmarks.git";
rev = "05d7188267b4560491ff9155c5ee13e207ecd65f";
2017-07-18 19:33:52 +01:00
sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl";
};
"test/mozilla/data" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/v8/deps/third_party/mozilla-tests.git";
rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be";
2017-07-18 19:33:52 +01:00
sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn";
};
"test/test262/data" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/external/github.com/tc39/test262.git";
rev = "a6c1d05ac4fed084fa047e4c52ab2a8c9c2a8aef";
sha256 = "1cy3val2ih6r4sbaxd1v9fir87mrlw1kr54s64g68gnch53ck9s3";
2017-07-18 19:33:52 +01:00
};
"test/test262/harness" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git";
rev = "0f2acdd882c84cff43b9d60df7574a1901e2cdcd";
2017-07-18 19:33:52 +01:00
sha256 = "00brj5avp43yamc92kinba2mg3a2x1rcd7wnm7z093l73idprvkp";
};
"test/wasm-js" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/external/github.com/WebAssembly/spec.git";
rev = "2113ea7e106f8a964e0445ba38f289d2aa845edd";
sha256 = "07aw7x2xzmzk905mqf8gbbb1bi1a5kv99g8iv6x2p07d3zns7xzx";
2017-07-18 19:33:52 +01:00
};
2018-09-05 00:31:32 +01:00
"third_party/depot_tools" = fetchgit {
url = "${git_url}/chromium/tools/depot_tools.git";
rev = "fb734036f4b5ae6d5afc63cbfc41d3a5d1c29a82";
sha256 = "1738y7xgfnn0hfdr8g5jw7555841ycxbn580mdffwv4jnbn7120s";
2017-07-18 19:33:52 +01:00
};
2018-09-05 00:31:32 +01:00
"third_party/googletest/src" = fetchgit {
url = "${git_url}/external/github.com/google/googletest.git";
rev = "ce468a17c434e4e79724396ee1b51d86bfc8a88b";
sha256 = "0nik8wb1b0zk2sslawgp5h211r5bc4x7m962dgnmbk11ccvsmr23";
2017-07-18 19:33:52 +01:00
};
"third_party/icu" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/deps/icu.git";
rev = "a9a2bd3ee4f1d313651c5272252aaf2a3e7ed529";
sha256 = "1bfyxakgv9z0rxbqsy5csi85kg8dqy7i6zybmng5wyzag9cns4f9";
2017-07-18 19:33:52 +01:00
};
"third_party/instrumented_libraries" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/src/third_party/instrumented_libraries.git";
rev = "323cf32193caecbf074d1a0cb5b02b905f163e0f";
sha256 = "0q3n3ivqva28qpn67ds635521pwzpc9apcyagz65i9j17bb1k231";
2017-07-18 19:33:52 +01:00
};
"third_party/jinja2" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/src/third_party/jinja2.git";
rev = "b41863e42637544c2941b574c7877d3e1f663e25";
sha256 = "1qgilclkav67m6cl2xq2kmzkswrkrb2axc2z8mw58fnch4j1jf1r";
2017-07-18 19:33:52 +01:00
};
"third_party/markupsafe" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/src/third_party/markupsafe.git";
rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783";
2017-07-18 19:33:52 +01:00
sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz";
};
2018-09-05 00:31:32 +01:00
"third_party/proguard" = fetchgit {
url = "${git_url}/chromium/src/third_party/proguard.git";
rev = "eba7a98d98735b2cc65c54d36baa5c9b46fe4f8e";
sha256 = "1yx86z2p243b0ykixgqz6nlqfp8swa6n0yl5fgb29fa4jvsjz3d1";
};
2017-07-18 19:33:52 +01:00
"tools/clang" = fetchgit {
2018-09-05 00:31:32 +01:00
url = "${git_url}/chromium/src/tools/clang.git";
rev = "c0b1d892b2bc1291eb287d716ca239c1b03fb215";
sha256 = "1mz1pqzr2b37mymbkqkmpmj48j7a8ig0ibaw3dfilbx5nbl4wd2z";
};
"tools/gyp" = fetchgit {
url = "${git_url}/external/gyp.git";
rev = "d61a9397e668fa9843c4aa7da9e79460fe590bfb";
sha256 = "1z081h72mjy285jb1kj5xd0pb4p12n9blvsimsavyn3ldmswv0r0";
};
"tools/luci-go" = fetchgit {
url = "${git_url}/chromium/src/tools/luci-go.git";
rev = "abcd908f74fdb155cc8870f5cae48dff1ece7c3c";
sha256 = "07c8vanc31wal6aw8v0s499l7ifrgvdvi2sx4ln3nyha5ngxinld";
};
"tools/swarming_client" = fetchgit {
url = "${git_url}/infra/luci/client-py.git";
rev = "9a518d097dca20b7b00ce3bdfc5d418ccc79893a";
sha256 = "1d8nly7rp24gx7q0m01jvsc15nw5fahayfczwd40gzzzkmvhjazi";
2017-07-18 19:33:52 +01:00
};
};
in
stdenv.mkDerivation rec {
name = "v8-${version}";
2018-09-05 00:31:32 +01:00
version = "6.9.427.14";
2017-07-18 19:33:52 +01:00
inherit doCheck;
src = fetchFromGitHub {
owner = "v8";
repo = "v8";
rev = version;
2018-09-05 00:31:32 +01:00
sha256 = "13d50iz87qh7v8l8kjky8wqs9rvz02pgw74q8crqi5ywnvvill1x";
2017-07-18 19:33:52 +01:00
};
postUnpack = ''
${lib.concatStringsSep "\n" (
lib.mapAttrsToList (n: v: ''
mkdir -p $sourceRoot/${n}
cp -r ${v}/* $sourceRoot/${n}
'') deps)}
'';
prePatch = ''
# use our gn, not the bundled one
sed -i -e 's#gn_path = .*#gn_path = "${gn}/bin/gn"#' tools/mb/mb.py
# disable tests
if [ "$doCheck" = "" ]; then sed -i -e '/"test:gn_all",/d' BUILD.gn; fi
# disable sysroot usage
2017-07-18 19:33:52 +01:00
chmod u+w build/config build/config/sysroot.gni
sed -i build/config/sysroot.gni \
-e '/use_sysroot =/ { s#\(use_sysroot =\).*#\1 false#; :a n; /current_cpu/ { s/^/#/; ba }; }'
# patch shebangs (/usr/bin/env)
patchShebangs tools/dev/v8gen.py
2017-07-18 19:33:52 +01:00
'';
configurePhase = ''
tools/dev/v8gen.py -vv ${arch}.release -- \
2018-09-05 00:31:32 +01:00
is_component_build=true \
${if snapshot then "v8_use_external_startup_data=false" else "v8_use_snapshot=false"} \
is_clang=false \
linux_use_bundled_binutils=false \
treat_warnings_as_errors=false \
use_custom_libcxx=false \
use_custom_libcxx_for_host=false
2017-07-18 19:33:52 +01:00
'';
nativeBuildInputs = [ gn ninja pkgconfig ];
buildInputs = [ python glib ];
buildPhase = ''
2017-09-24 17:10:31 +01:00
ninja -C out.gn/${arch}.release/
2017-07-18 19:33:52 +01:00
'';
enableParallelBuilding = true;
installPhase = ''
2017-09-24 17:10:31 +01:00
install -vD out.gn/${arch}.release/d8 "$out/bin/d8"
install -vD out.gn/${arch}.release/mksnapshot "$out/bin/mksnapshot"
2017-07-18 19:33:52 +01:00
mkdir -p "$out/lib"
for f in libicui18n.so libicuuc.so libv8_libbase.so libv8_libplatform.so libv8.so; do
install -vD out.gn/${arch}.release/$f "$out/lib/$f"
done
install -vD out.gn/${arch}.release/icudtl.dat "$out/lib/icudtl.dat"
mkdir -p "$out/include"
cp -vr include/*.h "$out/include"
cp -vr include/libplatform "$out/include"
'';
meta = with lib; {
description = "Google's open source JavaScript engine";
maintainers = with maintainers; [ cstrahan proglodyte ];
platforms = platforms.linux;
license = licenses.bsd3;
};
}