diff --git a/src/chromium.ts b/src/chromium.ts index fcb8f0b..5160e8a 100644 --- a/src/chromium.ts +++ b/src/chromium.ts @@ -2,73 +2,9 @@ * @file Declares chromium debugging functions and constants */ -import { spawn } from 'child_process'; -import * as gn from './commands/gn.js'; import path from 'path'; import { local } from './environment/index.js'; - -/** - * Arguments to GN build, copied from README. - * - */ -export const gnArgs = (llvmInstall: string) => [ - 'is_clang=true', - 'clang_use_chrome_plugins=false', - 'is_debug=false', - 'use_goma=false', - 'use_sysroot=false', - 'use_openh264=false', - 'use_allocator="none"', - 'use_libjpeg_turbo=true', - 'use_gnome_keyring=false', - 'use_unofficial_version_number=false', - 'enable_nacl=false', - 'enable_nacl_nonsfi=false', - 'enable_swiftshader=false', - 'enable_reading_list=false', - 'enable_iterator_debugging=false', - 'enable_hangout_services_extension=false', - 'optimize_webui=false', - 'treat_warnings_as_errors=false', - 'linux_use_bundled_binutils=false', - 'remove_webcore_debug_symbols=true', - 'use_gio=true', - 'use_vaapi=false', - 'use_pulseaudio=true', - 'link_pulseaudio=true', - 'enable_widevine=true', - 'v8_enable_backtrace=true', - 'use_system_zlib=true', - 'use_system_lcms2=true', - 'use_system_libjpeg=true', - 'use_system_harfbuzz=false', - 'use_jumbo_build=true', - 'jumbo_file_merge_limit=8', - 'concurrent_links=1', - 'proprietary_codecs=true', - 'ffmpeg_branding="Chrome"', - 'fieldtrial_testing_like_official_build=true', - 'host_cpu="sw_64"', - 'use_lld=false', - 'enable_dav1d_decoder=false', - 'rtc_include_dav1d_in_internal_decoder_factory=false', - 'dcheck_always_on=false', - 'enable_libaom=false', - `clang_base_path="${llvmInstall}"` -]; - -/** - * Invoke meta-build system "gn", returns the process. - */ -export function configure(source: string, gnExe: string, outDir: string, gnArgs: string[]) { - return spawn(gnExe, [ - 'gen', - outDir, - ...gn.generalOptions({ args: gnArgs }), - ], { cwd: source }); -} - /** * Local directory for chromium - related debugging. */ diff --git a/src/chromium/configure.ts b/src/chromium/configure.ts new file mode 100644 index 0000000..6e19756 --- /dev/null +++ b/src/chromium/configure.ts @@ -0,0 +1,80 @@ +/** + * Maybe re-configure chromium project + */ + +import { spawn } from 'child_process'; +import * as gn from '../commands/gn.js'; +import { promisifySpawn } from '../cli.js'; +import path from 'path'; +import { lycEnv } from '../environment/index.js'; + +export const chromiumSource = '/home/lyc/swchromium-102.0.5005.115'; + +/** + * Arguments to GN build, copied from README. + * + */ +export const gnArgs = (llvmInstall: string) => [ + 'is_clang=true', + 'clang_use_chrome_plugins=false', + 'is_debug=false', + 'use_goma=false', + 'use_sysroot=false', + 'use_openh264=false', + 'use_allocator="none"', + 'use_libjpeg_turbo=true', + 'use_gnome_keyring=false', + 'use_unofficial_version_number=false', + 'enable_nacl=false', + 'enable_nacl_nonsfi=false', + 'enable_swiftshader=false', + 'enable_reading_list=false', + 'enable_iterator_debugging=false', + 'enable_hangout_services_extension=false', + 'optimize_webui=false', + 'treat_warnings_as_errors=false', + 'linux_use_bundled_binutils=false', + 'remove_webcore_debug_symbols=true', + 'use_gio=true', + 'use_vaapi=false', + 'use_pulseaudio=true', + 'link_pulseaudio=true', + 'enable_widevine=true', + 'v8_enable_backtrace=true', + 'use_system_zlib=true', + 'use_system_lcms2=true', + 'use_system_libjpeg=true', + 'use_system_harfbuzz=false', + 'use_jumbo_build=true', + 'jumbo_file_merge_limit=8', + 'concurrent_links=1', + 'proprietary_codecs=true', + 'ffmpeg_branding="Chrome"', + 'fieldtrial_testing_like_official_build=true', + 'host_cpu="sw_64"', + 'use_lld=false', + 'enable_dav1d_decoder=false', + 'rtc_include_dav1d_in_internal_decoder_factory=false', + 'dcheck_always_on=false', + 'enable_libaom=false', + `clang_base_path="${llvmInstall}"` +]; + +/** + * Invoke meta-build system "gn", returns the process. + */ +export function configure(source: string, gnExe: string, outDir: string, gnArgs: string[]) { + return spawn(gnExe, [ + 'gen', + outDir, + ...gn.generalOptions({ args: gnArgs }), + ], { cwd: source }); +} + +const hash = '7081b8371ae6460baabc370de4570ebd7e67f923'; + + +const gnExe = path.resolve(chromiumSource, 'buildtools', 'linux64', 'gn-linux-sw64'); +const outDir = path.resolve(chromiumSource, 'out', 'Release'); + +await promisifySpawn(configure(chromiumSource, gnExe, outDir, gnArgs(path.resolve(lycEnv.sharedLLVMInstall, hash)))) \ No newline at end of file