about summary refs log tree commit diff
path: root/pkgs/development/web/nodejs
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-12-11 14:01:19 -0500
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-12-11 14:01:19 -0500
commit07a8ae0c5a7daa0a6aa12c901ebc95013f122c85 (patch)
tree2e462acd400154007e8c7552d2a2dd1441d61032 /pkgs/development/web/nodejs
parent268f87011a2d1f344fb09dd594895c5807414079 (diff)
parentc71b1bb92cc57e74ef98fd2def486f5e82a12586 (diff)
downloadnixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.tar
nixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.tar.gz
nixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.tar.bz2
nixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.tar.lz
nixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.tar.xz
nixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.tar.zst
nixlib-07a8ae0c5a7daa0a6aa12c901ebc95013f122c85.zip
Merge branch 'staging-next' into staging
 Conflicts:
	pkgs/development/libraries/log4cplus/default.nix
Diffstat (limited to 'pkgs/development/web/nodejs')
-rw-r--r--pkgs/development/web/nodejs/nodejs.nix33
-rw-r--r--pkgs/development/web/nodejs/v16.nix12
-rw-r--r--pkgs/development/web/nodejs/v17.nix16
3 files changed, 55 insertions, 6 deletions
diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix
index 3f0f0e78e07a..56c83e38c4ff 100644
--- a/pkgs/development/web/nodejs/nodejs.nix
+++ b/pkgs/development/web/nodejs/nodejs.nix
@@ -58,6 +58,10 @@ let
     nativeBuildInputs = [ which pkg-config python ]
       ++ optionals stdenv.isDarwin [ xcbuild ];
 
+    outputs = [ "out" "libv8" ];
+    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 "./torque_*/**/*.o" -or -path "./v8*/**/*.o" | sort -u >files
+      ${if stdenv.buildPlatform.isGnu then ''
+        ar -cqs $libv8/lib/libv8.a @files
+      '' else ''
+        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
     '' + optionalString (stdenv.isDarwin && enableNpm) ''
       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
     '';
diff --git a/pkgs/development/web/nodejs/v16.nix b/pkgs/development/web/nodejs/v16.nix
index 6eff31e3b02a..a0c978169ae1 100644
--- a/pkgs/development/web/nodejs/v16.nix
+++ b/pkgs/development/web/nodejs/v16.nix
@@ -1,4 +1,4 @@
-{ callPackage, openssl, python3, enableNpm ? true }:
+{ callPackage, fetchpatch, openssl, python3, enableNpm ? true }:
 
 let
   buildNodejs = callPackage ./nodejs.nix {
@@ -10,5 +10,13 @@ in
     inherit enableNpm;
     version = "16.13.1";
     sha256 = "1bb3rjb2xxwn6f4grjsa7m1pycp0ad7y6vz7v2d7kbsysx7h08sc";
-    patches = [ ./disable-darwin-v8-system-instrumentation.patch ];
+    patches = [
+      ./disable-darwin-v8-system-instrumentation.patch
+      # Fixes node incorrectly building vendored OpenSSL when we want system OpenSSL.
+      # https://github.com/nodejs/node/pull/40965
+      (fetchpatch {
+        url = "https://github.com/nodejs/node/commit/65119a89586b94b0dd46b45f6d315c9d9f4c9261.patch";
+        sha256 = "sha256-dihKYEdK68sQIsnfTRambJ2oZr0htROVbNZlFzSAL+I=";
+      })
+    ];
   }
diff --git a/pkgs/development/web/nodejs/v17.nix b/pkgs/development/web/nodejs/v17.nix
index d1254ed48a29..38d5a12a712e 100644
--- a/pkgs/development/web/nodejs/v17.nix
+++ b/pkgs/development/web/nodejs/v17.nix
@@ -1,4 +1,4 @@
-{ callPackage, python3, enableNpm ? true }:
+{ callPackage, fetchpatch, python3, enableNpm ? true }:
 
 let
   buildNodejs = callPackage ./nodejs.nix {
@@ -7,7 +7,15 @@ let
 in
 buildNodejs {
   inherit enableNpm;
-  version = "17.1.0";
-  sha256 = "1iyazwpgv3pxqh7zz3s87qwrbahifrj9sj1a2vwhkc4jxcvkz03b";
-  patches = [ ./disable-darwin-v8-system-instrumentation.patch ];
+  version = "17.2.0";
+  sha256 = "16k5kqanfvsnickkrv0vz072qg4ddzrk4is56yvdg2f1brxwqirb";
+  patches = [
+    ./disable-darwin-v8-system-instrumentation.patch
+    # Fixes node incorrectly building vendored OpenSSL when we want system OpenSSL.
+    # https://github.com/nodejs/node/pull/40965
+    (fetchpatch {
+      url = "https://github.com/nodejs/node/commit/65119a89586b94b0dd46b45f6d315c9d9f4c9261.patch";
+      sha256 = "sha256-dihKYEdK68sQIsnfTRambJ2oZr0htROVbNZlFzSAL+I=";
+    })
+  ];
 }