# chromium **Repository Path**: AchoGit/chromium ## Basic Information - **Project Name**: chromium - **Description**: chromium 2024-04-12 上传 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-12 - **Last Updated**: 2024-04-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1、准备环境 ``` # 配置代理 git clone https://gitee.com/AchoGit/chromium.git # 配置工具环境变量 export PATH="$PATH:xxxx/depot_tools" # 可选操作--->同步代码(如需要最新的代码,需要配置科学上网并更新) /usr/bin/git config --global http.proxy http://xxx export http_proxy="http://xxx" export https_proxy="http://xxx" fetch --nohooks --no-history chromium gclient sync ``` 2、执行编译 ``` #!/bin/bash __DIR__=$(cd "$(dirname "$0")";pwd) cd ${__DIR__} export PATH=${__DIR__}/depot_tools:$PATH chromium_build_dir=${__DIR__}/chromium/chromium/src/build/Default/ rsync --delete-before --progress --stats -d ${__DIR__}/blank/ $chromium_build_dir cd ${__DIR__}/chromium/chromium/src/ # 参考文档 https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md#Smaller-builds gn gen $chromium_build_dir --args='is_debug=false symbol_level=0 enable_nocompile_tests=false target_cpu="x64" target_os="linux" ffmpeg_branding="Chrome" proprietary_codecs=true dcheck_always_on=false is_official_build=true is_component_build=false enable_nacl=false blink_symbol_level=0 v8_symbol_level=0' ninja -C $chromium_build_dir chrome ``` 3、打包 ``` #!/bin/bash __DIR__=$(cd "$(dirname "$0")";pwd) cd ${__DIR__} test -d ${__DIR__}/blank/ && rm -rf ${__DIR__}/blank/ mkdir -p ${__DIR__}/blank/ rsync --delete-before --progress --stats -d ${__DIR__}/blank/ ${__DIR__}/Default/ chromium_build_dir=${__DIR__}/chromium/chromium/src/build/Default/ sourcefolder=${__DIR__}/chromium/chromium/src/build/Default/ destinationfolder=${__DIR__}/Default/ thefoldertoexclude=obj rsync -av --progress $sourcefolder $destinationfolder --exclude obj --exclude gen --exclude thinlto-cache rm -rf ${__DIR__}/Default/*.runtime_deps zip -r chromium.zip Default/ ``` 4、启动 ``` #!/bin/bash set -exu __DIR__=$(cd "$(dirname "$0")";pwd) cd ${__DIR__} uuid=$(cat /proc/sys/kernel/random/uuid) dir="/tmp/${uuid}" if [ ! -d $dir ] ;then mkdir $dir fi export GOOGLE_API_KEY="no" export GOOGLE_DEFAULT_CLIENT_ID="no" export GOOGLE_DEFAULT_CLIENT_SECRET="no" #加载浏览器扩展 extensions=`${__DIR__}/extension-v3-test,${__DIR__}/ReplaceGoogleCDN/extension` ${__DIR__}/Default/chrome \ --user-data-dir=$dir \ --show-app-list \ --start-maximized \ --enable-remote-extensions \ --enable-extensions \ --remote-debugging-port=9222 \ --enable-logging=stderr --v=1 \ --load-extension="$extensions" \ chrome://version/ # 浏览器自动打开调试窗口 # --auto-open-devtools-for-tabs # 浏览器使用http代理 # --proxy-server="http=127.0.0.1:8016;https=127.0.0.1:8016" # 浏览器使用socks5代理 # --proxy-server="socks5://127.0.0.1:1080" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1" # 浏览器使用pac代理 # --proxy-pac-url="http://localhost:8000/proxy.pac" ```