-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.install-deps.js
More file actions
28 lines (26 loc) · 937 Bytes
/
env.install-deps.js
File metadata and controls
28 lines (26 loc) · 937 Bytes
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
import { useShell } from './scripts/shell.functions.js';
// TODO: update to install in all platforms + cygwin + mingw + msys2
const cmds = [];
// Detect what dependencies are missing.
const dependencies = ['autoconf', 'automake', 'build-essential', 'pkg-config', 'libtool', 'dos2unix'];
for (const cmd of dependencies) {
console.log(`Checking ${cmd}...`);
const { stdout, stderr } = await useShell(`command -v ${cmd}`);
if (stderr) {
console.log(`${stderr}...`);
cmds.push(cmd);
}
}
// Install missing dependencies
if (cmds.length !== 0) {
if (process.platform === 'linux') {
// Install dependencies on Linux
await useShell('apt-get update');
await useShell(`apt-get install -y ${cmds.join(' ')}`);
} else if (process.platform === 'darwin') {
// Install dependencies on macOS
await useShell(`brew install ${cmds.join(' ')}`);
} else {
console.error('Unsupported operating system');
}
}