@@ -5,7 +5,11 @@ import { spawn } from "node:child_process";
55
66const coreCount = os . cpus ( ) . length ;
77const threadCount = coreCount * 2 ;
8- const sccacheEnv = { CC : "sccache gcc" , CXX : "sccache g++" } ;
8+
9+ let CC = process . env . CC ;
10+ let CXX = process . env . CXX ;
11+ if ( ! CC ) CC = "gcc" ;
12+ if ( ! CXX ) CXX = "g++" ;
913
1014const nodejsGithubRepo = "https://github.com/nodejs/node" ;
1115const removeTheVCharacter = ( str ) => str . replace ( "v" , "" ) ;
@@ -36,15 +40,11 @@ const isANewerVersion = (oldVer, newVer) => {
3640 return false ;
3741} ;
3842
39- const spawnAsync = ( program , args , cwd , env ) =>
43+ const spawnAsync = ( program , args , cwd ) =>
4044 new Promise ( ( resolve , reject ) => {
4145 console . log ( [ program , ...args ] . join ( " " ) ) ;
4246
43- const child = spawn (
44- program ,
45- args ,
46- cwd ? { cwd, env : { ...process . env , ...env } } : { }
47- ) ;
47+ const child = spawn ( program , args , cwd ? { cwd } : { } ) ;
4848
4949 child . stdout . on ( "data" , ( chunk ) => console . log ( chunk . toString ( ) ) ) ;
5050 child . stderr . on ( "data" , ( chunk ) => console . warn ( chunk . toString ( ) ) ) ;
@@ -67,16 +67,10 @@ if (!syncFs.existsSync("node")) {
6767 `v${ latestNodeVersion } ` ,
6868 "--depth=1" ,
6969 ] ,
70- undefined ,
71- { }
70+ undefined
7271 ) ;
7372}
7473
75- await spawnAsync (
76- "./configure" ,
77- [ `CC="sccache gcc"` , `CXX="sccache g++"` , "--ninja" , "--shared" ] ,
78- "node" ,
79- sccacheEnv
80- ) ;
74+ await spawnAsync ( "./configure" , [ "--ninja" , "--shared" ] , "node" ) ;
8175
82- await spawnAsync ( "make" , [ `-j${ threadCount } ` ] , "node" , sccacheEnv ) ;
76+ await spawnAsync ( "make" , [ `-j${ threadCount } ` ] , "node" ) ;
0 commit comments