applies patches and compiles (for non-win yet)
This commit is contained in:
parent
253b06bc04
commit
df72d8473e
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
temp
|
||||
27
lib/build.js
27
lib/build.js
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ function getArch () {
|
||||
|
||||
function getTargets () {
|
||||
// TODO x64, x86 from 'x64'?
|
||||
return getArch();
|
||||
return [ getArch() ];
|
||||
}
|
||||
|
||||
export const abi = getAbi();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user