1 # NOTE: this expression is NOT exported from the top-level of all-packages.nix,
2 # it is exclusively used by the 'plv8' PostgreSQL extension.
3 # Since plv8 2.3.2, plv8 no longer requires this specific version, but as of
4 # 2019-08-29, nixpkgs does not have v8 6.x, and v8_5 is bumped to 5.4.232, which
5 # is a bit outdated. plv8 3.x is planned to support v8 7.x
7 { stdenv, lib, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkg-config
13 arch = if stdenv.isAarch32
14 then if stdenv.is64bit
17 else if stdenv.is64bit
20 git_url = "https://chromium.googlesource.com";
22 # This data is from the DEPS file in the root of a V8 checkout
24 "base/trace_event/common" = fetchgit {
25 url = "${git_url}/chromium/src/base/trace_event/common.git";
26 rev = "0e9a47d74970bee1bbfc063c47215406f8918699";
27 sha256 = "07rbzrlscp8adh4z86yl5jxdnvgkc3xs950xldpk318wf9i3bh6c";
30 url = "${git_url}/chromium/src/build.git";
31 rev = "9338ce52d0b9bcef34c38285fbd5023b62739fac";
32 sha256 = "1s2sa8dy3waidsirjylc82ggb18l1108bczjc8z0v4ywyj4k0cvh";
34 buildtools = fetchgit {
35 url = "${git_url}/chromium/buildtools.git";
36 rev = "505de88083136eefd056e5ee4ca0f01fe9b33de8";
37 sha256 = "0vj216nhb803bggsl0hnyagj8njrm96pn8sim6xcnqb7nhz1vabw";
39 "test/benchmarks/data" = fetchgit {
40 url = "${git_url}/v8/deps/third_party/benchmarks.git";
41 rev = "05d7188267b4560491ff9155c5ee13e207ecd65f";
42 sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl";
44 "test/mozilla/data" = fetchgit {
45 url = "${git_url}/v8/deps/third_party/mozilla-tests.git";
46 rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be";
47 sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn";
49 "test/test262/data" = fetchgit {
50 url = "${git_url}/external/github.com/tc39/test262.git";
51 rev = "5d4c667b271a9b39d0de73aef5ffe6879c6f8811";
52 sha256 = "0q9iwb2nkybf9np95wgf5m372aw2lhx9wlsw41a2a80kbkvb2kqg";
54 "test/test262/harness" = fetchgit {
55 url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git";
56 rev = "0f2acdd882c84cff43b9d60df7574a1901e2cdcd";
57 sha256 = "00brj5avp43yamc92kinba2mg3a2x1rcd7wnm7z093l73idprvkp";
59 "test/wasm-js" = fetchgit {
60 url = "${git_url}/external/github.com/WebAssembly/spec.git";
61 rev = "a7e226a92e660a3d5413cfea4269824f513259d2";
62 sha256 = "0z3aybj3ykajwh2bv5fwd6pwqjjsq8dnwrqc2wncb6r9xcjwbgxp";
64 "testing/gtest" = fetchgit {
65 url = "${git_url}/external/github.com/google/googletest.git";
66 rev = "6f8a66431cb592dad629028a50b3dd418a408c87";
67 sha256 = "0bdba2lr6pg15bla9600zg0r0vm4lnrx0wqz84p376wfdxra24vw";
69 "third_party/icu" = fetchgit {
70 url = "${git_url}/chromium/deps/icu.git";
71 rev = "741688ebf328da9adc52505248bf4e2ef868722c";
72 sha256 = "02ifm18qjlrkn5nm2rxkf9yz9bdlyq7c65jfjndv63vi1drqh1r9";
74 "third_party/instrumented_libraries" = fetchgit {
75 url = "${git_url}/chromium/src/third_party/instrumented_libraries.git";
76 rev = "28417458ac4dc79f68915079d0f283f682504cc0";
77 sha256 = "1qf5c2946n37p843yriv7xawi6ss6samabghq43s49cgd4wq8dc3";
79 "third_party/jinja2" = fetchgit {
80 url = "${git_url}/chromium/src/third_party/jinja2.git";
81 rev = "d34383206fa42d52faa10bb9931d6d538f3a57e0";
82 sha256 = "0d9hyw0bvp3p0dbwy833cm9vdqxcam0qbm9jc561ynphddxlkmgd";
84 "third_party/markupsafe" = fetchgit {
85 url = "${git_url}/chromium/src/third_party/markupsafe.git";
86 rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783";
87 sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz";
89 "tools/clang" = fetchgit {
90 url = "${git_url}/chromium/src/tools/clang.git";
91 rev = "8688d267571de76a56746324dcc249bf4232b85a";
92 sha256 = "0krq4zz1vnwp064bm517gwr2napy18wyccdh8w5s4qgkjwwxd63s";
94 "tools/gyp" = fetchgit {
95 url = "${git_url}/external/gyp.git";
96 rev = "d61a9397e668fa9843c4aa7da9e79460fe590bfb";
97 sha256 = "1z081h72mjy285jb1kj5xd0pb4p12n9blvsimsavyn3ldmswv0r0";
99 "tools/luci-go" = fetchgit {
100 url = "${git_url}/chromium/src/tools/luci-go.git";
101 rev = "45a8a51fda92e123619a69e7644d9c64a320b0c1";
102 sha256 = "0r7736gqk7r0i7ig0b5ib10d9q8a8xzsmc0f0fbkm9k78v847vpj";
104 "tools/swarming_client" = fetchgit {
105 url = "${git_url}/infra/luci/client-py.git";
106 rev = "4bd9152f8a975d57c972c071dfb4ddf668e02200";
107 sha256 = "03zk91gzvqv01g1vbl8d7h8al7vs4ymrrdc8ipg9wpq52yh65smh";
113 stdenv.mkDerivation rec {
115 version = "6.4.388.40";
119 src = fetchFromGitHub {
123 sha256 = "1lq239cgqyidrynz8g3wbdv70ymzv6s0ppad8s219gb3jnizm16a";
127 ${lib.concatStringsSep "\n" (
128 lib.mapAttrsToList (n: v: ''
129 mkdir -p $sourceRoot/${n}
130 cp -r ${v}/* $sourceRoot/${n}
135 # use our gn, not the bundled one
136 sed -i -e 's#gn_path = .*#gn_path = "${gn}/bin/gn"#' tools/mb/mb.py
139 if [ "$doCheck" = "" ]; then sed -i -e '/"test:gn_all",/d' BUILD.gn; fi
141 # disable sysroot usage
142 chmod u+w build/config build/config/sysroot.gni
143 sed -i build/config/sysroot.gni \
144 -e '/use_sysroot =/ { s#\(use_sysroot =\).*#\1 false#; :a n; /current_cpu/ { s/^/#/; ba }; }'
146 # patch shebangs (/usr/bin/env)
147 patchShebangs tools/dev/v8gen.py
151 tools/dev/v8gen.py -vv ${arch}.release -- \
152 is_component_build=true \
153 ${if snapshot then "v8_use_external_startup_data=false" else "v8_use_snapshot=false"} \
155 linux_use_bundled_binutils=false \
156 treat_warnings_as_errors=false \
157 use_custom_libcxx=false \
158 use_custom_libcxx_for_host=false
161 nativeBuildInputs = [ gn ninja pkg-config ];
162 buildInputs = [ python glib ];
165 ninja -C out.gn/${arch}.release/
168 enableParallelBuilding = true;
171 install -vD out.gn/${arch}.release/d8 "$out/bin/d8"
172 install -vD out.gn/${arch}.release/mksnapshot "$out/bin/mksnapshot"
174 for f in libicui18n.so libicuuc.so libv8_libbase.so libv8_libplatform.so libv8.so; do
175 install -vD out.gn/${arch}.release/$f "$out/lib/$f"
177 install -vD out.gn/${arch}.release/icudtl.dat "$out/lib/icudtl.dat"
178 mkdir -p "$out/include"
179 cp -vr include/*.h "$out/include"
180 cp -vr include/libplatform "$out/include"
184 description = "Google's open source JavaScript engine";
185 maintainers = with maintainers; [ cstrahan proglodyte ];
186 platforms = platforms.linux;
187 license = licenses.bsd3;