nodejs: simplify GYP patching
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Sandboxed builds need a fallback value for the version of the Command Line Tools
|
||||
being used.
|
||||
being used. Not calling `CLTVersion()` avoids relying on absolute paths,
|
||||
improving the reproducibility of non-sandboxed builds.
|
||||
|
||||
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
|
||||
index 508f6ccac3e..44bcd988c4c 100644
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
Sandboxed builds need a fallback value for the version of the Command Line Tools
|
||||
being used.
|
||||
|
||||
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
|
||||
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
|
||||
@@ -1552,7 +1552,7 @@ def CLTVersion():
|
||||
output = GetStdout(["/usr/sbin/softwareupdate", "--history"])
|
||||
return re.search(regex, output).groupdict()["version"]
|
||||
except (GypError, OSError):
|
||||
- return None
|
||||
+ return "11.0.0.0.1.1567737322"
|
||||
|
||||
|
||||
def GetStdoutQuiet(cmdlist):
|
||||
--- 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
|
||||
@@ -1552,7 +1552,7 @@ def CLTVersion():
|
||||
output = GetStdout(["/usr/sbin/softwareupdate", "--history"])
|
||||
return re.search(regex, output).groupdict()["version"]
|
||||
except (GypError, OSError):
|
||||
- return None
|
||||
+ return "11.0.0.0.1.1567737322"
|
||||
|
||||
|
||||
def GetStdoutQuiet(cmdlist):
|
||||
@@ -1,19 +1,13 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchpatch2,
|
||||
patch_npm ? true,
|
||||
patch_tools ? true,
|
||||
patch_npm_catch_oserror ? patch_npm,
|
||||
patch_tools_catch_oserror ? patch_tools,
|
||||
patch_npm_regex_handling ? patch_npm && stdenv.buildPlatform.isDarwin,
|
||||
patch_tools_regex_handling ? patch_tools && stdenv.buildPlatform.isDarwin,
|
||||
}:
|
||||
let
|
||||
url = "https://github.com/nodejs/gyp-next/commit/8224deef984add7e7afe846cfb82c9d3fa6da1fb.patch?full_index=1";
|
||||
url_regex_handling = "https://github.com/nodejs/gyp-next/commit/b21ee3150eea9fc1a8811e910e5ba64f42e1fb77.patch?full_index=1";
|
||||
in
|
||||
lib.optionals patch_tools_catch_oserror ([
|
||||
lib.optionals patch_tools ([
|
||||
# Fixes builds with Nix sandbox on Darwin for gyp.
|
||||
(fetchpatch2 {
|
||||
inherit url;
|
||||
@@ -22,7 +16,7 @@ lib.optionals patch_tools_catch_oserror ([
|
||||
extraPrefix = "tools/gyp/";
|
||||
})
|
||||
])
|
||||
++ lib.optionals patch_npm_catch_oserror ([
|
||||
++ lib.optionals patch_npm ([
|
||||
(fetchpatch2 {
|
||||
inherit url;
|
||||
hash = "sha256-cXTwmCRHrNhuY1+3cD/EvU0CJ+1Nk4TRh6c3twvfaW8=";
|
||||
@@ -30,24 +24,6 @@ lib.optionals patch_tools_catch_oserror ([
|
||||
extraPrefix = "deps/npm/node_modules/node-gyp/gyp/";
|
||||
})
|
||||
])
|
||||
++ lib.optionals patch_tools_regex_handling ([
|
||||
# Fixes builds with Nix sandbox on Darwin for gyp.
|
||||
(fetchpatch2 {
|
||||
url = url_regex_handling;
|
||||
hash = "sha256-xDZO8GgZLPvCeTrCu6RVVFV5bmbuz9UPgHiaAJE6im0=";
|
||||
stripLen = 1;
|
||||
extraPrefix = "tools/gyp/";
|
||||
})
|
||||
])
|
||||
++ lib.optionals patch_npm_regex_handling ([
|
||||
(fetchpatch2 {
|
||||
url = url_regex_handling;
|
||||
hash = "sha256-fW5kQh+weCK0g3wzTJLZgAuXxetb14UAf6yxW6bIgbU=";
|
||||
stripLen = 1;
|
||||
extraPrefix = "deps/npm/node_modules/node-gyp/gyp/";
|
||||
})
|
||||
])
|
||||
# TODO: remove the Darwin conditionals from this file
|
||||
++ lib.optionals stdenv.buildPlatform.isDarwin ([
|
||||
++ [
|
||||
./gyp-patches-set-fallback-value-for-CLT-darwin.patch
|
||||
])
|
||||
]
|
||||
|
||||
@@ -30,7 +30,6 @@ let
|
||||
})
|
||||
|
||||
./gyp-patches-pre-v22-import-sys.patch
|
||||
./gyp-patches-set-fallback-value-for-CLT.patch
|
||||
];
|
||||
in
|
||||
buildNodejs {
|
||||
|
||||
@@ -15,14 +15,7 @@ let
|
||||
python = python3;
|
||||
};
|
||||
|
||||
gypPatches =
|
||||
if stdenv.buildPlatform.isDarwin then
|
||||
callPackage ./gyp-patches.nix { }
|
||||
++ [
|
||||
./gyp-patches-set-fallback-value-for-CLT.patch
|
||||
]
|
||||
else
|
||||
[ ];
|
||||
gypPatches = if stdenv.buildPlatform.isDarwin then callPackage ./gyp-patches.nix { } else [ ];
|
||||
in
|
||||
buildNodejs {
|
||||
inherit enableNpm;
|
||||
|
||||
@@ -17,10 +17,7 @@ let
|
||||
|
||||
gypPatches =
|
||||
if stdenv.buildPlatform.isDarwin then
|
||||
callPackage ./gyp-patches.nix { patch_tools_catch_oserror = false; }
|
||||
++ [
|
||||
./gyp-patches-set-fallback-value-for-CLT.patch
|
||||
]
|
||||
callPackage ./gyp-patches.nix { patch_tools = false; }
|
||||
else
|
||||
[ ];
|
||||
in
|
||||
|
||||
Reference in New Issue
Block a user