WebRTC在Windows、Linux、Macos和Android下的下載及編譯


這是一個由 聲網Agora WebRTC團隊提供的 WebRTC 鏡像源,你可以使用此版本代替 Google 官方版本,此鏡像保持與Chrome正式版同步,目前為M84。

如遇到問題,請在此地址發帖:https://rtcdeveloper.com/t/topic/14914

官方英文文檔,請見:https://www.w3.org/TR/webrtc/

中文文檔開源版本,請見:https://github.com/RTC-Developer/WebRTC-Documentation-in-Chinese

 

1. 環境配置

指定同步目錄

export WORKSPACE=`pwd`

安裝depot_tools

cd $WORKSPACE rm -rf depot_tools && git clone https://webrtc.bj2.agoralab.co/webrtc-mirror/depot_tools.git chmod +x $WORKSPACE/depot_tools/cipd export PATH=$PATH:$WORKSPACE/depot_tools 

同步WebRTC

mkdir -p $WORKSPACE/webrtc && cd $WORKSPACE/webrtc vi .gclient //添加以下內容 solutions = [ { "name" : "src", "url" : "https://webrtc.bj2.agoralab.co/webrtc-mirror/src.git@65e8d9facab05de13634d777702b2c93288f8849", "deps_file" : "DEPS", "managed" : False, "safesync_url": "", "custom_deps": { }, }, ] target_os = ["linux"] /*根據需要Android, ios*/ //開始同步,時間較久 date; gclient sync; date //出現提示是否使用谷歌的depot_tools,推薦“n”,或者等1分鍾提示框超時。 //因為gclient sync獲取源碼之后,會向谷歌獲取其它數據,如果因此報錯,不想看到這個錯誤的話,可以設置代理之后再次sync export http_proxy=x.x.x.x:port export https_proxy=x.x.x.x:port date; gclient sync; date 

2. 編譯

Linux

apt-get update apt-get install -y g++ export PATH=$PATH:$WORKSPACE/depot_tools cd $WORKSPACE/webrtc/src ./build/install-build-deps.sh gn gen out/Release "--args=is_debug=false" ninja -C out/Release

Android

# 安裝依賴 apt-get install -y software-properties-common add-apt-repository -y ppa:openjdk-r/ppa ./build/install-build-deps-android.sh # 添加安卓平台 cd $WORKSPACE/webrtc #echo "target_os = [ 'android' ]" >>.gclient # 同步 export PATH=$PATH:$WORKSPACE/depot_tools cd $WORKSPACE/webrtc && gclient sync --patch-ref=https://chromium.googlesource.com/chromium/src/build.git@gitlab # 編譯 cd $WORKSPACE/webrtc/src gn gen android/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm64\"" ninja -C android/Release

iOS/macOS

export PATH=$PATH:$WORKSPACE/depot_tools export CDS_CLANG_BUCKET_OVERRIDE=https://chromiumsrc.gitlab.io/commondatastorage/chromium-browser-clang git.sh # 安裝depot_tools cd $WORKSPACE rm -rf depot_tools && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools cd $WORKSPACE/depot_tools && git checkout gitlab chmod +x $WORKSPACE/depot_tools/cipd cd $WORKSPACE rm -rf $WORKSPACE/webrtc && mkdir $WORKSPACE/webrtc cd $WORKSPACE/webrtc && \ gclient config --name src https://chromium.googlesource.com/external/webrtc.git@gitlab cd $WORKSPACE/webrtc && \ gclient sync\ --patch-ref=https://chromium.googlesource.com/chromium/src/build.git@gitlab sudo xcode-select -s /Applications/Xcode.app/Contents/Developer cd $WORKSPACE/webrtc/src && \ gn gen out/Release "--args=is_debug=false" cd $WORKSPACE/webrtc/src && \ ninja -C out/Release
#安裝依賴 1. git - https://git-scm.com/download/win 2. visualstudio2017community - https://download.visualstudio.microsoft.com/download/pr/aaebc214-bc67-4137-9bea-04fcb0c90720/2e18f27594472d0c7515d9cbe237bd56/vs_community.exe > 2.1 Modify "Windows Software Development Kit" > +Debugging Tools for Windows 3. python2 - https://www.python.org/downloads/release/python-2716/ > 3.1 pip install pywin32 #設置 1. 執行git.sh #安裝depot_tools cd %USERPROFILE% rd /s /q depot_tools webrtc & git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git -b gitlab #配置 set PATH=%PATH%;%USERPROFILE%\depot_tools cd %USERPROFILE% && ^ rd /s /q webrtc & mkdir webrtc cd %USERPROFILE%\webrtc && ^ gclient config --name src https://chromium.googlesource.com/external/webrtc.git@gitlab #同步 set DEPOT_TOOLS_WIN_TOOLCHAIN=0 cd %USERPROFILE%\webrtc && ^ gclient sync --patch-ref=https://chromium.googlesource.com/chromium/src/build.git@gitlab #生成 cd %USERPROFILE%\webrtc\src && ^ gn gen out/Release "--args=is_debug=false" #編譯 cd %USERPROFILE%\webrtc\src && ^ ninja -C out/Release

3. 附錄-依賴及鏡像列表

整個開源WebRTC編譯時需要下載的依賴列表



https://chromium.googlesource.com/chromium/src/base
https://chromium.googlesource.com/chromium/src/build
https://chromium.googlesource.com/chromium/src/buildtools
https://chromium.googlesource.com/external/github.com/gradle/gradle
https://chromium.googlesource.com/chromium/src/ios
https://chromium.googlesource.com/chromium/src/testing
https://chromium.googlesource.com/chromium/src/third_party
https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format
https://chromium.googlesource.com/chromium/llvm-project/libcxx
https://chromium.googlesource.com/chromium/llvm-project/libcxxabi
https://chromium.googlesource.com/external/llvm.org/libunwind
https://chromium.googlesource.com/android_ndk
https://chromium.googlesource.com/android_tools
https://chromium.googlesource.com/external/github.com/google/auto
https://chromium.googlesource.com/catapult
https://chromium.googlesource.com/external/github.com/google/compact_enc_det
https://chromium.googlesource.com/external/colorama
https://chromium.googlesource.com/chromium/tools/depot_tools
https://chromium.googlesource.com/chromium/third_party/errorprone
https://chromium.googlesource.com/chromium/third_party/ffmpeg
https://chromium.googlesource.com/chromium/deps/findbugs
https://chromium.googlesource.com/chromium/src/third_party/freetype2
https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz
https://chromium.googlesource.com/external/github.com/google/gtest-parallel
https://chromium.googlesource.com/external/github.com/google/googletest
https://chromium.googlesource.com/chromium/deps/icu
https://chromium.googlesource.com/external/jsr-305
https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp
https://chromium.googlesource.com/external/junit
https://chromium.googlesource.com/chromium/llvm-project/compiler-rt/lib/fuzzer
https://chromium.googlesource.com/chromium/deps/libjpeg_turbo
https://chromium.googlesource.com/chromium/deps/libsrtp
https://chromium.googlesource.com/webm/libvpx
https://chromium.googlesource.com/libyuv/libyuv
https://chromium.googlesource.com/linux-syscall-support
https://chromium.googlesource.com/external/mockito/mockito
https://chromium.googlesource.com/chromium/deps/nasm
https://chromium.googlesource.com/external/github.com/cisco/openh264
https://chromium.googlesource.com/external/github.com/kennethreitz/requests
https://chromium.googlesource.com/external/robolectric
https://chromium.googlesource.com/chromium/third_party/ub-uiautomator
https://chromium.googlesource.com/external/github.com/sctplab/usrsctp
https://chromium.googlesource.com/chromium/deps/yasm/binaries
https://chromium.googlesource.com/chromium/deps/yasm/patched-yasm
https://chromium.googlesource.com/chromium/src/tools
https://chromium.googlesource.com/infra/luci/client-py

系統官方國內鏡像列表


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM