chrome: modify chromium source code for SIMD builds
This commit is contained in:
2598
assets/chromium/build-simd.gn
Normal file
2598
assets/chromium/build-simd.gn
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { spawn } from 'child_process';
|
import { spawn } from 'child_process';
|
||||||
import * as gn from '../commands/gn.js';
|
import * as crypto from 'crypto';
|
||||||
import { promisifySpawn } from '../cli.js';
|
import * as fs from "fs";
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { lycEnv } from '../environment/index.js';
|
import { promisifySpawn } from '../cli.js';
|
||||||
|
import * as gn from '../commands/gn.js';
|
||||||
|
import { systemdRunOptions } from '../commands/systemd.js';
|
||||||
|
import { lycEnv, projectRoot } from '../environment/index.js';
|
||||||
|
|
||||||
export const chromiumSource = '/home/lyc/swchromium-102.0.5005.115';
|
export const chromiumSource = '/home/lyc/swchromium-102.0.5005.115';
|
||||||
|
|
||||||
@@ -84,15 +87,50 @@ async function configureNoSIMD() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await configureSIMD();
|
interface ConfigureOptions {
|
||||||
async function configureSIMD() {
|
buildDir: string;
|
||||||
const hash = 'efa1fe54475ed4c333a6ec911cba80b7b4ba0963';
|
|
||||||
|
|
||||||
const outDir = path.resolve(chromiumSource, 'out', 'simd-noRLE', 'Release');
|
gnArgs: string[];
|
||||||
const configureProcess = configure(chromiumSource, gnExe, outDir, gnArgs(path.resolve(lycEnv.sharedLLVMInstall, hash)));
|
}
|
||||||
|
|
||||||
|
async function enableSIMDFromSource() {
|
||||||
|
const assets = path.resolve(projectRoot, 'assets');
|
||||||
|
|
||||||
|
|
||||||
|
const chromiumSIMDGN = path.resolve(assets, 'chromium', 'build-simd.gn');
|
||||||
|
const chromiumBuildGN = path.resolve(chromiumSource, 'build', 'config', 'compiler', 'BUILD.gn');
|
||||||
|
|
||||||
|
await fs.promises.copyFile(chromiumSIMDGN, chromiumBuildGN);
|
||||||
|
}
|
||||||
|
|
||||||
|
await invokeNinja();
|
||||||
|
async function invokeNinja() {
|
||||||
|
const hash = 'c9094783eb43868cdbcf26b3266b0231d8fbd6e6';
|
||||||
|
|
||||||
|
const uuid = crypto.randomUUID();
|
||||||
|
|
||||||
|
const buildDir = path.resolve(chromiumSource, 'out', hash, 'Release');
|
||||||
|
|
||||||
|
await enableSIMDFromSource();
|
||||||
|
|
||||||
|
const configureProcess = configure(chromiumSource, gnExe, buildDir, gnArgs(`/tmp/llvm-ly-install/${hash}`));
|
||||||
|
|
||||||
configureProcess.stdout.pipe(process.stdout);
|
configureProcess.stdout.pipe(process.stdout);
|
||||||
configureProcess.stderr.pipe(process.stderr);
|
configureProcess.stderr.pipe(process.stderr);
|
||||||
|
|
||||||
await promisifySpawn(configureProcess);
|
await promisifySpawn(configureProcess);
|
||||||
|
|
||||||
|
const systemdUnitName = uuid;
|
||||||
|
|
||||||
|
console.log(`Running chromium build (hash: ${hash}) as ${systemdUnitName}`);
|
||||||
|
|
||||||
|
await promisifySpawn(spawn('systemd-run',
|
||||||
|
[
|
||||||
|
...systemdRunOptions({ user: true, unit: systemdUnitName }),
|
||||||
|
'ninja',
|
||||||
|
'-C',
|
||||||
|
buildDir,
|
||||||
|
'chrome'
|
||||||
|
]
|
||||||
|
))
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user