async function compileOnWindows, compileOnUnix

This commit is contained in:
igorklopov 2016-08-10 11:47:39 +03:00
parent 935385efdd
commit d28fd16c4a

View File

@ -13,6 +13,24 @@ const nodePath = path.join(buildPath, 'node');
const patchesPath = path.resolve(__dirname, '../patches');
const windows = platform === 'win32';
async function compileOnWindows (target) {
const args = [];
args.push('/c', 'vcbuild.bat', target, 'nosign');
await chipo.spawn('cmd', args,
{ stdio: 'inherit', cwd: nodePath });
}
async function compileOnUnix (target) {
const args = [];
const cpu = { x86: 'ia32', x64: 'x64',
armv6: 'arm', armv7: 'arm' }[target];
args.push('--dest-cpu', cpu);
await chipo.spawn('./configure', args,
{ stdio: 'inherit', cwd: nodePath });
await chipo.spawn('make',
{ stdio: 'inherit', cwd: nodePath });
}
async function main () {
for (const nodeVersion in patchesJson) {
for (const target of targets) {
@ -36,19 +54,11 @@ async function main () {
{ stdio: 'inherit', cwd: nodePath });
}
const args = [];
let outputBinary;
if (windows) {
args.push('/c', 'vcbuild.bat', target, 'nosign');
await chipo.spawn('cmd', args,
{ stdio: 'inherit', cwd: nodePath });
outputBinary = await compileOnWindows(target);
} else {
const cpu = { x86: 'ia32', x64: 'x64',
armv6: 'arm', armv7: 'arm' }[target];
args.push('--dest-cpu', cpu);
await chipo.spawn('./configure', args,
{ stdio: 'inherit', cwd: nodePath });
await chipo.spawn('make',
{ stdio: 'inherit', cwd: nodePath });
outputBinary = await compileOnUnix(target);
}
// TODO place to ~/.pkg-cache