diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/v8')
10 files changed, 944 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/v8/3.14.nix b/nixpkgs/pkgs/development/libraries/v8/3.14.nix new file mode 100644 index 000000000000..827274251ed9 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/3.14.nix @@ -0,0 +1,86 @@ +# This old version of V8 is still needed for the R V8 module +{ stdenv, fetchFromGitHub, gyp, readline, python, which, icu, ... }: + +assert readline != null; + +with stdenv.lib; +let + version = "3.14.5.10"; + sha256 = "08vhl84166x13b3cbx8y0g99yqx772zd33gawsa1nxqkyrykql6k"; + + arch = if stdenv.is64bit then "x64" else "ia32"; + +in +stdenv.mkDerivation rec { + name = "v8-${version}"; + inherit version; + + src = fetchFromGitHub { + owner = "v8"; + repo = "v8"; + rev = "${version}"; + inherit sha256; + }; + patchPhase = '' + sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' build/gyp_v8 + sed -i 's,#!/usr/bin/python,#!${python}/bin/python,' build/gyp_v8 + ''; + + configurePhase = '' + PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \ + PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \ + build/gyp_v8 \ + -f make \ + --generator-output="out" \ + -Dflock_index=0 \ + -Dv8_enable_i18n_support=1 \ + -Duse_system_icu=1 \ + -Dconsole=readline \ + -Dcomponent=shared_library \ + -Dv8_target_arch=${arch} + ''; + + nativeBuildInputs = [ which ]; + buildInputs = [ readline python icu ]; + + # http://code.google.com/p/v8/issues/detail?id=2149 + NIX_CFLAGS_COMPILE = concatStringsSep " " [ + "-Wno-error=strict-overflow" + "-Wno-unused-local-typedefs" + "-Wno-aggressive-loop-optimizations" + ]; + + buildFlags = [ + "LINK=g++" + "-C out" + "builddir=$(CURDIR)/Release" + "BUILDTYPE=Release" + ]; + + postPatch = stdenv.lib.optionalString (!stdenv.cc.isClang) '' + sed -i build/standalone.gyp -e 's,-Wno-format-pedantic,,g' + ''; + + enableParallelBuilding = true; + + installPhase = '' + install -vD out/Release/d8 "$out/bin/d8" + ${if stdenv.hostPlatform.system == "x86_64-darwin" then '' + install -vD out/Release/lib.target/libv8.dylib "$out/lib/libv8.dylib" + '' else '' + install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so" + ''} + cp -vr include "$out/" + ''; + + postFixup = if stdenv.isDarwin then '' + 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 null; + + meta = with stdenv.lib; { + description = "Google's open source JavaScript engine"; + platforms = platforms.linux; + license = licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/v8/3.16.14.nix b/nixpkgs/pkgs/development/libraries/v8/3.16.14.nix new file mode 100644 index 000000000000..a7dddd141246 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/3.16.14.nix @@ -0,0 +1,81 @@ +{ stdenv, lib, fetchurl, gyp, readline, python, which, icu, utillinux, cctools }: + +assert readline != null; + +let + arch = if stdenv.isAarch32 + then (if stdenv.is64bit then "arm64" else "arm") + else (if stdenv.is64bit then "x64" else "ia32"); + armHardFloat = stdenv.isAarch32 && (stdenv.hostPlatform.platform.gcc.float or null) == "hard"; +in + +stdenv.mkDerivation rec { + name = "v8-${version}"; + version = "3.16.14.11"; + + src = fetchurl { + url = "https://commondatastorage.googleapis.com/chromium-browser-official/" + + "${name}.tar.bz2"; + sha256 = "1gpf2xvhxfs5ll3m2jlslsx9jfjbmrbz55iq362plflrvf8mbxhj"; + }; + + postPatch = '' + sed -i 's/-Werror//' build/standalone.gypi build/common.gypi + ''; + + configurePhase = stdenv.lib.optionalString stdenv.isDarwin '' + export GYP_DEFINES="mac_deployment_target=$MACOSX_DEPLOYMENT_TARGET" + '' + '' + PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \ + ${gyp}/bin/gyp \ + -f make \ + --generator-output="out" \ + -Dflock_index=0 \ + -Dv8_enable_i18n_support=1 \ + -Duse_system_icu=1 \ + -Dconsole=readline \ + -Dcomponent=shared_library \ + -Dv8_target_arch=${arch} \ + ${lib.optionalString armHardFloat "-Dv8_use_arm_eabi_hardfloat=true"} \ + --depth=. -Ibuild/standalone.gypi \ + build/all.gyp + '' + stdenv.lib.optionalString stdenv.isDarwin '' + sed -i 's@/usr/bin/env python@${python}/bin/python@g' out/gyp-mac-tool + ''; + + nativeBuildInputs = [ which ]; + buildInputs = [ readline python icu ] + ++ lib.optional stdenv.isLinux utillinux + ++ lib.optional stdenv.isDarwin cctools; + + NIX_CFLAGS_COMPILE = "-Wno-error -w"; + + buildFlags = [ + "-C out" + "builddir=$(CURDIR)/Release" + "BUILDTYPE=Release" + ]; + + enableParallelBuilding = true; + + installPhase = '' + install -vD out/Release/d8 "$out/bin/d8" + ${if stdenv.isDarwin then '' + install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib" + '' else '' + install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so" + ''} + cp -vr include "$out/" + ''; + + postFixup = if stdenv.isDarwin then '' + install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib $out/bin/d8 + install_name_tool -id $out/lib/libv8.dylib $out/lib/libv8.dylib + '' else null; + + meta = with stdenv.lib; { + description = "V8 is Google's open source JavaScript engine"; + platforms = platforms.linux ++ platforms.darwin; + license = licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/v8/6_x.nix b/nixpkgs/pkgs/development/libraries/v8/6_x.nix new file mode 100644 index 000000000000..85d0c0d91bb5 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/6_x.nix @@ -0,0 +1,193 @@ +{ 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/nixpkgs/pkgs/development/libraries/v8/build-standalone-static-library.patch b/nixpkgs/pkgs/development/libraries/v8/build-standalone-static-library.patch new file mode 100644 index 000000000000..994c322429d1 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/build-standalone-static-library.patch @@ -0,0 +1,14 @@ +diff --git a/build/standalone.gypi b/build/standalone.gypi +index b6519c4..ef9e7c5 100644 +--- a/build/standalone.gypi ++++ b/build/standalone.gypi +@@ -373,6 +373,9 @@ + }], + ], + 'target_conditions': [ ++ ['_type=="static_library"', { ++ 'standalone_static_library': 1, ++ }], + ['v8_code == 0', { + 'defines!': [ + 'DEBUG', diff --git a/nixpkgs/pkgs/development/libraries/v8/default.nix b/nixpkgs/pkgs/development/libraries/v8/default.nix new file mode 100644 index 000000000000..2b9fa5cc04c0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/default.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/nixpkgs/pkgs/development/libraries/v8/disable-building-tests.patch b/nixpkgs/pkgs/development/libraries/v8/disable-building-tests.patch new file mode 100644 index 000000000000..1854a9b7e567 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/disable-building-tests.patch @@ -0,0 +1,27 @@ +diff --git a/Makefile b/Makefile +index 9761265..80169b2 100644 +--- a/Makefile ++++ b/Makefile +@@ -248,8 +248,6 @@ NACL_ARCHES = nacl_ia32 nacl_x64 + GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \ + build/shim_headers.gypi build/features.gypi build/standalone.gypi \ + build/toolchain.gypi build/all.gyp build/mac/asan.gyp \ +- test/cctest/cctest.gyp \ +- test/unittests/unittests.gyp tools/gyp/v8.gyp \ + tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \ + buildtools/third_party/libc++abi/libc++abi.gyp \ + buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \ +diff --git a/build/all.gyp b/build/all.gyp +index 4aeb507..1ff2c7a 100644 +--- a/build/all.gyp ++++ b/build/all.gyp +@@ -10,8 +10,6 @@ + 'dependencies': [ + '../samples/samples.gyp:*', + '../src/d8.gyp:d8', +- '../test/cctest/cctest.gyp:*', +- '../test/unittests/unittests.gyp:*', + ], + 'conditions': [ + ['component!="shared_library"', { + diff --git a/nixpkgs/pkgs/development/libraries/v8/fPIC-for-static.patch b/nixpkgs/pkgs/development/libraries/v8/fPIC-for-static.patch new file mode 100644 index 000000000000..39564772af86 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/fPIC-for-static.patch @@ -0,0 +1,13 @@ +diff --git a/build/standalone.gypi b/build/standalone.gypi +index 7670e5b..230518c 100644 +--- a/build/standalone.gypi ++++ b/build/standalone.gypi +@@ -205,7 +205,7 @@ + [ 'visibility=="hidden" and v8_enable_backtrace==0', { + 'cflags': [ '-fvisibility=hidden' ], + }], +- [ 'component=="shared_library"', { ++ [ 'component=="shared_library" or component=="static_library" and (v8_target_arch=="x64" or v8_target_arch=="arm64")', { + 'cflags': [ '-fPIC', ], + }], + ], diff --git a/nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch b/nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch new file mode 100644 index 000000000000..16c227cfe38d --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/libv8-5.4.232.patch @@ -0,0 +1,97 @@ +From c9f42d1314c6026efcfcc01824f4e2fdfd05ebcf Mon Sep 17 00:00:00 2001 +From: Ben Sklaroff <bsklaroff@gmail.com> +Date: Sat, 23 Jul 2016 18:16:55 -0400 +Subject: [PATCH] libv8-5.4.232 + +--- + Makefile | 5 +---- + gypfiles/all.gyp | 32 -------------------------------- + gypfiles/standalone.gypi | 5 ++++- + 3 files changed, 5 insertions(+), 37 deletions(-) + +diff --git a/Makefile b/Makefile +index 5ea5c58..d1b2d73 100644 +--- a/Makefile ++++ b/Makefile +@@ -261,11 +261,8 @@ GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \ + gypfiles/shim_headers.gypi gypfiles/features.gypi \ + gypfiles/standalone.gypi \ + gypfiles/toolchain.gypi gypfiles/all.gyp gypfiles/mac/asan.gyp \ +- test/cctest/cctest.gyp test/fuzzer/fuzzer.gyp \ +- test/unittests/unittests.gyp src/v8.gyp \ +- tools/parser-shell.gyp testing/gmock.gyp testing/gtest.gyp \ + buildtools/third_party/libc++abi/libc++abi.gyp \ +- buildtools/third_party/libc++/libc++.gyp samples/samples.gyp \ ++ buildtools/third_party/libc++/libc++.gyp \ + src/third_party/vtune/v8vtune.gyp src/d8.gyp + + # If vtunejit=on, the v8vtune.gyp will be appended. +diff --git a/gypfiles/all.gyp b/gypfiles/all.gyp +index ff1bea4..96820a0 100644 +--- a/gypfiles/all.gyp ++++ b/gypfiles/all.gyp +@@ -16,38 +16,6 @@ + '../tools/parser-shell.gyp:parser-shell', + ], + }], +- # These items don't compile for Android on Mac. +- ['host_os!="mac" or OS!="android"', { +- 'dependencies': [ +- '../samples/samples.gyp:*', +- '../test/cctest/cctest.gyp:*', +- '../test/fuzzer/fuzzer.gyp:*', +- '../test/unittests/unittests.gyp:*', +- ], +- }], +- ['test_isolation_mode != "noop"', { +- 'dependencies': [ +- '../test/bot_default.gyp:*', +- '../test/benchmarks/benchmarks.gyp:*', +- '../test/default.gyp:*', +- '../test/ignition.gyp:*', +- '../test/intl/intl.gyp:*', +- '../test/message/message.gyp:*', +- '../test/mjsunit/mjsunit.gyp:*', +- '../test/mozilla/mozilla.gyp:*', +- '../test/optimize_for_size.gyp:*', +- '../test/perf.gyp:*', +- '../test/preparser/preparser.gyp:*', +- '../test/simdjs/simdjs.gyp:*', +- '../test/test262/test262.gyp:*', +- '../test/webkit/webkit.gyp:*', +- '../tools/check-static-initializers.gyp:*', +- '../tools/gcmole/run_gcmole.gyp:*', +- '../tools/jsfunfuzz/jsfunfuzz.gyp:*', +- '../tools/run-deopt-fuzzer.gyp:*', +- '../tools/run-valgrind.gyp:*', +- ], +- }], + ] + } + ] +diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi +index 89f06a0..a43976d 100644 +--- a/gypfiles/standalone.gypi ++++ b/gypfiles/standalone.gypi +@@ -506,6 +506,9 @@ + }], # fastbuild!=0 + ], + 'target_conditions': [ ++ ['_type=="static_library"', { ++ 'standalone_static_library': 1, ++ }], + ['v8_code == 0', { + 'defines!': [ + 'DEBUG', +@@ -770,7 +773,7 @@ + [ 'visibility=="hidden" and v8_enable_backtrace==0', { + 'cflags': [ '-fvisibility=hidden' ], + }], +- [ 'component=="shared_library"', { ++ [ 'component=="shared_library" or component=="static_library" and (v8_target_arch=="x64" or v8_target_arch=="arm64" or v8_target_arch=="arm")', { + 'cflags': [ '-fPIC', ], + }], + [ 'clang==0 and coverage==1', { +-- +2.9.0 + diff --git a/nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix b/nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix new file mode 100644 index 000000000000..8d2276def705 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/plv8_6_x.nix @@ -0,0 +1,187 @@ +# NOTE: this expression is NOT exported from the top-level of all-packages.nix, +# it is exclusively used by the 'plv8' PostgreSQL extension, which requires a +# very exact version. + +{ 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 = "0e9a47d74970bee1bbfc063c47215406f8918699"; + sha256 = "07rbzrlscp8adh4z86yl5jxdnvgkc3xs950xldpk318wf9i3bh6c"; + }; + "build" = fetchgit { + url = "${git_url}/chromium/src/build.git"; + rev = "9338ce52d0b9bcef34c38285fbd5023b62739fac"; + sha256 = "1s2sa8dy3waidsirjylc82ggb18l1108bczjc8z0v4ywyj4k0cvh"; + }; + "buildtools" = fetchgit { + url = "${git_url}/chromium/buildtools.git"; + rev = "505de88083136eefd056e5ee4ca0f01fe9b33de8"; + sha256 = "0vj216nhb803bggsl0hnyagj8njrm96pn8sim6xcnqb7nhz1vabw"; + }; + "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 = "5d4c667b271a9b39d0de73aef5ffe6879c6f8811"; + sha256 = "0q9iwb2nkybf9np95wgf5m372aw2lhx9wlsw41a2a80kbkvb2kqg"; + }; + "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 = "a7e226a92e660a3d5413cfea4269824f513259d2"; + sha256 = "0z3aybj3ykajwh2bv5fwd6pwqjjsq8dnwrqc2wncb6r9xcjwbgxp"; + }; + "testing/gtest" = fetchgit { + url = "${git_url}/external/github.com/google/googletest.git"; + rev = "6f8a66431cb592dad629028a50b3dd418a408c87"; + sha256 = "0bdba2lr6pg15bla9600zg0r0vm4lnrx0wqz84p376wfdxra24vw"; + }; + "third_party/icu" = fetchgit { + url = "${git_url}/chromium/deps/icu.git"; + rev = "741688ebf328da9adc52505248bf4e2ef868722c"; + sha256 = "02ifm18qjlrkn5nm2rxkf9yz9bdlyq7c65jfjndv63vi1drqh1r9"; + }; + "third_party/instrumented_libraries" = fetchgit { + url = "${git_url}/chromium/src/third_party/instrumented_libraries.git"; + rev = "28417458ac4dc79f68915079d0f283f682504cc0"; + sha256 = "1qf5c2946n37p843yriv7xawi6ss6samabghq43s49cgd4wq8dc3"; + }; + "third_party/jinja2" = fetchgit { + url = "${git_url}/chromium/src/third_party/jinja2.git"; + rev = "d34383206fa42d52faa10bb9931d6d538f3a57e0"; + sha256 = "0d9hyw0bvp3p0dbwy833cm9vdqxcam0qbm9jc561ynphddxlkmgd"; + }; + "third_party/markupsafe" = fetchgit { + url = "${git_url}/chromium/src/third_party/markupsafe.git"; + rev = "8f45f5cfa0009d2a70589bcda0349b8cb2b72783"; + sha256 = "168ppjmicfdh4i1l0l25s86mdbrz9fgxmiq1rx33x79mph41scfz"; + }; + "tools/clang" = fetchgit { + url = "${git_url}/chromium/src/tools/clang.git"; + rev = "8688d267571de76a56746324dcc249bf4232b85a"; + sha256 = "0krq4zz1vnwp064bm517gwr2napy18wyccdh8w5s4qgkjwwxd63s"; + }; + "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 = "45a8a51fda92e123619a69e7644d9c64a320b0c1"; + sha256 = "0r7736gqk7r0i7ig0b5ib10d9q8a8xzsmc0f0fbkm9k78v847vpj"; + }; + "tools/swarming_client" = fetchgit { + url = "${git_url}/infra/luci/client-py.git"; + rev = "4bd9152f8a975d57c972c071dfb4ddf668e02200"; + sha256 = "03zk91gzvqv01g1vbl8d7h8al7vs4ymrrdc8ipg9wpq52yh65smh"; + }; + }; + +in + +stdenv.mkDerivation rec { + name = "v8-${version}"; + version = "6.4.388.40"; + + inherit doCheck; + + src = fetchFromGitHub { + owner = "v8"; + repo = "v8"; + rev = version; + sha256 = "1lq239cgqyidrynz8g3wbdv70ymzv6s0ppad8s219gb3jnizm16a"; + }; + + 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/nixpkgs/pkgs/development/libraries/v8/update.sh b/nixpkgs/pkgs/development/libraries/v8/update.sh new file mode 100755 index 000000000000..f046bb8e6885 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/v8/update.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash -p curl -p nix-prefetch-git +VERSION_OVERVIEW=https://omahaproxy.appspot.com/all?os=linux +TARGET_CHANNEL=beta +FILE_PATH=6_x.nix + +set -eo pipefail + +v8_version=$(curl -s "$VERSION_OVERVIEW" | awk -F "," "\$2 ~ /${TARGET_CHANNEL}/ { print \$11 }") + +echo "Using V8 version --> $v8_version" +sed -e "s#\\(version = \\)\"[0-9\.]*\"#\1\"$v8_version\"#" -i ${FILE_PATH} + +sha256=$(nix-prefetch-git --no-deepClone https://github.com/v8/v8.git "refs/tags/${v8_version}" \ + | sed -ne '/sha256/ { s#.*: "\(.*\)".*#\1#; p }') +sed -e "/repo = \"v8\"/ { n;n; s#\".*\"#\"${sha256}\"# }" -i ${FILE_PATH} + +deps="$(mktemp)" + +curl -s -o "$deps" "https://raw.githubusercontent.com/v8/v8/${v8_version}/DEPS" +echo $deps + +sed -ne '/= fetchgit {/ { s/.*"\(.*\)".*/\1/; p }' < ${FILE_PATH} | while read dep; do + echo "Processing dependency --> $dep" + escaped_dep=$(echo "$dep" | sed -e 's#/#\\/#g') + dep_rev=$(sed -ne "/\"v8\/${escaped_dep}\":/ { n; s#.*+ \"##; s#\".*##; p }" "$deps") + + if [ "$dep_rev" = "" ]; then + echo "Failed to resolve dependency $dep, not listed in DEPS file" + rm -f "$deps" + exit 2 + fi + + repo_url=$(sed -ne "/\"${escaped_dep}\" = fetchgit/ { n; s/.*\"\(.*\)\".*/\1/; s#\${git_url}#https://chromium.googlesource.com#; p }" ${FILE_PATH}) + sha256=$(nix-prefetch-git --no-deepClone "$repo_url" "$dep_rev" 2>/dev/null | sed -ne '/sha256/ { s#.*: "\(.*\)".*#\1#; p }') + + if [ "$sha256" = "" ]; then + echo "Failed to get sha256 via nix-prefetch-git $repo_url $dep_rev" + rm -f "$deps" + exit 2 + fi + + sed -e "/\"${escaped_dep}\" = fetchgit/ { n; n; s/\".*\"/\"${dep_rev}\"/; n; s/\".*\"/\"${sha256}\"/ }" -i ${FILE_PATH} +done + +rm -f "$deps" +echo done. |