From 52d52e7f0c12e529af1b69376058f9e128384564 Mon Sep 17 00:00:00 2001 From: Proglodyte Date: Sat, 23 Jul 2016 19:38:24 -0400 Subject: [PATCH] v8: add static config option Add the 'static' argument to the v8 package, which allows building the package as a static library rather than a shared library. This allows users to pass additional arguments to d8: https://github.com/joestelmach/lint.vim/issues/10 --- pkgs/development/libraries/v8/default.nix | 8 ++++++-- pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix index 09e1c951240..2c6e818b4e1 100644 --- a/pkgs/development/libraries/v8/default.nix +++ b/pkgs/development/libraries/v8/default.nix @@ -1,6 +1,7 @@ { stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu , patchelf, coreutils , doCheck ? false +, static ? false }: assert readline != null; @@ -15,6 +16,7 @@ let else "ia32"; 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 { @@ -143,7 +145,7 @@ stdenv.mkDerivation rec { -Dclang=${clangFlag} \ -Dv8_enable_i18n_support=1 \ -Duse_system_icu=1 \ - -Dcomponent=shared_library \ + -Dcomponent=${sharedFlag} \ -Dconsole=readline \ -Dv8_target_arch=${arch} \ -Dv8_use_external_startup_data=0 @@ -170,7 +172,8 @@ stdenv.mkDerivation rec { installPhase = '' install -vD out/Release/d8 "$out/bin/d8" install -vD out/Release/mksnapshot "$out/bin/mksnapshot" - ${if stdenv.isDarwin then '' + ${if static then "" + else 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 @@ -180,6 +183,7 @@ stdenv.mkDerivation rec { 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" ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e29f3733ec9..646052c61c7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9554,6 +9554,8 @@ in inherit (pythonPackages) gyp; }; + v8_static = lowPrio (self.v8.override { static = true; }); + vaapiIntel = callPackage ../development/libraries/vaapi-intel { libva = libva-full; # also wants libva-{x11,drm,wayland} };