From 2998b31b02770f801e43614ac3c42a4fd4412863 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Fri, 30 Sep 2022 12:30:03 -0400 Subject: [PATCH] nodejs: add back newer bypass-xcrun patch --- .../nodejs/bypass-darwin-xcrun-node16.patch | 41 +++++++++++++++++++ pkgs/development/web/nodejs/nodejs.nix | 3 -- pkgs/development/web/nodejs/v16.nix | 1 + pkgs/development/web/nodejs/v18.nix | 1 + 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/web/nodejs/bypass-darwin-xcrun-node16.patch diff --git a/pkgs/development/web/nodejs/bypass-darwin-xcrun-node16.patch b/pkgs/development/web/nodejs/bypass-darwin-xcrun-node16.patch new file mode 100644 index 000000000000..e86fcc4d2973 --- /dev/null +++ b/pkgs/development/web/nodejs/bypass-darwin-xcrun-node16.patch @@ -0,0 +1,41 @@ +Avoids needing xcrun or xcodebuild in PATH for native package builds + +diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +index a75d8ee..476440d 100644 +--- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py ++++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +@@ -522,7 +522,13 @@ class XcodeSettings: + # Since the CLT has no SDK paths anyway, returning None is the + # most sensible route and should still do the right thing. + try: +- return GetStdoutQuiet(["xcrun", "--sdk", sdk, infoitem]) ++ #return GetStdoutQuiet(["xcrun", "--sdk", sdk, infoitem]) ++ return { ++ "--show-sdk-platform-path": "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform", ++ "--show-sdk-path": "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk", ++ "--show-sdk-build-version": "19A547", ++ "--show-sdk-version": "10.15" ++ }[infoitem] + except GypError: + pass + +@@ -1499,7 +1505,8 @@ def XcodeVersion(): + version = "" + build = "" + try: +- version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines() ++ #version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines() ++ version_list = [] + # In some circumstances xcodebuild exits 0 but doesn't return + # the right results; for example, a user on 10.7 or 10.8 with + # a bogus path set via xcode-select +@@ -1510,7 +1517,8 @@ def XcodeVersion(): + version = version_list[0].split()[-1] # Last word on first line + build = version_list[-1].split()[-1] # Last word on last line + except GypError: # Xcode not installed so look for XCode Command Line Tools +- version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322 ++ #version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322 ++ version = "11.0.0.0.1.1567737322" + if not version: + raise GypError("No Xcode or CLT version detected!") + # Be careful to convert "4.2.3" to "0423" and "11.0.0" to "1100": diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index ab9a8b95d1a0..6d9a3392a7a9 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -123,7 +123,6 @@ let --replace "/usr/bin/env" "${coreutils}/bin/env" done '' + optionalString stdenv.isDarwin '' - sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py sed -i -e "s|tr1/type_traits|type_traits|g" \ -e "s|std::tr1|std|" src/util.h ''; @@ -176,8 +175,6 @@ let 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 ''; passthru.updateScript = import ./update.nix { diff --git a/pkgs/development/web/nodejs/v16.nix b/pkgs/development/web/nodejs/v16.nix index 0b6a127bd269..5e0ea0a996cc 100644 --- a/pkgs/development/web/nodejs/v16.nix +++ b/pkgs/development/web/nodejs/v16.nix @@ -12,6 +12,7 @@ in sha256 = "sha256-ZyH+tBUtVtLGs1jOOXq9Wn8drwnuLiXFAhubTT+GozA="; patches = [ ./disable-darwin-v8-system-instrumentation.patch + ./bypass-darwin-xcrun-node16.patch # Fix npm silently fail without a HOME directory https://github.com/npm/cli/issues/4996 (fetchpatch { url = "https://github.com/npm/cli/commit/9905d0e24c162c3f6cc006fa86b4c9d0205a4c6f.patch"; diff --git a/pkgs/development/web/nodejs/v18.nix b/pkgs/development/web/nodejs/v18.nix index 7f9bff648ce6..9cb626a93d98 100644 --- a/pkgs/development/web/nodejs/v18.nix +++ b/pkgs/development/web/nodejs/v18.nix @@ -20,5 +20,6 @@ buildNodejs { }) ./disable-darwin-v8-system-instrumentation.patch + ./bypass-darwin-xcrun-node16.patch ]; }