diff --git a/pkgs/development/interpreters/proglodyte-wasm/default.nix b/pkgs/development/interpreters/proglodyte-wasm/default.nix index 9a30ae7d8a85..5710f1066757 100644 --- a/pkgs/development/interpreters/proglodyte-wasm/default.nix +++ b/pkgs/development/interpreters/proglodyte-wasm/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, cmake, clang, python, v8_static, coreutils }: +{ stdenv, fetchFromGitHub, cmake, clang, python, v8, coreutils }: let sexpr_wasm_prototype = stdenv.mkDerivation { @@ -45,7 +45,7 @@ stdenv.mkDerivation { installPhase = '' export DESTDIR=$out export MKTEMPDIR=${coreutils}/bin - export D8DIR=${v8_static}/bin + export D8DIR=${v8}/bin export SWDIR=${sexpr_wasm_prototype}/bin make install ''; diff --git a/pkgs/development/libraries/v8/5_x.nix b/pkgs/development/libraries/v8/5_x.nix new file mode 100644 index 000000000000..2b9fa5cc04c0 --- /dev/null +++ b/pkgs/development/libraries/v8/5_x.nix @@ -0,0 +1,199 @@ +{ stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu +, patchelf, coreutils, xcbuild +, doCheck ? false +, static ? false +}: + +assert readline != null; + +let + arch = if stdenv.isx86_64 then "x64" + else if stdenv.isi686 then "ia32" + else if stdenv.isAarch64 then "arm64" + else if stdenv.isAarch32 then "arm" + else throw "Unknown architecture for v8"; + git_url = "https://chromium.googlesource.com"; + clangFlag = if stdenv.isDarwin then "1" else "0"; + sharedFlag = if static then "static_library" else "shared_library"; + + deps = { + "build" = fetchgit { + url = "${git_url}/chromium/src/build.git"; + rev = "2c67d4d74b6b3673228fab191918500a582ef3b0"; + sha256 = "0jc7hci5yh792pw0ahjfxrk5xzllnlrv9llmwlgcgn2x8x6bn34q"; + }; + "tools/gyp" = fetchgit { + url = "${git_url}/external/gyp.git"; + rev = "e7079f0e0e14108ab0dba58728ff219637458563"; + sha256 = "0yd1ds13z0r9d2sb67f9i1gjn1zgzwyfv96qqqp6pn5pcfbialg6"; + }; + "third_party/icu" = fetchgit { + url = "${git_url}/chromium/deps/icu.git"; + rev = "b5ecbb29a26532f72ef482569b223d5a51fd50bf"; + sha256 = "0ld47wdnk8grcba221z67l3pnphv9zwifk4y44f5b946w3iwmpns"; + }; + "buildtools" = fetchgit { + url = "${git_url}/chromium/buildtools.git"; + rev = "60f7f9a8b421ebf9a46041dfa2ff11c0fe59c582"; + sha256 = "0i10bw7yhslklqwcx5krs3k05sicb73cpwd0mkaz96yxsvmkvjq0"; + }; + "base/trace_event/common" = fetchgit { + url = "${git_url}/chromium/src/base/trace_event/common.git"; + rev = "315bf1e2d45be7d53346c31cfcc37424a32c30c8"; + sha256 = "1pp2ygvp20j6g4868hrmiw0j704kdvsi9d9wx2gbk7w79rc36695"; + }; + "platform/inspector_protocol" = fetchgit { + url = "${git_url}/chromium/src/third_party/WebKit/Source/platform/inspector_protocol.git"; + rev = "f49542089820a34a9a6e33264e09b73779407512"; + sha256 = "1lwpass3p4rpp2kjmxxxpkqyv4lznxhf4i0yy7mmrd7jkpc7kn8k"; + }; + "tools/mb" = fetchgit { + url = "${git_url}/chromium/src/tools/mb.git"; + rev = "0c4dc43c454f26936ddf3074ab8e9a41e3dc03a3"; + sha256 = "0f96qphbmwn1pprv0a6xf68p01s1jzx2sz6pmadqbrs1dgh1xwnk"; + }; + "tools/swarming_client" = fetchgit { + url = "${git_url}/external/swarming.client.git"; + rev = "7f63a272f7d9785ce41b6d10bb3106c49a968e57"; + sha256 = "1pmb8bq4qifjf2dzz8c4jdwhlvwgrl9ycjaalcyh1sbh4lx3yvv2"; + }; + "testing/gtest" = fetchgit { + url = "${git_url}/external/github.com/google/googletest.git"; + rev = "6f8a66431cb592dad629028a50b3dd418a408c87"; + sha256 = "0bdba2lr6pg15bla9600zg0r0vm4lnrx0wqz84p376wfdxra24vw"; + }; + "testing/gmock" = fetchgit { + url = "${git_url}/external/googlemock.git"; + rev = "0421b6f358139f02e102c9c332ce19a33faf75be"; + sha256 = "1xiky4v98maxs8fg1avcd56y0alv3hw8qyrlpd899zgzbq2k10pp"; + }; + "test/benchmarks/data" = fetchgit { + url = "${git_url}/v8/deps/third_party/benchmarks.git"; + rev = "05d7188267b4560491ff9155c5ee13e207ecd65f"; + sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl"; + }; + "test/mozilla/data" = fetchgit { + url = "${git_url}/v8/deps/third_party/mozilla-tests.git"; + rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be"; + sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn"; + }; + "test/simdjs/data" = fetchgit { + url = "${git_url}/external/github.com/tc39/ecmascript_simd.git"; + rev = "baf493985cb9ea7cdbd0d68704860a8156de9556"; + sha256 = "178r0k40a58c1187gfzqz2i6as34l8cliy1g1x870wyy0qcvlq2q"; + }; + "test/test262/data" = fetchgit { + url = "${git_url}/external/github.com/tc39/test262.git"; + rev = "88bc7fe7586f161201c5f14f55c9c489f82b1b67"; + sha256 = "0gc7fmaqrgwb6rl02jnrm3synpwzzg0dfqy3zm386r1qcisl93xs"; + }; + "test/test262/harness" = fetchgit { + url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git"; + rev = "cbd968f54f7a95c6556d53ba852292a4c49d11d8"; + sha256 = "094c3600a4wh1m3fvvlivn290kik1pzzvwabq77lk8bh4jkkv7ki"; + }; + "tools/clang" = fetchgit { + url = "${git_url}/chromium/src/tools/clang.git"; + rev = "496622ab4aaa5be7e5a9b80617013cb02f45dc87"; + sha256 = "1gkhk2bzpxwzkirzcqfixxpprbr8mn6rk00krm25daarm3smydmf"; + }; + }; + +in + +stdenv.mkDerivation rec { + name = "v8-${version}"; + version = "5.4.232"; + + inherit doCheck; + + src = fetchFromGitHub { + owner = "v8"; + repo = "v8"; + rev = version; + sha256 = "1nqxbkz75m8xrjih0sj3f3iqvif4192vxdaxzy8r787rihjwg9nx"; + }; + + postUnpack = '' + ${lib.concatStringsSep "\n" ( + lib.mapAttrsToList (n: v: '' + mkdir -p $sourceRoot/${n} + cp -r ${v}/* $sourceRoot/${n} + '') deps)} + ''; + + # Patch based off of: + # https://github.com/cowboyd/libv8/tree/v5.1.281.67.0/patches + patches = lib.optional (!doCheck) ./libv8-5.4.232.patch; + + postPatch = '' + sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' gypfiles/gyp_v8 + sed -i 's,/bin/echo,${coreutils}/bin/echo,' gypfiles/standalone.gypi + sed -i '/CR_CLANG_REVISION/ d' gypfiles/standalone.gypi + sed -i 's/-Wno-format-pedantic//g' gypfiles/standalone.gypi + ''; + + configurePhase = '' + PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \ + PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \ + gypfiles/gyp_v8 \ + -f make \ + --generator-output="out" \ + -Dflock_index=0 \ + -Dclang=${clangFlag} \ + -Dv8_enable_i18n_support=1 \ + -Duse_system_icu=1 \ + -Dcomponent=${sharedFlag} \ + -Dconsole=readline \ + -Dv8_target_arch=${arch} \ + -Dv8_use_external_startup_data=0 + ''; + + nativeBuildInputs = [ which ]; + buildInputs = [ readline python icu ] + ++ stdenv.lib.optional stdenv.isDarwin xcbuild + ++ stdenv.lib.optional stdenv.isLinux patchelf; + + NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow -Wno-error=unused-function -Wno-error=attributes" + + stdenv.lib.optionalString stdenv.cc.isClang " -Wno-error=unused-lambda-capture"; + + buildFlags = [ + "LINK=c++" + "-C out" + "builddir=$(CURDIR)/Release" + "BUILDTYPE=Release" + ]; + + enableParallelBuilding = true; + + dontUpdateAutotoolsGnuConfigScripts = if stdenv.isAarch64 then true else null; + + # the `libv8_libplatform` target is _only_ built as a static library, + # and is expected to be statically linked in when needed. + # see the following link for further commentary: + # https://github.com/cowboyd/therubyracer/issues/391 + installPhase = '' + install -vD out/Release/d8 "$out/bin/d8" + install -vD out/Release/mksnapshot "$out/bin/mksnapshot" + ${if static then "" + else if stdenv.isDarwin then '' + install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib" + install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/bin/d8 + install_name_tool -id $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/lib/libv8.dylib + '' else '' + install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so" + ''} + mkdir -p "$out/include" + cp -vr include/*.h "$out/include" + cp -vr include/libplatform "$out/include" + mkdir -p "$out/lib" + cp -v out/Release/*.a "$out/lib" + ''; + + meta = with lib; { + description = "Google's open source JavaScript engine"; + maintainers = with maintainers; [ cstrahan proglodyte ]; + platforms = platforms.linux ++ platforms.darwin; + license = licenses.bsd3; + }; +} diff --git a/pkgs/development/libraries/v8/6_x.nix b/pkgs/development/libraries/v8/6_x.nix deleted file mode 100644 index 85d0c0d91bb5..000000000000 --- a/pkgs/development/libraries/v8/6_x.nix +++ /dev/null @@ -1,193 +0,0 @@ -{ stdenv, lib, fetchgit, fetchFromGitHub, gn, ninja, python, glib, pkgconfig -, doCheck ? false -, snapshot ? true -}: - -let - arch = if stdenv.isAarch32 - then if stdenv.is64bit - then"arm64" - else "arm" - else if stdenv.is64bit - then"x64" - else "ia32"; - git_url = "https://chromium.googlesource.com"; - - # This data is from the DEPS file in the root of a V8 checkout - deps = { - "base/trace_event/common" = fetchgit { - url = "${git_url}/chromium/src/base/trace_event/common.git"; - rev = "211b3ed9d0481b4caddbee1322321b86a483ca1f"; - sha256 = "080sya1dg32hi5gj7zr3r5l18r6w8g0imajyf3xfvnz67a2i8dd7"; - }; - "build" = fetchgit { - url = "${git_url}/chromium/src/build.git"; - rev = "7315579e388589b62236ad933f09afd1e838d234"; - sha256 = "14gsigyjfm03kfzmz0v6429b6qnycvzx0yj3vwaks8may26aiv71"; - }; - "buildtools" = fetchgit { - url = "${git_url}/chromium/buildtools.git"; - rev = "0dd5c6f980d22be96b728155249df2da355989d9"; - sha256 = "0m1fh0qjcx9c69khnqcsqvrnqs7ji6wfxns9vv9mknj20sph5ydr"; - }; - "test/benchmarks/data" = fetchgit { - url = "${git_url}/v8/deps/third_party/benchmarks.git"; - rev = "05d7188267b4560491ff9155c5ee13e207ecd65f"; - sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl"; - }; - "test/mozilla/data" = fetchgit { - url = "${git_url}/v8/deps/third_party/mozilla-tests.git"; - rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be"; - sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn"; - }; - "test/test262/data" = fetchgit { - url = "${git_url}/external/github.com/tc39/test262.git"; - rev = "a6c1d05ac4fed084fa047e4c52ab2a8c9c2a8aef"; - sha256 = "1cy3val2ih6r4sbaxd1v9fir87mrlw1kr54s64g68gnch53ck9s3"; - }; - "test/test262/harness" = fetchgit { - url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git"; - rev = "0f2acdd882c84cff43b9d60df7574a1901e2cdcd"; - sha256 = "00brj5avp43yamc92kinba2mg3a2x1rcd7wnm7z093l73idprvkp"; - }; - "test/wasm-js" = fetchgit { - url = "${git_url}/external/github.com/WebAssembly/spec.git"; - rev = "2113ea7e106f8a964e0445ba38f289d2aa845edd"; - sha256 = "07aw7x2xzmzk905mqf8gbbb1bi1a5kv99g8iv6x2p07d3zns7xzx"; - }; - "third_party/depot_tools" = fetchgit { - url = "${git_url}/chromium/tools/depot_tools.git"; - rev = "fb734036f4b5ae6d5afc63cbfc41d3a5d1c29a82"; - sha256 = "1738y7xgfnn0hfdr8g5jw7555841ycxbn580mdffwv4jnbn7120s"; - }; - "third_party/googletest/src" = fetchgit { - url = "${git_url}/external/github.com/google/googletest.git"; - rev = "ce468a17c434e4e79724396ee1b51d86bfc8a88b"; - sha256 = "0nik8wb1b0zk2sslawgp5h211r5bc4x7m962dgnmbk11ccvsmr23"; - }; - "third_party/icu" = fetchgit { - url = "${git_url}/chromium/deps/icu.git"; - rev = "a9a2bd3ee4f1d313651c5272252aaf2a3e7ed529"; - sha256 = "1bfyxakgv9z0rxbqsy5csi85kg8dqy7i6zybmng5wyzag9cns4f9"; - }; - "third_party/instrumented_libraries" = fetchgit { - url = "${git_url}/chromium/src/third_party/instrumented_libraries.git"; - rev = "323cf32193caecbf074d1a0cb5b02b905f163e0f"; - sha256 = "0q3n3ivqva28qpn67ds635521pwzpc9apcyagz65i9j17bb1k231"; - }; - "third_party/jinja2" = fetchgit { - url = "${git_url}/chromium/src/third_party/jinja2.git"; - rev = "b41863e42637544c2941b574c7877d3e1f663e25"; - sha256 = "1qgilclkav67m6cl2xq2kmzkswrkrb2axc2z8mw58fnch4j1jf1r"; - }; - "third_party/markupsafe" = fetchgit { - url = "${git_url}/chromium/src/third_party/markupsafe.git"; - rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783"; - sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz"; - }; - "third_party/proguard" = fetchgit { - url = "${git_url}/chromium/src/third_party/proguard.git"; - rev = "eba7a98d98735b2cc65c54d36baa5c9b46fe4f8e"; - sha256 = "1yx86z2p243b0ykixgqz6nlqfp8swa6n0yl5fgb29fa4jvsjz3d1"; - }; - "tools/clang" = fetchgit { - 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"; - }; - }; - -in - -stdenv.mkDerivation rec { - name = "v8-${version}"; - version = "6.9.427.14"; - - inherit doCheck; - - src = fetchFromGitHub { - owner = "v8"; - repo = "v8"; - rev = version; - sha256 = "13d50iz87qh7v8l8kjky8wqs9rvz02pgw74q8crqi5ywnvvill1x"; - }; - - 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 - 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 - ''; - - configurePhase = '' - tools/dev/v8gen.py -vv ${arch}.release -- \ - 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 - ''; - - nativeBuildInputs = [ gn ninja pkgconfig ]; - buildInputs = [ python glib ]; - - buildPhase = '' - ninja -C out.gn/${arch}.release/ - ''; - - enableParallelBuilding = true; - - installPhase = '' - install -vD out.gn/${arch}.release/d8 "$out/bin/d8" - install -vD out.gn/${arch}.release/mksnapshot "$out/bin/mksnapshot" - 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; - }; -} diff --git a/pkgs/development/libraries/v8/darwin.patch b/pkgs/development/libraries/v8/darwin.patch new file mode 100644 index 000000000000..629d5e4dc392 --- /dev/null +++ b/pkgs/development/libraries/v8/darwin.patch @@ -0,0 +1,22 @@ +diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni +index 80e2a362a..df138c87b 100644 +--- a/build/toolchain/gcc_toolchain.gni ++++ b/build/toolchain/gcc_toolchain.gni +@@ -355,6 +355,8 @@ template("gcc_toolchain") { + # AIX does not support either -D (deterministic output) or response + # files. + command = "$ar -X64 {{arflags}} -r -c -s {{output}} {{inputs}}" ++ } else if (current_os == "mac") { ++ command = "$ar {{arflags}} -r -c -s {{output}} {{inputs}}" + } else { + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" +@@ -546,7 +548,7 @@ template("gcc_toolchain") { + + start_group_flag = "" + end_group_flag = "" +- if (current_os != "aix") { ++ if (current_os != "aix" && current_os != "mac") { + # the "--start-group .. --end-group" feature isn't available on the aix ld. + start_group_flag = "-Wl,--start-group" + end_group_flag = "-Wl,--end-group " diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix index 2b9fa5cc04c0..f7c4f34e8e6e 100644 --- a/pkgs/development/libraries/v8/default.nix +++ b/pkgs/development/libraries/v8/default.nix @@ -1,101 +1,43 @@ -{ stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu -, patchelf, coreutils, xcbuild -, doCheck ? false -, static ? false +{ stdenv, lib, fetchgit, fetchFromGitHub +, gn, ninja, python, glib, pkgconfig, icu +, xcbuild, darwin +, fetchpatch }: -assert readline != null; - let - arch = if stdenv.isx86_64 then "x64" - else if stdenv.isi686 then "ia32" - else if stdenv.isAarch64 then "arm64" - else if stdenv.isAarch32 then "arm" - else throw "Unknown architecture for v8"; git_url = "https://chromium.googlesource.com"; - clangFlag = if stdenv.isDarwin then "1" else "0"; - sharedFlag = if static then "static_library" else "shared_library"; + # This data is from the DEPS file in the root of a V8 checkout deps = { - "build" = fetchgit { - url = "${git_url}/chromium/src/build.git"; - rev = "2c67d4d74b6b3673228fab191918500a582ef3b0"; - sha256 = "0jc7hci5yh792pw0ahjfxrk5xzllnlrv9llmwlgcgn2x8x6bn34q"; + "base/trace_event/common" = fetchgit { + url = "${git_url}/chromium/src/base/trace_event/common.git"; + rev = "936ba8a963284a6b3737cf2f0474a7131073abee"; + sha256 = "14nr22fqdpxma1kzjflj6a865vr3hfnnm2gs4vcixyq4kmfzfcy2"; }; - "tools/gyp" = fetchgit { - url = "${git_url}/external/gyp.git"; - rev = "e7079f0e0e14108ab0dba58728ff219637458563"; - sha256 = "0yd1ds13z0r9d2sb67f9i1gjn1zgzwyfv96qqqp6pn5pcfbialg6"; + "build" = fetchgit { + url = "${git_url}/chromium/src/build.git"; + rev = "325e95d6dae64f35b160b3dc7d73218cee5ec079"; + sha256 = "0dddyxa76p2xpjhmxif05v63i5ar6h5v684fdl667sg84f5bhhxf"; + }; + "third_party/googletest/src" = fetchgit { + url = "${git_url}/external/github.com/google/googletest.git"; + rev = "5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081"; + sha256 = "0gmr10042c0xybxnn6g7ndj1na1mmd3l9w7449qlcv4s8gmfs7k6"; }; "third_party/icu" = fetchgit { - url = "${git_url}/chromium/deps/icu.git"; - rev = "b5ecbb29a26532f72ef482569b223d5a51fd50bf"; - sha256 = "0ld47wdnk8grcba221z67l3pnphv9zwifk4y44f5b946w3iwmpns"; + url = "${git_url}/chromium/deps/icu.git"; + rev = "960f195aa87acaec46e6104ec93a596da7ae0843"; + sha256 = "073kh6gpcairgjxf3hlhpqljc13gwl2aj8fz91fv220xibwqs834"; }; - "buildtools" = fetchgit { - url = "${git_url}/chromium/buildtools.git"; - rev = "60f7f9a8b421ebf9a46041dfa2ff11c0fe59c582"; - sha256 = "0i10bw7yhslklqwcx5krs3k05sicb73cpwd0mkaz96yxsvmkvjq0"; + "third_party/jinja2" = fetchgit { + url = "${git_url}/chromium/src/third_party/jinja2.git"; + rev = "b41863e42637544c2941b574c7877d3e1f663e25"; + sha256 = "1qgilclkav67m6cl2xq2kmzkswrkrb2axc2z8mw58fnch4j1jf1r"; }; - "base/trace_event/common" = fetchgit { - url = "${git_url}/chromium/src/base/trace_event/common.git"; - rev = "315bf1e2d45be7d53346c31cfcc37424a32c30c8"; - sha256 = "1pp2ygvp20j6g4868hrmiw0j704kdvsi9d9wx2gbk7w79rc36695"; - }; - "platform/inspector_protocol" = fetchgit { - url = "${git_url}/chromium/src/third_party/WebKit/Source/platform/inspector_protocol.git"; - rev = "f49542089820a34a9a6e33264e09b73779407512"; - sha256 = "1lwpass3p4rpp2kjmxxxpkqyv4lznxhf4i0yy7mmrd7jkpc7kn8k"; - }; - "tools/mb" = fetchgit { - url = "${git_url}/chromium/src/tools/mb.git"; - rev = "0c4dc43c454f26936ddf3074ab8e9a41e3dc03a3"; - sha256 = "0f96qphbmwn1pprv0a6xf68p01s1jzx2sz6pmadqbrs1dgh1xwnk"; - }; - "tools/swarming_client" = fetchgit { - url = "${git_url}/external/swarming.client.git"; - rev = "7f63a272f7d9785ce41b6d10bb3106c49a968e57"; - sha256 = "1pmb8bq4qifjf2dzz8c4jdwhlvwgrl9ycjaalcyh1sbh4lx3yvv2"; - }; - "testing/gtest" = fetchgit { - url = "${git_url}/external/github.com/google/googletest.git"; - rev = "6f8a66431cb592dad629028a50b3dd418a408c87"; - sha256 = "0bdba2lr6pg15bla9600zg0r0vm4lnrx0wqz84p376wfdxra24vw"; - }; - "testing/gmock" = fetchgit { - url = "${git_url}/external/googlemock.git"; - rev = "0421b6f358139f02e102c9c332ce19a33faf75be"; - sha256 = "1xiky4v98maxs8fg1avcd56y0alv3hw8qyrlpd899zgzbq2k10pp"; - }; - "test/benchmarks/data" = fetchgit { - url = "${git_url}/v8/deps/third_party/benchmarks.git"; - rev = "05d7188267b4560491ff9155c5ee13e207ecd65f"; - sha256 = "0ad2ay14bn67d61ks4dmzadfnhkj9bw28r4yjdjjyzck7qbnzchl"; - }; - "test/mozilla/data" = fetchgit { - url = "${git_url}/v8/deps/third_party/mozilla-tests.git"; - rev = "f6c578a10ea707b1a8ab0b88943fe5115ce2b9be"; - sha256 = "0rfdan76yfawqxbwwb35aa57b723j3z9fx5a2w16nls02yk2kqyn"; - }; - "test/simdjs/data" = fetchgit { - url = "${git_url}/external/github.com/tc39/ecmascript_simd.git"; - rev = "baf493985cb9ea7cdbd0d68704860a8156de9556"; - sha256 = "178r0k40a58c1187gfzqz2i6as34l8cliy1g1x870wyy0qcvlq2q"; - }; - "test/test262/data" = fetchgit { - url = "${git_url}/external/github.com/tc39/test262.git"; - rev = "88bc7fe7586f161201c5f14f55c9c489f82b1b67"; - sha256 = "0gc7fmaqrgwb6rl02jnrm3synpwzzg0dfqy3zm386r1qcisl93xs"; - }; - "test/test262/harness" = fetchgit { - url = "${git_url}/external/github.com/test262-utils/test262-harness-py.git"; - rev = "cbd968f54f7a95c6556d53ba852292a4c49d11d8"; - sha256 = "094c3600a4wh1m3fvvlivn290kik1pzzvwabq77lk8bh4jkkv7ki"; - }; - "tools/clang" = fetchgit { - url = "${git_url}/chromium/src/tools/clang.git"; - rev = "496622ab4aaa5be7e5a9b80617013cb02f45dc87"; - sha256 = "1gkhk2bzpxwzkirzcqfixxpprbr8mn6rk00krm25daarm3smydmf"; + "third_party/markupsafe" = fetchgit { + url = "${git_url}/chromium/src/third_party/markupsafe.git"; + rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783"; + sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz"; }; }; @@ -103,15 +45,23 @@ in stdenv.mkDerivation rec { name = "v8-${version}"; - version = "5.4.232"; + version = "7.4.255"; - inherit doCheck; + 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 + ]; src = fetchFromGitHub { owner = "v8"; repo = "v8"; rev = version; - sha256 = "1nqxbkz75m8xrjih0sj3f3iqvif4192vxdaxzy8r787rihjwg9nx"; + sha256 = "14i0c71hmffzqnq9n73dh9dnabdxhbjhzkhqpk5yv9y90bwrzi2n"; }; postUnpack = '' @@ -120,80 +70,46 @@ stdenv.mkDerivation rec { mkdir -p $sourceRoot/${n} cp -r ${v}/* $sourceRoot/${n} '') deps)} + chmod u+w -R . ''; - # Patch based off of: - # https://github.com/cowboyd/libv8/tree/v5.1.281.67.0/patches - patches = lib.optional (!doCheck) ./libv8-5.4.232.patch; + 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}"''; - postPatch = '' - sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' gypfiles/gyp_v8 - sed -i 's,/bin/echo,${coreutils}/bin/echo,' gypfiles/standalone.gypi - sed -i '/CR_CLANG_REVISION/ d' gypfiles/standalone.gypi - sed -i 's/-Wno-format-pedantic//g' gypfiles/standalone.gypi - ''; + nativeBuildInputs = [ gn ninja pkgconfig python ] + ++ stdenv.lib.optionals stdenv.isDarwin [ xcbuild darwin.DarwinTools ]; + buildInputs = [ glib icu ]; - configurePhase = '' - PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \ - PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \ - gypfiles/gyp_v8 \ - -f make \ - --generator-output="out" \ - -Dflock_index=0 \ - -Dclang=${clangFlag} \ - -Dv8_enable_i18n_support=1 \ - -Duse_system_icu=1 \ - -Dcomponent=${sharedFlag} \ - -Dconsole=readline \ - -Dv8_target_arch=${arch} \ - -Dv8_use_external_startup_data=0 - ''; - - nativeBuildInputs = [ which ]; - buildInputs = [ readline python icu ] - ++ stdenv.lib.optional stdenv.isDarwin xcbuild - ++ stdenv.lib.optional stdenv.isLinux patchelf; - - NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow -Wno-error=unused-function -Wno-error=attributes" - + stdenv.lib.optionalString stdenv.cc.isClang " -Wno-error=unused-lambda-capture"; - - buildFlags = [ - "LINK=c++" - "-C out" - "builddir=$(CURDIR)/Release" - "BUILDTYPE=Release" - ]; + ninjaFlags = [ ":d8" "v8_monolith" ]; enableParallelBuilding = true; - dontUpdateAutotoolsGnuConfigScripts = if stdenv.isAarch64 then true else null; - - # the `libv8_libplatform` target is _only_ built as a static library, - # and is expected to be statically linked in when needed. - # see the following link for further commentary: - # https://github.com/cowboyd/therubyracer/issues/391 installPhase = '' - install -vD out/Release/d8 "$out/bin/d8" - install -vD out/Release/mksnapshot "$out/bin/mksnapshot" - ${if static then "" - else if stdenv.isDarwin then '' - install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib" - install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/bin/d8 - install_name_tool -id $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.cc.cc.lib}/lib/libgcc_s.1.dylib $out/lib/libv8.dylib - '' else '' - install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so" - ''} - mkdir -p "$out/include" - cp -vr include/*.h "$out/include" - cp -vr include/libplatform "$out/include" - mkdir -p "$out/lib" - cp -v out/Release/*.a "$out/lib" + install -D d8 $out/bin/d8 + install -D obj/libv8_monolith.a $out/lib/libv8.a + cp -r ../../include $out ''; meta = with lib; { description = "Google's open source JavaScript engine"; - maintainers = with maintainers; [ cstrahan proglodyte ]; - platforms = platforms.linux ++ platforms.darwin; + maintainers = with maintainers; [ cstrahan proglodyte matthewbauer ]; + platforms = platforms.unix; license = licenses.bsd3; }; } diff --git a/pkgs/development/tools/build-managers/gn/default.nix b/pkgs/development/tools/build-managers/gn/default.nix index 8c1b55fc5c9a..7ee4c4ee2580 100644 --- a/pkgs/development/tools/build-managers/gn/default.nix +++ b/pkgs/development/tools/build-managers/gn/default.nix @@ -52,6 +52,8 @@ stdenv.mkDerivation rec { install -vD out/gn "$out/bin/gn" ''; + setupHook = ./setup-hook.sh; + meta = with lib; { description = "A meta-build system that generates NinjaBuild files"; homepage = https://gn.googlesource.com/gn; diff --git a/pkgs/development/tools/build-managers/gn/setup-hook.sh b/pkgs/development/tools/build-managers/gn/setup-hook.sh new file mode 100644 index 000000000000..75d2edcaf1c6 --- /dev/null +++ b/pkgs/development/tools/build-managers/gn/setup-hook.sh @@ -0,0 +1,14 @@ +gnConfigurePhase() { + runHook preConfigure + + echo "gn flags: $gnFlags ${gnFlagsArray[@]}" + + gn gen out/Release --args="$gnFlags ${gnFlagsArray[@]}" + cd out/Release/ + + runHook postConfigure +} + +if [ -z "$dontUseGnConfigure" -a -z "$configurePhase" ]; then + configurePhase=gnConfigurePhase +fi diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index 902d21040501..bc49a48778fc 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -3,7 +3,7 @@ , runtimeShell, callPackage , xcodePlatform ? stdenv.targetPlatform.xcodePlatform or "MacOSX" , xcodeVer ? stdenv.targetPlatform.xcodeVer or "9.4.1" -, sdkVer ? stdenv.targetPlatform.sdkVer or "10.10" }: +, sdkVer ? stdenv.targetPlatform.sdkVer or "10.12" }: let @@ -107,6 +107,9 @@ runCommand "xcodebuild-${xcbuild.version}" { ln -s ${platforms} $out/Platforms ln -s ${toolchains} $out/Toolchains + mkdir -p $out/Applications/Xcode.app/Contents + ln -s $out $out/Applications/Xcode.app/Contents/Developer + makeWrapper ${xcbuild}/bin/xcodebuild $out/bin/xcodebuild \ --add-flags "-xcconfig ${xcconfig}" \ --add-flags "DERIVED_DATA_DIR=." \ @@ -116,7 +119,7 @@ runCommand "xcodebuild-${xcbuild.version}" { --run '[ "$1" = "-license" ] && exit 0' substitute ${xcode-select} $out/bin/xcode-select \ - --subst-var-by DEVELOPER_DIR $out + --subst-var-by DEVELOPER_DIR $out/Applications/Xcode.app/Contents/Developer chmod +x $out/bin/xcode-select substitute ${xcrun} $out/bin/xcrun diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3af78b9f552d..6ca8f60bcb55 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5620,9 +5620,7 @@ in routino = callPackage ../tools/misc/routino { }; - rq = callPackage ../development/tools/rq { - v8 = v8.override { static = true; }; - }; + rq = callPackage ../development/tools/rq { }; rsnapshot = callPackage ../tools/backup/rsnapshot { }; @@ -8613,9 +8611,7 @@ in tcl-8_5 = callPackage ../development/interpreters/tcl/8.5.nix { }; tcl-8_6 = callPackage ../development/interpreters/tcl/8.6.nix { }; - proglodyte-wasm = callPackage ../development/interpreters/proglodyte-wasm { - v8_static = v8.override { static = true; }; - }; + proglodyte-wasm = callPackage ../development/interpreters/proglodyte-wasm { }; wasm-gc = callPackage ../development/interpreters/wasm-gc { }; @@ -13469,11 +13465,7 @@ in stdenv = if stdenv.isDarwin then stdenv else overrideCC stdenv gcc5; }; - v8_6_x = callPackage ../development/libraries/v8/6_x.nix { - inherit (python2Packages) python; - }; - - v8 = callPackage ../development/libraries/v8 ({ + v8_5_x = callPackage ../development/libraries/v8/5_x.nix ({ inherit (python2Packages) python gyp; icu = icu58; # v8-5.4.232 fails against icu4c-59.1 } // lib.optionalAttrs stdenv.isLinux { @@ -13481,6 +13473,14 @@ in stdenv = overrideCC stdenv gcc6; }); + v8_6_x = v8; + v8 = callPackage ../development/libraries/v8 { + inherit (python2Packages) python; + } // lib.optionalAttrs stdenv.isLinux { + # doesn't build with gcc7 + stdenv = overrideCC stdenv gcc6; + }; + vaapiIntel = callPackage ../development/libraries/vaapi-intel { }; vaapi-intel-hybrid = callPackage ../development/libraries/vaapi-intel-hybrid { }; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index ada3c2a5034c..3b8e40ea041b 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -82,9 +82,6 @@ in { busybox = super.busybox.override { enableStatic = true; }; - v8 = super.v8.override { - static = true; - }; libiberty = super.libiberty.override { staticBuild = true; };