@ -58,6 +58,10 @@ let
nativeBuildInputs = [ which pkg-config python ]
++ optionals stdenv . isDarwin [ xcbuild ] ;
outputs = [ " o u t " " l i b v 8 " ] ;
setOutputFlags = false ;
moveToDev = false ;
configureFlags = let
isCross = stdenv . hostPlatform != stdenv . buildPlatform ;
inherit ( stdenv . hostPlatform ) gcc isAarch32 ;
@ -130,6 +134,35 @@ let
# install the missing headers for node-gyp
cp - r $ { concatStringsSep " " copyLibHeaders } $ out/include/node
# assemble a static v8 library and put it in the 'libv8' output
mkdir - p $ libv8/lib
pushd out/Release/obj.target
find . - path " . / t o r q u e _ * / * * / * . o " - or - path " . / v 8 * / * * / * . o " | sort - u > files
$ { if stdenv . buildPlatform . isGnu then ''
ar - cqs $ libv8/lib/libv8.a @ files
'' e l s e ''
cat files | while read - r file ; do
ar - cqS $ libv8/lib/libv8.a $ file
done
'' }
popd
# copy v8 headers
cp - r deps/v8/include $ libv8 /
# create a pkgconfig file for v8
major = $ ( grep V8_MAJOR_VERSION deps/v8/include/v8-version.h | cut - d ' ' - f 3 )
minor = $ ( grep V8_MINOR_VERSION deps/v8/include/v8-version.h | cut - d ' ' - f 3 )
patch = $ ( grep V8_PATCH_LEVEL deps/v8/include/v8-version.h | cut - d ' ' - f 3 )
mkdir - p $ libv8/lib/pkgconfig
cat > $ libv8/lib/pkgconfig/v8.pc < < EOF
Name : v8
Description : V8 JavaScript Engine
Version : $ major . $ minor . $ patch
Libs : - L $ libv8/lib - lv8 - pthread - licui18n
Cflags : - I $ libv8/include
EOF
'' + o p t i o n a l S t r i n g ( s t d e n v . i s D a r w i n & & e n a b l e N p m ) ''
sed - i ' s/raise. * No Xcode or CLT version detected . * /version = " 7 . 0 . 0 " / ' $ out/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
'' ;