applies patches and compiles (for non-win yet)

This commit is contained in:
igorklopov 2016-08-10 10:42:49 +03:00
parent 253b06bc04
commit df72d8473e
3 changed files with 27 additions and 3 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
temp

View File

@ -1,4 +1,4 @@
import { arch, platform, targets } from './system.js';
import { platform, targets } from './system.js';
import chipo from 'child-process-promise';
import chalk from 'chalk';
import { localPath } from './places.js';
@ -10,6 +10,7 @@ import { version } from '../package.json';
const buildPath = path.resolve(__dirname, '../temp');
const patchesPath = path.resolve(__dirname, '../patches');
const windows = platform === 'win32';
async function main () {
for (const nodeVersion in patchesJson) {
@ -25,7 +26,29 @@ async function main () {
[ 'reset', '--hard', nodeVersion ],
{ stdio: 'inherit', cwd: buildPath + '/node' });
// const patches = patchesJson[nodeVersion];
const patches = patchesJson[nodeVersion];
for (const patch of patches) {
console.log(`> ${chalk.yellow('Applying patch')} ${patch}`);
const patchPath = path.join(patchesPath, patch);
await chipo.spawn('patch',
[ '-p1', '-i', patchPath ],
{ stdio: 'inherit', cwd: buildPath + '/node' });
const args = [];
if (windows) {
throw new Error('Not implemented TODO');
} 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: buildPath + '/node' });
await chipo.spawn('make',
{ stdio: 'inherit', cwd: buildPath + '/node' });
}
// TODO place to ~/.pkg-cache
}
}
}
}

View File

@ -23,7 +23,7 @@ function getArch () {
function getTargets () {
// TODO x64, x86 from 'x64'?
return getArch();
return [ getArch() ];
}
export const abi = getAbi();