-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41e2dff
commit 7a2cf75
Showing
4 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const fs = require('fs'); | ||
const path = require('path') | ||
|
||
const v8_path = path.resolve(process.argv[2]); | ||
const v8_version = process.argv[3]; | ||
const target_cpu = (process.argv[4] == 'arm' ? 'arm' : 'arm64'); | ||
|
||
function addV8CC() { | ||
const filepath = path.join(v8_path, 'BUILD.gn') | ||
console.log(`add ${target_cpu} v8cc to ${filepath} ...`); | ||
let context = fs.readFileSync(filepath, 'utf-8'); | ||
|
||
let v8cc_target = ` | ||
v8_executable("v8cc") { | ||
visibility = [ ":*" ] # Only targets in this file can depend on this. | ||
sources = [ | ||
"src/snapshot/v8cc.cc", | ||
] | ||
if (v8_control_flow_integrity) { | ||
sources += [ "src/deoptimizer/deoptimizer-cfi-empty.cc" ] | ||
} | ||
configs = [ ":internal_config" ] | ||
deps = [ | ||
":v8_base_without_compiler", | ||
":v8_compiler_for_mksnapshot", | ||
":v8_init", | ||
":v8_libbase", | ||
":v8_libplatform", | ||
":v8_maybe_icu", | ||
":v8_shared_internal_headers", | ||
":v8_tracing", | ||
":v8_turboshaft", | ||
"//build/win:default_exe_manifest", | ||
":v8_snapshot", | ||
] | ||
} | ||
`; | ||
|
||
if (v8_version == "9.4.146.24") { | ||
v8cc_target = v8cc_target.replace('":v8_turboshaft",', ''); | ||
} | ||
|
||
const v8_initializers_pos = context.indexOf('v8_source_set("v8_initializers") {'); | ||
const v8_init_pos = context.indexOf('v8_source_set("v8_init") {'); | ||
const v8_base_without_compiler_pos = context.indexOf('v8_source_set("v8_base_without_compiler") {'); | ||
const v8_base_pos = context.indexOf('group("v8_base") {'); | ||
|
||
let new_context = context.slice(0, v8_initializers_pos); | ||
new_context += `v8_cross_cpu = "${target_cpu}"\n\n` | ||
new_context += context.slice(v8_initializers_pos, v8_init_pos).replace(/v8_current_cpu/g, 'v8_cross_cpu'); | ||
new_context += context.slice(v8_init_pos, v8_base_without_compiler_pos); | ||
new_context += context.slice(v8_base_without_compiler_pos, v8_base_pos).replace(/v8_current_cpu/g, 'v8_cross_cpu'); | ||
new_context += context.slice(v8_base_pos); | ||
new_context += v8cc_target; | ||
new_context = new_context.replace(/V8_TARGET_ARCH_X64|V8_TARGET_ARCH_IA32/g, target_cpu == 'arm' ? 'V8_TARGET_ARCH_ARM' : 'V8_TARGET_ARCH_ARM64'); | ||
|
||
fs.writeFileSync(filepath, new_context); | ||
|
||
fs.copyFileSync(path.join(__dirname, 'v8cc.cc'), path.join(v8_path, 'src/snapshot/v8cc.cc')); | ||
} | ||
|
||
(function() { | ||
addV8CC(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
set VERSION=%1 | ||
|
||
cd /d %USERPROFILE% | ||
echo =====[ Getting Depot Tools ]===== | ||
powershell -command "Invoke-WebRequest https://storage.googleapis.com/chrome-infra/depot_tools.zip -O depot_tools.zip" | ||
7z x depot_tools.zip -o* | ||
set PATH=%CD%\depot_tools;%PATH% | ||
set GYP_MSVS_VERSION=2019 | ||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0 | ||
call gclient | ||
|
||
cd depot_tools | ||
call git reset --hard 8d16d4a | ||
cd .. | ||
set DEPOT_TOOLS_UPDATE=0 | ||
|
||
|
||
mkdir v8 | ||
cd v8 | ||
|
||
echo =====[ Fetching V8 ]===== | ||
call fetch v8 | ||
cd v8 | ||
call git checkout refs/tags/%VERSION% | ||
@REM cd test\test262\data | ||
call git config --system core.longpaths true | ||
@REM call git restore * | ||
@REM cd ..\..\..\ | ||
call gclient sync | ||
|
||
if "%VERSION%"=="10.6.194" ( | ||
echo =====[ patch 10.6.194 ]===== | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\win_msvc_v10.6.194.patch | ||
) | ||
|
||
if "%VERSION%"=="11.8.172" ( | ||
echo =====[ patch 10.6.194 ]===== | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\remove_uchar_include_v11.8.172.patch | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\win_dll_v11.8.172.patch" | ||
) | ||
|
||
if "%VERSION%"=="9.4.146.24" ( | ||
echo =====[ patch jinja for python3.10+ ]===== | ||
cd third_party\jinja2 | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\jinja_v9.4.146.24.patch | ||
cd ..\.. | ||
) | ||
|
||
@REM echo =====[ Patching V8 ]===== | ||
@REM node %GITHUB_WORKSPACE%\CRLF2LF.js %GITHUB_WORKSPACE%\patches\builtins-puerts.patches | ||
@REM call git apply --cached --reject %GITHUB_WORKSPACE%\patches\builtins-puerts.patches | ||
@REM call git checkout -- . | ||
|
||
@REM issue #4 | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\intrin.patch | ||
|
||
echo =====[ add ArrayBuffer_New_Without_Stl ]===== | ||
node %~dp0\node-script\add_arraybuffer_new_without_stl.js . | ||
|
||
node %~dp0\node-script\add_cross_v8cc.js . %VERSION% arm | ||
|
||
echo =====[ Building V8 ]===== | ||
if not "%VERSION%"=="9.4.146.24" ( | ||
call gn gen out.gn\x86.release -args="target_os=""win"" target_cpu=""x86"" v8_use_external_startup_data=false v8_enable_i18n_support=false is_debug=false v8_static_library=true is_clang=false strip_debug_info=true symbol_level=0 v8_enable_pointer_compression=false v8_enable_sandbox=false" | ||
) else ( | ||
call gn gen out.gn\x86.release -args="target_os=""win"" target_cpu=""x86"" v8_use_external_startup_data=false v8_enable_i18n_support=false is_debug=false v8_static_library=true is_clang=false strip_debug_info=true symbol_level=0 v8_enable_pointer_compression=false" | ||
) | ||
|
||
call ninja -v -C out.gn\x86.release v8cc | ||
|
||
md output\v8\Bin\Win\arm | ||
copy /Y out.gn\x86.release\v8cc.exe output\v8\Bin\Win\arm\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
set VERSION=%1 | ||
|
||
cd /d %USERPROFILE% | ||
echo =====[ Getting Depot Tools ]===== | ||
powershell -command "Invoke-WebRequest https://storage.googleapis.com/chrome-infra/depot_tools.zip -O depot_tools.zip" | ||
7z x depot_tools.zip -o* | ||
set PATH=%CD%\depot_tools;%PATH% | ||
set GYP_MSVS_VERSION=2019 | ||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0 | ||
call gclient | ||
|
||
cd depot_tools | ||
call git reset --hard 8d16d4a | ||
cd .. | ||
set DEPOT_TOOLS_UPDATE=0 | ||
|
||
|
||
mkdir v8 | ||
cd v8 | ||
|
||
echo =====[ Fetching V8 ]===== | ||
call fetch v8 | ||
cd v8 | ||
call git checkout refs/tags/%VERSION% | ||
@REM cd test\test262\data | ||
call git config --system core.longpaths true | ||
@REM call git restore * | ||
@REM cd ..\..\..\ | ||
call gclient sync | ||
|
||
@REM echo =====[ Patching V8 ]===== | ||
@REM node %GITHUB_WORKSPACE%\CRLF2LF.js %GITHUB_WORKSPACE%\patches\builtins-puerts.patches | ||
@REM call git apply --cached --reject %GITHUB_WORKSPACE%\patches\builtins-puerts.patches | ||
@REM call git checkout -- . | ||
|
||
if "%VERSION%"=="10.6.194" ( | ||
echo =====[ patch 10.6.194 ]===== | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\win_msvc_v10.6.194.patch | ||
) | ||
|
||
if "%VERSION%"=="11.8.172" ( | ||
echo =====[ patch 10.6.194 ]===== | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\remove_uchar_include_v11.8.172.patch | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\win_dll_v11.8.172.patch" | ||
) | ||
|
||
if "%VERSION%"=="9.4.146.24" ( | ||
echo =====[ patch jinja for python3.10+ ]===== | ||
cd third_party\jinja2 | ||
node %~dp0\node-script\do-gitpatch.js -p %GITHUB_WORKSPACE%\patches\jinja_v9.4.146.24.patch | ||
cd ..\.. | ||
) | ||
|
||
echo =====[ add ArrayBuffer_New_Without_Stl ]===== | ||
node %~dp0\node-script\add_arraybuffer_new_without_stl.js . | ||
|
||
node %~dp0\node-script\add_cross_v8cc.js . %VERSION% arm64 | ||
|
||
echo =====[ Building V8 ]===== | ||
if "%VERSION%"=="11.8.172" ( | ||
call gn gen out.gn\x64.release -args="target_os=""win"" target_cpu=""x64"" v8_use_external_startup_data=false v8_enable_i18n_support=false is_debug=false v8_static_library=true is_clang=false strip_debug_info=true symbol_level=0 v8_enable_pointer_compression=false v8_enable_sandbox=false v8_enable_maglev=false" | ||
) | ||
|
||
if "%VERSION%"=="10.6.194" ( | ||
call gn gen out.gn\x64.release -args="target_os=""win"" target_cpu=""x64"" v8_use_external_startup_data=false v8_enable_i18n_support=false is_debug=false v8_static_library=true is_clang=false strip_debug_info=true symbol_level=0 v8_enable_pointer_compression=false v8_enable_sandbox=false" | ||
) | ||
|
||
if "%VERSION%"=="9.4.146.24" ( | ||
call gn gen out.gn\x64.release -args="target_os=""win"" target_cpu=""x64"" v8_use_external_startup_data=false v8_enable_i18n_support=false is_debug=false v8_static_library=true is_clang=false strip_debug_info=true symbol_level=0 v8_enable_pointer_compression=false" | ||
) | ||
|
||
call ninja -v -C out.gn\x64.release v8cc | ||
|
||
md output\v8\Bin\Win\arm64 | ||
copy /Y out.gn\x64.release\v8cc.exe output\v8\Bin\Win\arm64\ |