注1:本文檔適用webrtc-ios源碼的下載和編譯;
注2:下載編譯所使用的操作系統為mac 終端;
Chromium和Chromium OS統一使用一個叫做depot_tools的工具的對其源碼進行checkout的管理(這有點類似于Android使用repo工具對其源碼進行管理一樣),作為Chromium其中一個子模塊的webrtc而言,也是使用這個工具對其代碼進行checkout。這個depot_rools包里面包含了gclient、gcl、git-cl、repo等工具。
下載depot_tools工具包并放到標準路徑PATH上:
? 首先確保mac上安裝了Git 2.2.1以上版本,以及Python 2.7以上版本;
?git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
? 修改root目錄中的.bash_profile文件,.bash_profile文件是一個隱藏文件,可在root目錄下使用命令ls -a將隱藏文件顯示出來,然后vi .bash_profile 進行編輯,增加:export PATH=$PATH:‘pwd’/depot_tools:$PATH,然后按Esc + shift + 冒號,輸入wq,進行保存。注意一定要把depot_tools的位置放在PATH的最前面;
參考:https://dev.chromium.org/developers/how-tos/install-depot-tools
下載webrtc-ios代碼及編譯流程(首先要先按照以上步驟下載depot_tools ):
mkdir webrtc-ios
cd webrtc-ios
fetch --nohooks webrtc_ios
gclient sync//代碼下載過程中如果發生中斷,使用gclient sync同步就可以了
cd src/build/install-build-deps.sh(只需要在第一次gclient sync以后執行一次)
1.編譯Mac OS AppRTCMobile
gn gen out/Debug
ninja -C out/Debug
2編譯64位真機 AppRTCMobile
gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64"'
ninja -C out/ios_64
安裝AppRTCMobile :
WebRTC代碼后期更新的三種方式(在src目錄下):
?當前代碼在某個分支下進行維護,使用git pull可以拉取遠程倉庫的最新更新;
? ?當前代碼不在分支下,使用git fetch取下來最新的git倉庫更新;
? ?需要定期更新依賴或者其他第三方庫,使用gclient sync命令;
參考:https://webrtc.org/native-code/ios/
附錄:
1.webrtc-ios版本下載過程中 $ gclient sync時出現的問題
問題描述:
出現Hook 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' took 8760.95 secs 后,不執行了。
解決辦法:
找到src/DEPS文件,將下面這幾行代碼注釋掉
{
?# Download test resources, i.e. video and audio files from Google Storage.
'pattern': '.',
?'action': ['download_from_google_storage',
'--directory',
?'--recursive',
? '--num_threads=10',
'--no_auth',
?'--quiet',
?'--bucket', 'chromium-webrtc-resources',
'src/resources']
},