From 679398b160ccb36674b2b21ccf79896daf2d9f70 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 26 Nov 2021 13:39:50 +0100 Subject: nodejs: Provide a static v8 library output Since building nodejs also builds v8, one way to get a static v8 library is to manually assemble it from the leftover object files. This seems like an easier way to get an up-to-date v8 library than trying to keep the v8 package updated. --- pkgs/development/web/nodejs/nodejs.nix | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'pkgs/development/web/nodejs') 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 ''; -- cgit 1.4.1 From 15117c71e5b72cab46b33e911e9d7da7423aefaa Mon Sep 17 00:00:00 2001 From: Ivan Babrou Date: Wed, 8 Dec 2021 00:01:39 -0800 Subject: nodejs-17_x: fix darwin build by backporting an upstream patch --- pkgs/development/web/nodejs/v17.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pkgs/development/web/nodejs') diff --git a/pkgs/development/web/nodejs/v17.nix b/pkgs/development/web/nodejs/v17.nix index d1254ed48a29..ea04844662a3 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 { @@ -9,5 +9,13 @@ buildNodejs { inherit enableNpm; version = "17.1.0"; sha256 = "1iyazwpgv3pxqh7zz3s87qwrbahifrj9sj1a2vwhkc4jxcvkz03b"; - 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="; + }) + ]; } -- cgit 1.4.1 From 1a9e6682d2ae901f909e9739ff4f27812743f886 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Mon, 6 Dec 2021 12:50:22 +0000 Subject: nodejs-17_x: 17.1.0 -> 17.2.0 https://github.com/nodejs/node/releases/tag/v17.2.0 --- pkgs/development/web/nodejs/v17.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/web/nodejs') diff --git a/pkgs/development/web/nodejs/v17.nix b/pkgs/development/web/nodejs/v17.nix index ea04844662a3..38d5a12a712e 100644 --- a/pkgs/development/web/nodejs/v17.nix +++ b/pkgs/development/web/nodejs/v17.nix @@ -7,8 +7,8 @@ let in buildNodejs { inherit enableNpm; - version = "17.1.0"; - sha256 = "1iyazwpgv3pxqh7zz3s87qwrbahifrj9sj1a2vwhkc4jxcvkz03b"; + version = "17.2.0"; + sha256 = "16k5kqanfvsnickkrv0vz072qg4ddzrk4is56yvdg2f1brxwqirb"; patches = [ ./disable-darwin-v8-system-instrumentation.patch # Fixes node incorrectly building vendored OpenSSL when we want system OpenSSL. -- cgit 1.4.1 From f5fdf72a246b84abda6f199606dadd50a0f04655 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Fri, 10 Dec 2021 21:28:09 -0500 Subject: nodejs-16_x: fix build on darwin (#150037) --- pkgs/development/web/nodejs/v16.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pkgs/development/web/nodejs') 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="; + }) + ]; } -- cgit 1.4.1