Windows 下 一鍵 下載、編譯 Chromium 源碼

首先你都有個翻牆工具(藍燈也可以),你得知道VPN代理的IP和Port。

在剩餘空間比較大的磁盤目錄下,輸入以下CMD:

@echo off

:: 01 設置工具、源代碼放置目錄;由於源代碼體積較大,編譯也會佔用很大空間,所以應找一個空餘空間較多的磁盤來放置源代碼。磁盤剩餘空間最好不少於100G。git_cmdexe_path,修改成你的機器上 git.exe 的位置 
set "CurrentCD=%~dp0"
set "CurrentCDDisk=%CurrentCD:~0,2%"
set "CurrentCDPath=%CurrentCD:~3%"
cd\
%CurrentCDDisk%
cd\
cd "%CurrentCDPath%"
set "dept_tools_path=%CurrentCD%dept_tools"
set "chromiumsrcpath=%CurrentCD%chromium"
set "git_cmdexe_path=D:\GIT\Git\cmd"

:: 02 設置系統代理 <IP,Port 得修改成你的VPN的IP和Port>
set httpProxyIP=127.0.0.1
set httpProxyPort=1080
netsh winhttp set proxy http://%httpProxyIP%:%httpProxyPort%
@echo [Boto]>%CurrentCD%boto.cfg
@echo proxy=http://%httpProxyIP%>>%CurrentCD%boto.cfg
@echo proxy_port=%httpProxyPort%>>%CurrentCD%boto.cfg
set NO_AUTH_BOTO_CONFIG=%CurrentCD%boto.cfg
set http_proxy=%httpProxyIP%:%httpProxyPort%
set https_proxy=%httpProxyIP%:%httpProxyPort%

:: 03 設置系統環境變量
set DEPOT_TOOLS_WIN_TOOLCHAIN = 0
set GYP_MSVS_VERSION = 2017
set GYP_MSVS_OVERRIDE_PATH = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise"
set Path=C:\Windows\System32\WindowsPowerShell\v1.0\;%git_cmdexe_path%;%dept_tools_path%

:: 04 下載 depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git %dept_tools_path%
gclient

:: 05 下載 chromium 源代碼
md %chromiumsrcpath%
cd %chromiumsrcpath%
fetch chromium
gclient sync 

:: 06 用 ninja  編譯 chromium < 較快 >
gn gen out/Default --args="is_component_build = false is_debug = false"
ninja -C out/Default chrome

:: 06 用 VS2017 編譯 chromium < 較慢 >
gn gen out/VS2017 --args="is_component_build = false is_debug = false" --ide=vs

以管理員身份運行上面的CMD文件,下載、編譯一步到位。你只有靜靜的等待的份了。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章