From 781ed961eb47f869220a412c78bc32a163b5b5a5 Mon Sep 17 00:00:00 2001 From: Proglodyte Date: Sat, 23 Jul 2016 13:17:13 -0400 Subject: [PATCH] v8: use 4.5.107 by default Default v8 was fixed at 3.30.33, so running nix-build nixpkgs -A v8 would give us version 3.30.33, whereas nix-env -i v8 would install version 4.5.107. Now, both commands build 4.5.107, and there is still an option to install version 3.30.33 --- pkgs/development/libraries/v8/3.30.33.nix | 6 + pkgs/development/libraries/v8/4.5.nix | 145 --------------------- pkgs/development/libraries/v8/default.nix | 149 +++++++++++++++++++++- pkgs/top-level/all-packages.nix | 6 +- 4 files changed, 153 insertions(+), 153 deletions(-) create mode 100644 pkgs/development/libraries/v8/3.30.33.nix delete mode 100644 pkgs/development/libraries/v8/4.5.nix diff --git a/pkgs/development/libraries/v8/3.30.33.nix b/pkgs/development/libraries/v8/3.30.33.nix new file mode 100644 index 00000000000..6ae5c896efa --- /dev/null +++ b/pkgs/development/libraries/v8/3.30.33.nix @@ -0,0 +1,6 @@ +{ callPackage, ... } @ args: + +callPackage ./generic.nix (args // { + version = "3.30.33.16"; + sha256 = "1azf1b36gqj4z5x0k9wq2dkp99zfyhwb0d6i2cl5fjm3k6js7l45"; +}) diff --git a/pkgs/development/libraries/v8/4.5.nix b/pkgs/development/libraries/v8/4.5.nix deleted file mode 100644 index 655ccf1ccf3..00000000000 --- a/pkgs/development/libraries/v8/4.5.nix +++ /dev/null @@ -1,145 +0,0 @@ -{ stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu -, patchelf, coreutils -, doCheck ? false -}: - -assert readline != null; - -let - arch = if stdenv.isArm - then if stdenv.is64bit - then"arm64" - else "arm" - else if stdenv.is64bit - then"x64" - else "ia32"; - git_url = "https://chromium.googlesource.com"; - clangFlag = if stdenv.isDarwin then "1" else "0"; - - deps = { - "build/gyp" = fetchgit { - url = "${git_url}/external/gyp.git"; - rev = "5122240c5e5c4d8da12c543d82b03d6089eb77c5"; - sha256 = "0mdrrhmfl4jrdmfrxmg7ywhdf9c7gv2x08fiq955fs9z8kvxqgdx"; - }; - "third_party/icu" = fetchgit { - url = "${git_url}/chromium/deps/icu.git"; - rev = "c81a1a3989c3b66fa323e9a6ee7418d7c08297af"; - sha256 = "0xrhig85vpw9hqjrhkxsr69m2xnig2bwmjhylzffrwz0783l7yhw"; - }; - "buildtools" = fetchgit { - url = "${git_url}/chromium/buildtools.git"; - rev = "ecc8e253abac3b6186a97573871a084f4c0ca3ae"; - sha256 = "1ccfnj3dp4i0z2bj09zy8aa4x749id6h058qa330li368417jwci"; - }; - "testing/gtest" = fetchgit { - url = "${git_url}/external/googletest.git"; - rev = "23574bf2333f834ff665f894c97bef8a5b33a0a9"; - sha256 = "1scyrk8d6xrsqma27q0wdrxqfa2n12k8mi9lfbsm5ivim9sr1d75"; - }; - "testing/gmock" = fetchgit { - url = "${git_url}/external/googlemock.git"; - rev = "29763965ab52f24565299976b936d1265cb6a271"; - sha256 = "0n2ajjac7myr5bgqk0x7j8281b4whkzgr1irv5nji9n3xz5i6gz4"; - }; - "tools/clang" = fetchgit { - url = "${git_url}/chromium/src/tools/clang.git"; - rev = "73ec8804ed395b0886d6edf82a9f33583f4a7902"; - sha256 = "0p2w4cgj3d4lqa8arss3j86lk0g8zhbbn5pzlcrhy5pl4xphjbk3"; - }; - }; - -in - -stdenv.mkDerivation rec { - name = "v8-${version}"; - version = "4.5.107"; - - inherit doCheck; - - src = fetchFromGitHub { - owner = "v8"; - repo = "v8"; - rev = version; - sha256 = "0wbzi4rhm4ygsm1k4x0vwfm42z3j8ww6wz7bcvd0m7mqzayn0bw4"; - }; - - postUnpack = '' - ${lib.concatStringsSep "\n" ( - lib.mapAttrsToList (n: v: '' - mkdir -p $sourceRoot/${n} - cp -r ${v}/* $sourceRoot/${n} - '') deps)} - ''; - - # Patches pulled from: - # https://github.com/cowboyd/libv8/tree/4.5/patches - patches = lib.optional (!doCheck) ./disable-building-tests.patch ++ [ - ./fPIC-for-static.patch - ./build-standalone-static-library.patch - ]; - - postPatch = '' - sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' build/gyp_v8 - sed -i 's,/bin/echo,${coreutils}/bin/echo,' build/standalone.gypi - sed -i '/CR_CLANG_REVISION/ d' build/standalone.gypi - sed -i 's/-Wno-format-pedantic//g' build/standalone.gypi - ''; - - configurePhase = '' - PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \ - PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \ - build/gyp_v8 \ - -f make \ - --generator-output="out" \ - -Dflock_index=0 \ - -Dclang=${clangFlag} \ - -Dv8_enable_i18n_support=1 \ - -Duse_system_icu=1 \ - -Dcomponent=shared_library \ - -Dconsole=readline \ - -Dv8_target_arch=${arch} \ - -Dv8_use_external_startup_data=0 - ''; - - nativeBuildInputs = [ which ]; - buildInputs = [ readline python icu patchelf ]; - - NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow"; - - buildFlags = [ - "LINK=g++" - "-C out" - "builddir=$(CURDIR)/Release" - "BUILDTYPE=Release" - ]; - - enableParallelBuilding = true; - - # 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 stdenv.isDarwin then '' - install -vD out/Release/lib.target/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" - 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; - license = licenses.bsd3; - }; -} diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix index 6ae5c896efa..655ccf1ccf3 100644 --- a/pkgs/development/libraries/v8/default.nix +++ b/pkgs/development/libraries/v8/default.nix @@ -1,6 +1,145 @@ -{ callPackage, ... } @ args: +{ stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu +, patchelf, coreutils +, doCheck ? false +}: -callPackage ./generic.nix (args // { - version = "3.30.33.16"; - sha256 = "1azf1b36gqj4z5x0k9wq2dkp99zfyhwb0d6i2cl5fjm3k6js7l45"; -}) +assert readline != null; + +let + arch = if stdenv.isArm + then if stdenv.is64bit + then"arm64" + else "arm" + else if stdenv.is64bit + then"x64" + else "ia32"; + git_url = "https://chromium.googlesource.com"; + clangFlag = if stdenv.isDarwin then "1" else "0"; + + deps = { + "build/gyp" = fetchgit { + url = "${git_url}/external/gyp.git"; + rev = "5122240c5e5c4d8da12c543d82b03d6089eb77c5"; + sha256 = "0mdrrhmfl4jrdmfrxmg7ywhdf9c7gv2x08fiq955fs9z8kvxqgdx"; + }; + "third_party/icu" = fetchgit { + url = "${git_url}/chromium/deps/icu.git"; + rev = "c81a1a3989c3b66fa323e9a6ee7418d7c08297af"; + sha256 = "0xrhig85vpw9hqjrhkxsr69m2xnig2bwmjhylzffrwz0783l7yhw"; + }; + "buildtools" = fetchgit { + url = "${git_url}/chromium/buildtools.git"; + rev = "ecc8e253abac3b6186a97573871a084f4c0ca3ae"; + sha256 = "1ccfnj3dp4i0z2bj09zy8aa4x749id6h058qa330li368417jwci"; + }; + "testing/gtest" = fetchgit { + url = "${git_url}/external/googletest.git"; + rev = "23574bf2333f834ff665f894c97bef8a5b33a0a9"; + sha256 = "1scyrk8d6xrsqma27q0wdrxqfa2n12k8mi9lfbsm5ivim9sr1d75"; + }; + "testing/gmock" = fetchgit { + url = "${git_url}/external/googlemock.git"; + rev = "29763965ab52f24565299976b936d1265cb6a271"; + sha256 = "0n2ajjac7myr5bgqk0x7j8281b4whkzgr1irv5nji9n3xz5i6gz4"; + }; + "tools/clang" = fetchgit { + url = "${git_url}/chromium/src/tools/clang.git"; + rev = "73ec8804ed395b0886d6edf82a9f33583f4a7902"; + sha256 = "0p2w4cgj3d4lqa8arss3j86lk0g8zhbbn5pzlcrhy5pl4xphjbk3"; + }; + }; + +in + +stdenv.mkDerivation rec { + name = "v8-${version}"; + version = "4.5.107"; + + inherit doCheck; + + src = fetchFromGitHub { + owner = "v8"; + repo = "v8"; + rev = version; + sha256 = "0wbzi4rhm4ygsm1k4x0vwfm42z3j8ww6wz7bcvd0m7mqzayn0bw4"; + }; + + postUnpack = '' + ${lib.concatStringsSep "\n" ( + lib.mapAttrsToList (n: v: '' + mkdir -p $sourceRoot/${n} + cp -r ${v}/* $sourceRoot/${n} + '') deps)} + ''; + + # Patches pulled from: + # https://github.com/cowboyd/libv8/tree/4.5/patches + patches = lib.optional (!doCheck) ./disable-building-tests.patch ++ [ + ./fPIC-for-static.patch + ./build-standalone-static-library.patch + ]; + + postPatch = '' + sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' build/gyp_v8 + sed -i 's,/bin/echo,${coreutils}/bin/echo,' build/standalone.gypi + sed -i '/CR_CLANG_REVISION/ d' build/standalone.gypi + sed -i 's/-Wno-format-pedantic//g' build/standalone.gypi + ''; + + configurePhase = '' + PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \ + PYTHONPATH="$(toPythonPath ${gyp}):$PYTHONPATH" \ + build/gyp_v8 \ + -f make \ + --generator-output="out" \ + -Dflock_index=0 \ + -Dclang=${clangFlag} \ + -Dv8_enable_i18n_support=1 \ + -Duse_system_icu=1 \ + -Dcomponent=shared_library \ + -Dconsole=readline \ + -Dv8_target_arch=${arch} \ + -Dv8_use_external_startup_data=0 + ''; + + nativeBuildInputs = [ which ]; + buildInputs = [ readline python icu patchelf ]; + + NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow"; + + buildFlags = [ + "LINK=g++" + "-C out" + "builddir=$(CURDIR)/Release" + "BUILDTYPE=Release" + ]; + + enableParallelBuilding = true; + + # 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 stdenv.isDarwin then '' + install -vD out/Release/lib.target/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" + 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; + license = licenses.bsd3; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11c15d81357..cdad4abe6ac 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6400,9 +6400,9 @@ in gob2 = callPackage ../development/tools/misc/gob2 { }; gocd-agent = callPackage ../development/tools/continuous-integration/gocd-agent { }; - + gocd-server = callPackage ../development/tools/continuous-integration/gocd-server { }; - + gotty = callPackage ../servers/gotty { }; gradleGen = callPackage ../development/tools/build-managers/gradle { }; @@ -9531,7 +9531,7 @@ in inherit (pythonPackages) gyp; }; - v8_4_5 = callPackage ../development/libraries/v8/4.5.nix { + v8_3_30_33 = callPackage ../development/libraries/v8/3.30.33.nix { inherit (pythonPackages) gyp; };