use hostPlatform in build.js instead of process.platform

This commit is contained in:
Igor Klopov 2017-01-20 10:11:49 +03:00
parent 895a9302a0
commit 9f5b975965

View File

@ -1,6 +1,7 @@
import { mkdirp, remove } from 'fs-promise';
import { progress, spawn } from './spawn.js';
import { copyFile } from './copy-file.js';
import { hostPlatform } from './system.js';
import { log } from './log.js';
import patchesJson from '../patches/patches.json';
import path from 'path';
@ -62,7 +63,7 @@ async function compileOnUnix (nodeVersion, targetArch) {
if (major >= 6) args.push('--without-inspector');
// TODO same for windows?
await spawn('./configure', args, { cwd: nodePath });
const make = process.platform === 'freebsd' ? 'gmake' : 'make';
const make = hostPlatform === 'freebsd' ? 'gmake' : 'make';
const promise = spawn(make, [], { cwd: nodePath });
progress(promise, thresholds('make', nodeVersion));
await promise;
@ -71,11 +72,9 @@ async function compileOnUnix (nodeVersion, targetArch) {
async function compile (nodeVersion, targetArch) {
log.info('Compiling Node.js from sources...');
if (process.platform === 'win32') {
return await compileOnWindows(nodeVersion, targetArch);
} else {
return await compileOnUnix(nodeVersion, targetArch);
}
const win = hostPlatform === 'win';
if (win) return await compileOnWindows(nodeVersion, targetArch);
return await compileOnUnix(nodeVersion, targetArch);
}
export default async function build (