-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathinstall.js
57 lines (47 loc) · 1.2 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
const child_process = require('child_process');
const os = require('os');
const lldb = require('./lldb');
main();
function main() {
const osName = os.type();
if (osName === 'Windows_NT') {
return mainWindows();
}
runFile('node-gyp', ['rebuild']);
}
function mainWindows() {
const clangExe = 'clang-cl.exe';
const clangDir = lldb.findWindowsExeDir(clangExe);
if (!clangDir) {
console.log(`Could not find ${clangExe}`);
process.exit(1);
}
console.log(`Using ${clangExe} found at ${clangDir}`);
runShell('node-gyp clean');
runShell('node-gyp configure');
runShell(`node-gyp build /p:CLToolExe="${clangExe}" /p:CLToolPath="${clangDir}"`);
}
/**
* execFileSync wrapper, exits on error.
* @param {string} file Executable to run
* @param {string[]} args List of arguments
*/
function runFile(file, args) {
try {
child_process.execFileSync(file, args, { stdio: 'inherit' });
} catch (err) {
process.exit(err.status);
}
}
/**
* execSync wrapper, exits on error.
* @param {string} command Command to run
*/
function runShell(command) {
try {
child_process.execSync(command, { stdio: 'inherit' });
} catch (err) {
process.exit(err.status);
}
}