2014-03-17 22:03:06 +01:00
|
|
|
{ stdenv, fetchurl, gyp, readline, python, which, icu }:
|
2012-01-18 21:32:23 +01:00
|
|
|
|
|
|
|
assert readline != null;
|
2010-11-22 15:23:06 +01:00
|
|
|
|
|
|
|
let
|
2014-03-17 22:03:06 +01:00
|
|
|
arch = if stdenv.is64bit then "x64" else "ia32";
|
2010-11-22 15:23:06 +01:00
|
|
|
in
|
2012-07-25 17:42:15 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "v8-${version}";
|
|
|
|
version = "3.25.9";
|
2012-07-25 17:42:15 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://commondatastorage.googleapis.com/chromium-browser-official/"
|
|
|
|
+ "${name}.tar.bz2";
|
|
|
|
sha256 = "0x6czv99dr701vljyb4ghyhhc5rmv7vfkpvigcnrqz2an9q1pc28";
|
|
|
|
};
|
2013-05-23 22:04:32 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
configurePhase = ''
|
|
|
|
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} \
|
|
|
|
--depth=. -Ibuild/standalone.gypi \
|
|
|
|
build/all.gyp
|
|
|
|
'';
|
2012-01-18 21:32:23 +01:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
nativeBuildInputs = [ which ];
|
|
|
|
buildInputs = [ readline python icu ];
|
2013-05-23 22:04:32 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
buildFlags = [
|
|
|
|
"LINK=g++"
|
|
|
|
"-C out"
|
|
|
|
"builddir=$(CURDIR)/Release"
|
|
|
|
"BUILDTYPE=Release"
|
|
|
|
];
|
2012-01-18 21:32:23 +01:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
enableParallelBuilding = true;
|
2012-07-25 17:42:15 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
installPhase = ''
|
|
|
|
install -vD out/Release/d8 "$out/bin/d8"
|
|
|
|
${if stdenv.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/"
|
|
|
|
'';
|
2012-07-25 17:42:15 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
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.gcc.gcc}/lib/libgcc_s.1.dylib $out/bin/d8
|
|
|
|
install_name_tool -id $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.gcc.gcc}/lib/libgcc_s.1.dylib $out/lib/libv8.dylib
|
|
|
|
'' else null;
|
2013-08-27 16:16:11 +02:00
|
|
|
|
2014-03-17 22:03:06 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "V8 is Google's open source JavaScript engine";
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
2010-11-22 15:23:06 +01:00
|
|
|
}
|