2012-07-26 18:45:39 +00:00
|
|
|
{ stdenv, fetchsvn, gyp, readline, python, which }:
|
2012-01-18 20:32:23 +00:00
|
|
|
|
|
|
|
assert readline != null;
|
2010-11-22 14:23:06 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
system = stdenv.system;
|
2012-02-10 05:22:58 +00:00
|
|
|
arch = if system == "i686-linux" then "ia32" else if system == "x86_64-linux" || system == "x86_64-darwin" then "x64" else "";
|
2013-05-23 20:04:32 +00:00
|
|
|
version = "3.14.5.9";
|
2010-11-22 14:23:06 +00:00
|
|
|
in
|
2012-07-25 15:42:15 +00:00
|
|
|
|
2012-02-10 05:22:58 +00:00
|
|
|
assert arch != "";
|
2012-07-25 15:42:15 +00:00
|
|
|
|
2013-05-23 20:04:32 +00:00
|
|
|
stdenv.mkDerivation {
|
2012-01-18 20:32:23 +00:00
|
|
|
name = "v8-${version}";
|
2013-05-23 20:04:32 +00:00
|
|
|
|
2010-11-22 14:23:06 +00:00
|
|
|
src = fetchsvn {
|
2012-01-18 20:32:23 +00:00
|
|
|
url = "http://v8.googlecode.com/svn/tags/${version}";
|
2013-05-23 20:04:32 +00:00
|
|
|
sha256 = "18qp5qp5xrb6f00w01cklz358yrl54pks963f5rwvwz82d8sfyqr";
|
|
|
|
name = "v8-${version}-src";
|
2010-11-22 14:23:06 +00:00
|
|
|
};
|
2012-01-18 20:32:23 +00:00
|
|
|
|
2013-05-23 20:04:32 +00:00
|
|
|
patches = [ ./fix-GetLocalizedMessage-usage.patch ];
|
|
|
|
|
2012-07-25 15:42:15 +00:00
|
|
|
configurePhase = ''
|
|
|
|
mkdir build/gyp
|
|
|
|
ln -sv ${gyp}/bin/gyp build/gyp/gyp
|
2010-11-22 14:23:06 +00:00
|
|
|
'';
|
2012-01-18 20:32:23 +00:00
|
|
|
|
2013-08-27 14:16:11 +00:00
|
|
|
nativeBuildInputs = [ which ];
|
2012-07-25 15:42:15 +00:00
|
|
|
buildInputs = [ readline python ];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"library=shared"
|
|
|
|
"console=readline"
|
|
|
|
"${arch}.release"
|
|
|
|
];
|
|
|
|
|
2013-08-27 14:16:11 +00:00
|
|
|
# http://code.google.com/p/v8/issues/detail?id=2149
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-unused-local-typedefs -Wno-aggressive-loop-optimizations";
|
|
|
|
|
2012-07-25 15:42:15 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2010-11-22 14:23:06 +00:00
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/lib
|
2012-07-25 15:42:15 +00:00
|
|
|
mv -v out/${arch}.release/d8 $out/bin
|
2013-01-07 15:52:42 +00:00
|
|
|
|
|
|
|
${if stdenv.system == "x86_64-darwin" then
|
|
|
|
"mv -v out/${arch}.release/libv8.dylib $out/lib"
|
|
|
|
else
|
|
|
|
"mv -v out/${arch}.release/lib.target/libv8.so $out/lib"}
|
2012-07-25 15:42:15 +00:00
|
|
|
mv -v include $out/
|
2010-11-22 14:23:06 +00:00
|
|
|
'';
|
2013-05-28 22:28:25 +00: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-24 17:55:00 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "V8 is Google's open source JavaScript engine";
|
2013-10-08 09:05:19 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2013-08-24 17:55:00 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
2010-11-22 14:23:06 +00:00
|
|
|
}
|