2017-07-18 20:33:52 +02:00
|
|
|
{ stdenv, lib, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkgconfig
|
|
|
|
, doCheck ? false
|
|
|
|
, snapshot ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.
The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:
```
ISA: ARMv8 {-A, -R, -M}
/ \
Mode: Aarch32 Aarch64
| / \
Encoding: A64 A32 T32
```
At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.
The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.
[1]: https://developer.arm.com/products/architecture/a-profile
2018-03-20 03:41:06 +01:00
|
|
|
arch = if stdenv.isAarch32
|
2017-07-18 20:33:52 +02: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 01:31:32 +02:00
|
|
|
# This data is from the DEPS file in the root of a V8 checkout
|
2017-07-18 20:33:52 +02:00
|
|
|
deps = {
|
|
|
|
"base/trace_event/common" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/src/base/trace_event/common.git";
|
|
|
|
rev = "211b3ed9d0481b4caddbee1322321b86a483ca1f";
|
|
|
|
sha256 = "080sya1dg32hi5gj7zr3r5l18r6w8g0imajyf3xfvnz67a2i8dd7";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"build" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/src/build.git";
|
|
|
|
rev = "7315579e388589b62236ad933f09afd1e838d234";
|
|
|
|
sha256 = "14gsigyjfm03kfzmz0v6429b6qnycvzx0yj3vwaks8may26aiv71";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"buildtools" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/buildtools.git";
|
|
|
|
rev = "0dd5c6f980d22be96b728155249df2da355989d9";
|
|
|
|
sha256 = "0m1fh0qjcx9c69khnqcsqvrnqs7ji6wfxns9vv9mknj20sph5ydr";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"test/benchmarks/data" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/v8/deps/third_party/benchmarks.git";
|
|
|
|
rev = "05d7188267b4560491ff9155c5ee13e207ecd65f";
|
2017-07-18 20:33:52 +02:00
|
|
|
sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl";
|
|
|
|
};
|
|
|
|
"test/mozilla/data" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/v8/deps/third_party/mozilla-tests.git";
|
|
|
|
rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be";
|
2017-07-18 20:33:52 +02:00
|
|
|
sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn";
|
|
|
|
};
|
|
|
|
"test/test262/data" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/external/github.com/tc39/test262.git";
|
|
|
|
rev = "a6c1d05ac4fed084fa047e4c52ab2a8c9c2a8aef";
|
|
|
|
sha256 = "1cy3val2ih6r4sbaxd1v9fir87mrlw1kr54s64g68gnch53ck9s3";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"test/test262/harness" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git";
|
|
|
|
rev = "0f2acdd882c84cff43b9d60df7574a1901e2cdcd";
|
2017-07-18 20:33:52 +02:00
|
|
|
sha256 = "00brj5avp43yamc92kinba2mg3a2x1rcd7wnm7z093l73idprvkp";
|
|
|
|
};
|
|
|
|
"test/wasm-js" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/external/github.com/WebAssembly/spec.git";
|
|
|
|
rev = "2113ea7e106f8a964e0445ba38f289d2aa845edd";
|
|
|
|
sha256 = "07aw7x2xzmzk905mqf8gbbb1bi1a5kv99g8iv6x2p07d3zns7xzx";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
2018-09-05 01:31:32 +02:00
|
|
|
"third_party/depot_tools" = fetchgit {
|
|
|
|
url = "${git_url}/chromium/tools/depot_tools.git";
|
|
|
|
rev = "fb734036f4b5ae6d5afc63cbfc41d3a5d1c29a82";
|
|
|
|
sha256 = "1738y7xgfnn0hfdr8g5jw7555841ycxbn580mdffwv4jnbn7120s";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
2018-09-05 01:31:32 +02:00
|
|
|
"third_party/googletest/src" = fetchgit {
|
|
|
|
url = "${git_url}/external/github.com/google/googletest.git";
|
|
|
|
rev = "ce468a17c434e4e79724396ee1b51d86bfc8a88b";
|
|
|
|
sha256 = "0nik8wb1b0zk2sslawgp5h211r5bc4x7m962dgnmbk11ccvsmr23";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"third_party/icu" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/deps/icu.git";
|
|
|
|
rev = "a9a2bd3ee4f1d313651c5272252aaf2a3e7ed529";
|
|
|
|
sha256 = "1bfyxakgv9z0rxbqsy5csi85kg8dqy7i6zybmng5wyzag9cns4f9";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"third_party/instrumented_libraries" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/src/third_party/instrumented_libraries.git";
|
|
|
|
rev = "323cf32193caecbf074d1a0cb5b02b905f163e0f";
|
|
|
|
sha256 = "0q3n3ivqva28qpn67ds635521pwzpc9apcyagz65i9j17bb1k231";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"third_party/jinja2" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/src/third_party/jinja2.git";
|
|
|
|
rev = "b41863e42637544c2941b574c7877d3e1f663e25";
|
|
|
|
sha256 = "1qgilclkav67m6cl2xq2kmzkswrkrb2axc2z8mw58fnch4j1jf1r";
|
2017-07-18 20:33:52 +02:00
|
|
|
};
|
|
|
|
"third_party/markupsafe" = fetchgit {
|
2018-09-05 01:31:32 +02:00
|
|
|
url = "${git_url}/chromium/src/third_party/markupsafe.git";
|
|
|
|
rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783";
|
2017-07-18 20:33:52 +02:00
|
|
|
sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz";
|
|
|
|
};
|
2018-09-05 01:31:32 +02:00
|
|
|
"third_party/proguard" = fetchgit {
|
|
|
|
url = "${git_url}/chromium/src/third_party/proguard.git";
|
|
|
|
rev = "eba7a98d98735b2cc65c54d36baa5c9b46fe4f8e";
|
|
|
|
sha256 = "1yx86z2p243b0ykixgqz6nlqfp8swa6n0yl5fgb29fa4jvsjz3d1";
|
|
|
|
};
|
2017-07-18 20:33:52 +02:00
|
|
|
"tools/clang" = fetchgit {
|
2018-09-05 01:31:32 +02: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 20:33:52 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "v8-${version}";
|
2018-09-05 01:31:32 +02:00
|
|
|
version = "6.9.427.14";
|
2017-07-18 20:33:52 +02:00
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "v8";
|
|
|
|
repo = "v8";
|
|
|
|
rev = version;
|
2018-09-05 01:31:32 +02:00
|
|
|
sha256 = "13d50iz87qh7v8l8kjky8wqs9rvz02pgw74q8crqi5ywnvvill1x";
|
2017-07-18 20:33:52 +02: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
|
|
|
|
|
2017-09-24 18:10:58 +02:00
|
|
|
# disable sysroot usage
|
2017-07-18 20:33:52 +02: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 }; }'
|
2017-09-24 18:10:58 +02:00
|
|
|
|
|
|
|
# patch shebangs (/usr/bin/env)
|
|
|
|
patchShebangs tools/dev/v8gen.py
|
2017-07-18 20:33:52 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
tools/dev/v8gen.py -vv ${arch}.release -- \
|
2018-09-05 01:31:32 +02: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 20:33:52 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ gn ninja pkgconfig ];
|
|
|
|
buildInputs = [ python glib ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2017-09-24 18:10:31 +02:00
|
|
|
ninja -C out.gn/${arch}.release/
|
2017-07-18 20:33:52 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-09-24 18:10:31 +02:00
|
|
|
install -vD out.gn/${arch}.release/d8 "$out/bin/d8"
|
|
|
|
install -vD out.gn/${arch}.release/mksnapshot "$out/bin/mksnapshot"
|
2017-07-18 20:33:52 +02: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;
|
|
|
|
};
|
|
|
|
}
|