安装环境准备
- Ubuntu 14.04 x64(只支持Ubuntu,可选版本12.04, 14.04, 14.10, 15.04, 15.10, 16.04)
- 稳定的翻墙工具,如Shadowsocks
- 官方教程地址:Build Instructions (Android)
配置代理
1 2 |
git config --global http.proxy 192.168.211.1:1080 git config --global https.proxy 192.168.211.1:1080 |
编辑~/.bashrc文件,最后添加
1 2 |
export http_proxy=192.168.211.1:1080 export https_proxy=192.168.211.1:1080 |
注:192.168.211.1:1080是我的代理地址,请按你的对应修改
安装depot_tools
1 |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
下载完成之后,修改~/.bashrc
在添加:
1 |
export PATH=$PATH:/path/to/depot_tools |
使配置生效:
1 |
source ~/.bashrc |
获取chromium源码
1 2 |
mkdir ~/chromium && cd ~/chromium ~/chromium$ fetch --nohooks --no-history android # This will take 30 minutes on a fast connection |
下载时间比较长,添加--no-history
参数取消下载历史记录。
如果中途下载中断:
1 |
gclient sync --nohooks |
整个源代码非常大,我下载下来有16G,一直下了接近2个半小时。
编译配置
1.配置GYP
1 2 3 |
~/chromium$ echo "{ 'GYP_DEFINES': 'OS=android target_arch=arm', }" > chromium.gyp_env ~/chromium$ gclient runhooks |
以上参数中的target_arch
表示构建的平台,可选”arm”, “ia32″(x86架构), “mipsel”(MIPS架构)
2.配置GN
1 |
~/chromium/src$ gn args out/Default |
在弹出的编辑器中写入:
1 2 3 4 5 6 7 8 9 |
target_os = "android" target_cpu = "arm" # (default) is_debug = true # (default) # Other args you may want to set: is_component_build = true is_clang = true symbol_level = 1 # Faster build with fewer symbols. -g1 rather than -g2 enable_incremental_javac = true # Much faster; experimental |
安装依耐环境
1 |
~/chromium/src$ build/install-build-deps-android.sh |
然后同步目录文件
1 |
~/chromium/src$ gclient sync |
编译APK
1.初始化环境
1 |
~/chromium/src$ . build/android/envsetup.sh |
2.编译完整浏览器
1 |
~/chromium/src$ ninja -C out/Release chrome_public_apk |
完成之后,去 out/Release/apks 下找到apk安装即可。
- 本文固定链接: https://blog.kuoruan.com/93.html
- 转载请注明: Index 于 扩软博客 发表
捐 赠如果您觉得这篇文章有用处,请支持作者!鼓励作者写出更好更多的文章!
不错,不错,看看了!