轉自:http://blog.csdn.net/fsz521/article/details/18036835
下源碼
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git (https慢可以換成http)
export PATH="$PATH":`pwd`/depot_tools(也可添加到環境變量文件中“PATH=$PATH:~/Chromium/depot_tools“)
git config --global user.name "My Name"
git config --global user.email "my@email"
git config --global core.autocrlf false
git config --global core.filemode false
gclient config https://chromium.googlesource.com/chromium/src.git --git-deps
打開.gclient文件,設置不下載無用代碼:
"custom_deps"字段中添加:
"custom_deps": {
"src/content/test/data/layout_tests/LayoutTests": None,
"src/chrome/tools/test/reference_build/chrome_win": None,
"src/chrome_frame/tools/test/reference_build/chrome_win":None,
"src/chrome/tools/test/reference_build/chrome_linux":None,
"src/chrome/tools/test/reference_build/chrome_mac": None,
"src/third_party/hunspell_dictionaries": None,
},
最后一行添加:
target_os= ['android']
gclient sync --nohooks
. src/build/android/envsetup.sh
gclient runhooks
配環境
cd src
sudo build/install-build-deps-android.sh --no-chromeos-fonts
安裝oracle的jdk6
編譯目標
export GYP_GENERATORS=ninja
. build/android/envsetup.sh
android_gyp
ninja -C out/Debug android_webview_apk
運行目標
out/Debug/apk下有編譯出的apk文件,安裝到android手機或模擬器即可。
碰到的疑惑與問題
gclient sync--nohooks:下載源碼,執行時間長,耐心等待
gclientrunhooks:下載一些東西過程中提示出錯,保險起見,根據官方意見:
------------------
Bootstrap notes for Ubuntu
The first time you do a fetch, you maynot have all the build dependencies installed that are required, andgclient runhooks will fail. You can resolve this after fetching byrunning the install-build-deps.sh script:
cd /path/to/chromium/src
./build/install-build-deps.sh
Then run gclient runhooks again tofinish the fetch process.
---------------------
先執行這里命令./build/install-build-deps.sh,但會報錯:ChromeOS fonts下載不下來。
根據出錯提示,執行命令:
./build/install-build-deps.sh--no-chromeos-fonts,
執行成功。
執行ninja命令時提示找不到ninja:
執行命令exportPATH="$PATH":`pwd`/depot_tools(該環境變量僅對當前命令窗口有效,可添加到系統環境變量中)
gclient sync --nohooks
. build/android/envsetup.sh
gclient runhooks
sudobuild/install-build-deps-android.sh --no-chromeos-fonts
sudo build/install-build-deps.sh--no-chromeos-fonts
. build/android/envsetup.sh
android_gyp
ninja -C out/Release content_shell_apk
chromium_testshell
android_webview_apk(運行:
adb_run_android_webview_shellhttp://www.google.com)
mkdir Chromium && cd Chromium
git clonehttp://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH":`pwd`/depot_tools
exportPATH="$PATH":`pwd`/depot_toolsgclient confighttp://chromium.googlesource.com/chromium/src.git--git-deps"src/third_party/WebKit/LayoutTests":None,"src/content/test/data/layout_tests/LayoutTests":None,"src/content/test/data/layout_tests/LayoutTests":None,"src/chrome/tools/test/reference_build/chrome_win":None,"src/chrome_frame/tools/test/reference_build/chrome_win":None,"src/chrome/tools/test/reference_build/chrome_linux":None,"src/chrome/tools/test/reference_build/chrome_mac":None,"src/third_party/hunspell_dictionaries":None,target_os = ['android']
參考:
下載源碼
http://dev.chromium.org/developers/how-tos/get-the-code
http://blog.csdn.net/yajun0601/article/details/8583289
編譯
https://code.google.com/p/chromium/wiki/AndroidBuildInstructions