当前位置:   article > 正文

编译chromium笔记_chromium编译减少体积

chromium编译减少体积

有效参考:
https://www.cnblogs.com/kanego/p/4086686.html
https://blog.csdn.net/longji/article/details/80967225
https://www.itmaohome.com/windows-soft/563.html
https://blog.csdn.net/glunoy/article/details/23591047

webrtc编译
https://www.cnblogs.com/welen/articles/7245160.html
https://blog.csdn.net/yangzhenping/article/details/52399897

官网:
www.chromium.org

开发环境:
python2.7
vs2019
git

环境变量:
path:
    python
    depot_tools  地址:git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_MSVS_VERSION=2019
GOOGLE_API_KEY: AIzaSyAXSMNnXzu_QmAK3fT1dZEUoLcEtWEGJ34
GOOGLE_DEFAULT_CLIENT_ID: 911346923178-7qrncmo5es0c15ebl5fg0bjjq2h38s4d.apps.googleusercontent.com
GOOGLE_DEFAULT_CLIENT_SECRET: xvRT-HtLE2y2UJTtBDqP68s-
GYP_GENERATORS=msvs-ninja,ninja   //这个参数的说明 http://www.mamicode.com/info-detail-1307103.html
GYP_MSVS_OVERRIDE_PATH=vs安装路径,例如:C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional

mac版推荐参数如下:
target_os = "mac"
target_cpu = "x64"
is_debug = false
symbol_level = 0
is_official_build=true

当前路径下新建depot_tools目录,在depot_tools目录下执行

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

当前路径下新建目录src,并在当前路径下执行
fetch chromium
is_component_build
编译选项:
target_cpu=“x86”:指明生成的针对X86架构的CPU。
is_debug=false:指明生成的是Release版本可执行程序。
is_official_build=true:指明使用Chrome官方的编译优化建议。
proprietary_codecs:指明支持H264编码,编译时,自动H264相关组件,打包PE文件中。
enable_nacl=false:Native Client,指明关闭支持NACL,这是一种Chrome插件,因为安全性,稳定性存在问题,已经很少使用了。
remove_webcore_debug_symbols=true:指明删除内核层支持调试的符号文件,这样,有助于减少文件体积,提高运行速度。
Component build=true是将最后一步本来很长的链接操作,改为链接成很多个分离的共享库的操作。它是默认的debug版的编译方式(除iOS编译),
    并且大多数开发者使用这种模式用于每天的编译及调试。这种模式启动会很慢,
    而且一些链接优化会被禁用,所以这不是测试的标准。有些人喜欢在release编译启用这种模式,来获取更快的链接速度和合理的运行性能。
symbol_level = 0 不生成符号文件将使调试几乎成为不可能,但编译确实会更快。当你想尽快编译的时候会很有用
use_goma = true
goma_dir = "/home/me/somewhere/goma"  # Optional Googlers可以使用它来分布式编译。 goma_dir仅当你将Goma工具放在非标准的路径时才
    需要指定(默认的路径为:~/goma or C:\goma\goma-win)。
rtc_use_h264=true 是否使用H264,这里取true,注意Windows平台编码使用OpenH264,解码使用ffmpeg。

  1> 打开e:\cef\source\chromium\src\cef\cef.gypi,variables节下添加如下即可支持mp3/mp4。

    'proprietary_codecs': 1,
    'ffmpeg_branding': 'Chrome',

编译步骤:
1.gclient runhooks

debug x86:
2.gn gen out/Debug --ide=vs2019 --args="target_os=\"win\" target_cpu=\"x86\" is_component_build=true is_debug=true is_official_build=false google_api_key=false google_default_client_id=false google_default_client_secret=false proprietary_codecs=true media_use_ffmpeg=true ffmpeg_branding=\"Chrome\" remove_webcore_debug_symbols=tfalse enable_nacl=false enable_hevc_demuxing=true enable_dolby_vision_demuxing=true enable_mse_mpeg2ts_stream_parser=true enable_hls_sample_aes=true enable_ac3_eac3_audio_demuxing=true"
3.ninja -C out\Debug chrome setup mini_installer

release x86:
gn gen out/Release --ide=vs2019 --args="target_os=\"win\" target_cpu=\"x86\" is_component_build=false is_debug=false is_official_build=true google_api_key=false google_default_client_id=false google_default_client_secret=false proprietary_codecs=true media_use_ffmpeg=true ffmpeg_branding=\"Chrome\" remove_webcore_debug_symbols=true enable_nacl=false enable_hevc_demuxing=true enable_dolby_vision_demuxing=true enable_mse_mpeg2ts_stream_parser=true enable_hls_sample_aes=true enable_ac3_eac3_audio_demuxing=true"
ninja -C out\Release chrome mini_installer

指定sdk版本号
--winsdk=xxxxx
查看目前工程构建的依赖
gn desc out/Debug <targetName> --all --tree

建议使用浏览器历史或当前相同的版本分支
chrome发布版本查看:
https://omahaproxy.appspot.com/
https://www.chromedownloads.net/chrome64win/

代码下载:
http://commondatastorage.googleapis.com/chromium-browser-official/chromium-79.0.3945.117.tar.xz

拉分支
git checkout -b 79.0.3945.117_local 79.0.3945.117

查看分支
git show-ref --tags
https://omahaproxy.appspot.com/history

切换分支
git checkout -b local_79.0.3945.117 79.0.3945.117

查看当前所属分支
git branch -vv

同步分支
gclient sync --with_branch_heads

切换分支后清除编译生成文件(手动删除也可以) 删除输出目录下除args.gn文件外的所有内容
gn clean <out_dir>

python -m ensurepip
pip install pypiwin32
pip install win32file
https://sourceforge.net/projects/pywin32/files/pywin32/
https://github.com/mhammond/pywin32/releases
https://www.python.org/downloads/release/python-2717/
python pywin32_postinstall.py -install
for %1 in (%windir%\system32\*.dll) do regsvr32.exe /s %1

https://troubleshooter.xyz/wiki/fix-application-error-0xc0000142/
https://media.computerbase.de/s/KwsNdcLj2V6FKDY5TcJ41Q/1582109533/download/758/aio-runtimes_v2.4.9.exe

vs 子进程调试(因为浏览器基于多进程,调试的时候无法直接调试到子进程,可以使用这个工具,或者直接附加到对应的子进程)
https://devblogs.microsoft.com/devops/introducing-the-child-process-debugging-power-tool/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/882294
推荐阅读
相关标签
  

闽ICP备14008679号