参考说明:
https://github.com/chromium/chromium/blob/main/docs/linux/build_instructions.md
https://www.huoban.com/news/post/14698.html
一、系统要求
linux操作系统要使用ubuntu18及以上版本,最低16G内存,可以使用X86的cpu交叉编译。
二、代理设置
需要翻墙,设置代理:系统代理和git代理,这三个代理必须要设置
export http_proxy='http://10.*.*.148:7890'
export https_proxy='http://10.*.*.148:7890'
git config --global http.proxy http://10.*.*.148:7890
git config --global https.proxy http://10.*.*.148:7890
vim ~/.boto
[Boto]
proxy = 10.*.*.148
proxy_port = 7890
export NO_AUTH_BOTO_CONFIG=~/.boto
把上面代理的ip设置成自己的代理ip。
三、下载代码
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/path/to/depot_tools"
mkdir ~/chromium && cd ~/chromium
fetch --nohooks --no-history chromium
反复使用下面命令,直到所的包都编译成功:
gclient sync --no-history
gclient sync --no-history --force
如果一直报错,可以把报错的文件夹删除再执行命令。
如果没有第三方库,请搜索下载:# 这个可能用不到,上面命令反复使用能下载全
cd src/third_party
git clone https://chromium.googlesource.com/skia
git clone https://github.com/google/perfetto.git
git clone https://chromium.googlesource.com/chromium/src/third_party/sqlite
git clone https://github.com/google/swiftshader
git clone https://github.com/GoogleChromeLabs/text-fragments-polyfill
git clone https://github.com/google/ukey2
git clone https://chromium.googlesource.com/vulkan-deps
git clone https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator vulkan_memory_allocator
四、编译
cd src
./build/install-build-deps.sh --no-chromeos-fonts
gclient runhooks
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm
可以设置不同的参数:
gn gen out/Default --args='target_cpu="arm64"'
gn gen out/Release --args='target_cpu="arm64" target_os="linux" ffmpeg_branding="Chrome"'
is_component_build=false
v8_symbol_level=0
dcheck_always_on=false
angle_build_tests = false
proprietary_codecs = false
enable_iterator_debugging = false
is_official_build=false
ffmpeg_branding="Chrome"
target_os="linux"
enable_nacl=false
gn args out/Release --list
nohup autoninja -j 20 -C out/Release chrome &
cd out/Release
执行:./chrome version 如果有版本号信息说明编译成功。