2015-01-22 01:33:19 +00:00
|
|
|
{ stdenv, lib, fetchurl, gyp, readline, python, which, icu, utillinux}:
|
2014-08-09 20:55:31 +01:00
|
|
|
|
|
|
|
assert readline != null;
|
|
|
|
|
|
|
|
let
|
|
|
|
arch = if stdenv.is64bit then "x64" else "ia32";
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "v8-${version}";
|
|
|
|
version = "3.16.14";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://commondatastorage.googleapis.com/chromium-browser-official/"
|
|
|
|
+ "${name}.tar.bz2";
|
|
|
|
sha256 = "073f33zcb7205jp9g5ha5d7j2hfa98zs0jql572nb552z0xw3rkz";
|
|
|
|
};
|
|
|
|
|
|
|
|
configurePhase = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
ln -s /usr/bin/xcodebuild $TMPDIR
|
|
|
|
export PATH=$TMPDIR:$PATH
|
|
|
|
'' + ''
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ which ];
|
2015-01-22 01:33:19 +00:00
|
|
|
buildInputs = [ readline python icu ] ++ lib.optional stdenv.isLinux utillinux;
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error";
|
2014-08-09 20:55:31 +01:00
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"-C out"
|
|
|
|
"builddir=$(CURDIR)/Release"
|
|
|
|
"BUILDTYPE=Release"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -vD out/Release/d8 "$out/bin/d8"
|
|
|
|
${if stdenv.system == "x86_64-darwin" then ''
|
2015-01-22 01:33:19 +00:00
|
|
|
install -vD out/Release/lib.target/libv8.dylib "$out/lib/libv8.dylib"
|
2014-08-09 20:55:31 +01:00
|
|
|
'' else ''
|
2015-01-22 01:33:19 +00:00
|
|
|
install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so"
|
2014-08-09 20:55:31 +01:00
|
|
|
''}
|
|
|
|
cp -vr include "$out/"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = if stdenv.isDarwin then ''
|
2014-08-31 08:04:42 +01:00
|
|
|
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
|
2014-08-09 20:55:31 +01:00
|
|
|
'' else null;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "V8 is Google's open source JavaScript engine";
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
license = licenses.bsd3;
|
|
|
|
};
|
|
|
|
}
|