制作镜像git仓库参考链接
https://maojie.github.io/2019/03/26/webrtc_tutorial/
https://blog.csdn.net/luansxx/article/details/89597525
步骤:
1、安装docker,并配置镜像加速,参考https://www.runoob.com/docker/docker-mirror-acceleration.html
2、拉取ubuntu 18.04 docker镜像,参考https://hub.docker.com/_/ubuntu?tab=tags
3、进入ubuntu docker镜像
4、执行mv /etc/apt/sources.list /etc/apt/sources.list.bak
5、更换下面的apt源,然后执行apt update
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse">>/etc/apt/sources.list
6、安装vim、ssh服务,apt install vim;apt-get install openssh-server
并设置允许root 登录vim /etc/ssh/sshd_config
找到PermitRootLogin without-password 修改为PermitRootLogin yes,并启用sshd服务 /etc/init.d/ssh start
,记得更改一下docker容器root密码(宿主机ssh/git访问docker,记得需要docker容器启动映射22端口,并使用宿主机上显示的vEthernet网络的ip)找到PermitRootLogin without-password
修改为PermitRootLogin yes
7、安装git 、wget和python,apt install git; apt install wget; apt install python
8、配置代理,需翻墙,根据局域网ip和翻墙软件http代理端口配置
git config --global http.proxy http://you_proxy_ip:you_proxy_port
git config --global https.proxy https://you_proxy_ip:you_proxy_port
9、进入root目录,创建webrtc目录,cd root; mkdir webrtc
执行git clone https://chromium.googlesource.com/chromium/tools/depot_tools
(需要再墙外)
或者使用git clone https://source.codeaurora.org/quic/lc/chromium/tools/depot_tools
(参考https://www.cnblogs.com/yemaomao/p/12461055.html)
10、在~/.bashrc 中添加export PATH=/root/webrtc/depot_tools:$PATH
保存后执行source ~/.bashrc
11、执行mkdir webrtc-cache ;mkdir webrtc; cd webrtc
12、创建.gclient文件
solutions = [
{ "name" : "src",
"url": "https://chromium.googlesource.com/chromium/src.git",
"deps_file" : "DEPS",
"managed" : True,
"custom_deps" : {
},
"safesync_url": "",
},
]
cache_dir = "/root/webrtc-cache"
target_os = [
"linux",
"win",
"mac",
"ios",
"android"
]
13、根据提示解决问题(如:手动下载 .cipd_client、配置wget代理)
export http_proxy=http://you_proxy_ip:you_proxy_port
export https_proxy=https://you_proxy_ip:you_proxy_port
14、执行gclient sync --nohook --with_tags --ignore_lock
,出错重新执行该语句直到正常结束无报错
15、此时 depot_tools、webrtc源码src文件夹、webrtc-cache依赖项目的git仓库均拉取完毕
16、准备使用Gitolite搭建webrtc镜像的依赖项目的仓库,以下过程参考文章开始处推荐的第一篇,请阅读后继续
17、在某台工作主机上,生成ssh公钥和私钥ssh-keygen -t rsa -f gitolite
,你将得到两个文件gitolite 和 gitolite.pub,将gitolite.pub拷贝到docker服务器上的~/.ssh/文件夹下,安装gitolite
$ apt-get install gitolite3
建立gitolite3管理仓库,执行gitolite setup -pk gitolite.pub
,会得到两个仓库
/your-user-home-dir/repositories/gitolite-admin.git
/your-user-home-dir/repositories/testing.git
在工作机上配置ssh登录验证
$ vi ~/.ssh/config # Add the following content
host [your-docker-reflex-veth-ip]
HostName [your-docker-name]
IdentityFile ~/.ssh/gitolite
User [your-docker-username]
Port [your-docker-ssh-reflex-export-port]
并拉取gitolite仓库的配置仓库,下面命令中:"x.x.x.x"代表your-docker-reflex-veth-ip,"port"是your-docker-ssh-reflex-export-port (docker容器导出的映射内部sshd服务22端口的外部端口)
$ git clone ssh://[username]@[x.x.x.x]:[port]/gitolite-admin.git
# or "git clone [username]@[x.x.x.x]/gitolite-admin.git " if you assign the 'Port' in ~/.ssh/config
# gitolite-admin has two directories
gitolite-admin/conf/gitolite.conf to manage the remote repositories
gitolite-admin/keydir/ to manage the public keys
在docker镜像上建立webrtc third_party库的映射,执行以下命令
mkdir -p /root/repositories/platform/external
mkdir -p /root/repositories/breakpad
mkdir -p /root/repositories/chromium/deps
mkdir -p /root/repositories/chromium/deps/yasm
mkdir -p /root/repositories/chromium/llvm-project/cfe/tools
mkdir -p /root/repositories/chromium/llvm-project/compiler-rt/lib
mkdir -p /root/repositories/chromium/src
mkdir -p /root/repositories/chromium/src/third_party
mkdir -p /root/repositories/chromium/tools
mkdir -p /root/repositories/external/github.com/cisco
mkdir -p /root/repositories/external/github.com/google
mkdir -p /root/repositories/external/github.com/gradle
mkdir -p /root/repositories/external/github.com/harfbuzz
mkdir -p /root/repositories/external/github.com/kennethreitz
mkdir -p /root/repositories/external/github.com/llvm/llvm-project
mkdir -p /root/repositories/external/github.com/open-source-parsers
mkdir -p /root/repositories/external/github.com/sctplab
mkdir -p /root/repositories/external/mockito
mkdir -p /root/repositories/infra/luci
mkdir -p /root/repositories/libyuv
mkdir -p /root/repositories/webm
ln -s /root/webrtc/webrtc-cache/android.googlesource.com-platform-external-perfetto /root/repositories/platform/external/perfetto.git
ln -s /root/webrtc/webrtc-cache/aomedia.googlesource.com-aom /root/repositories/aom.git
ln -s /root/webrtc/webrtc-cache/boringssl.googlesource.com-boringssl /root/repositories/boringssl.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-android_ndk /root/repositories/android_ndk.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-breakpad-breakpad /root/repositories/breakpad/breakpad.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-catapult /root/repositories/catapult.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-findbugs /root/repositories/chromium/deps/findbugs.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-icu /root/repositories/chromium/deps/icu.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-libjpeg_turbo /root/repositories/chromium/deps/libjpeg_turbo.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-libsrtp /root/repositories/chromium/deps/libsrtp.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-nasm /root/repositories/chromium/deps/nasm.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-yasm-binaries /root/repositories/chromium/deps/yasm/binaries.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-llvm--project-cfe-tools-clang--format /root/repositories/chromium/llvm-project/cfe/tools/clang-format.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-llvm--project-compiler--rt-lib-fuzzer /root/repositories/chromium/llvm-project/compiler-rt/lib/fuzzer.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-base /root/repositories/chromium/src/base.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-build /root/repositories/chromium/src/build.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-buildtools /root/repositories/chromium/src/buildtools.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-ios /root/repositories/chromium/src/ios.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-testing /root/repositories/chromium/src/testing.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-third_party /root/repositories/chromium/src/third_party.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-third_party-freetype2 /root/repositories/chromium/src/third_party/freetype2.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-third_party-libunwindstack /root/repositories/chromium/src/third_party/libunwindstack.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-tools /root/repositories/chromium/src/tools.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-third_party-ffmpeg /root/repositories/chromium/third_party/ffmpeg.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-third_party-ub--uiautomator /root/repositories/chromium/third_party/ub-uiautomator.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-tools-depot_tools /root/repositories/chromium/tools/depot_tools.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-colorama /root/repositories/external/colorama.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-fontconfig /root/repositories/external/fontconfig.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-cisco-openh264 /root/repositories/external/github.com/cisco/openh264.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-benchmark /root/repositories/external/github.com/google/benchmark.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-compact_enc_det /root/repositories/external/github.com/google/compact_enc_det.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-googletest /root/repositories/external/github.com/google/googletest.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-gtest--parallel /root/repositories/external/github.com/google/gtest-parallel.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-turbine /root/repositories/external/github.com/google/turbine.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-gradle-gradle /root/repositories/external/github.com/gradle/gradle.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-harfbuzz-harfbuzz /root/repositories/external/github.com/harfbuzz/harfbuzz.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-kennethreitz-requests /root/repositories/external/github.com/kennethreitz/requests.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-llvm-llvm--project-libcxx /root/repositories/external/github.com/llvm/llvm-project/libcxx.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-llvm-llvm--project-libcxxabi /root/repositories/external/github.com/llvm/llvm-project/libcxxabi.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-llvm-llvm--project-libunwind /root/repositories/external/github.com/llvm/llvm-project/libunwind.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-open--source--parsers-jsoncpp /root/repositories/external/github.com/open-source-parsers/jsoncpp.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-sctplab-usrsctp /root/repositories/external/github.com/sctplab/usrsctp.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-junit /root/repositories/external/junit.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-mockito-mockito /root/repositories/external/mockito/mockito.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-infra-luci-client--py /root/repositories/infra/luci/client-py.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-libyuv-libyuv /root/repositories/libyuv/libyuv.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-linux--syscall--support /root/repositories/linux-syscall-support.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-webm-libvpx /root/repositories/webm/libvpx.git
n -s /root/webrtc/webrtc/src/.git /root/repositories/src.git
ln -s /root/webrtc/depot_tools/.git /root/repositories/depot_tools.git
在工作主机刚刚拉取下来的gitolite的仓库配置文件中,添加与上述.git对应的所有的third_party库配置
$ vim gitolite-admin/conf/gitolite.conf
#add these config
repo platform/external/perfetto
RW+ = @all
repo aom
RW+ = @all
repo boringssl
RW+ = @all
repo android_ndk
RW+ = @all
repo breakpad/breakpad
RW+ = @all
repo catapult
RW+ = @all
repo chromium/deps/findbugs
RW+ = @all
repo chromium/deps/icu
RW+ = @all
repo chromium/deps/libjpeg_turbo
RW+ = @all
repo chromium/deps/libsrtp
RW+ = @all
repo chromium/deps/nasm
RW+ = @all
repo chromium/deps/yasm/binaries
RW+ = @all
repo chromium/llvm-project/cfe/tools/clang-format
RW+ = @all
repo chromium/llvm-project/compiler-rt/lib/fuzzer
RW+ = @all
repo chromium/src/base
RW+ = @all
repo chromium/src/build
RW+ = @all
repo chromium/src/buildtools
RW+ = @all
repo chromium/src/ios
RW+ = @all
repo chromium/src/testing
RW+ = @all
repo chromium/src/third_party
RW+ = @all
repo chromium/src/third_party/freetype2
RW+ = @all
repo chromium/src/third_party/libunwindstack
RW+ = @all
repo chromium/src/tools
RW+ = @all
repo chromium/third_party/ffmpeg
RW+ = @all
repo chromium/third_party/ub-uiautomator
RW+ = @all
repo chromium/tools/depot_tools
RW+ = @all
repo external/colorama
RW+ = @all
repo external/fontconfig
RW+ = @all
repo external/github.com/cisco/openh264
RW+ = @all
repo external/github.com/google/benchmark
RW+ = @all
repo external/github.com/google/compact_enc_det
RW+ = @all
repo external/github.com/google/googletest
RW+ = @all
repo external/github.com/google/gtest-parallel
RW+ = @all
repo external/github.com/google/turbine
RW+ = @all
repo external/github.com/gradle/gradle
RW+ = @all
repo external/github.com/harfbuzz/harfbuzz
RW+ = @all
repo external/github.com/kennethreitz/requests
RW+ = @all
repo external/github.com/llvm/llvm-project/libcxx
RW+ = @all
repo external/github.com/llvm/llvm--project/libcxxabi
RW+ = @all
repo external/github.com/llvm/llvm--project/libunwind
RW+ = @all
repo external/github.com/open--source--parsers/jsoncpp
RW+ = @all
repo external/github.com/sctplab/usrsctp
RW+ = @all
repo external/junit
RW+ = @all
repo external/mockito/mockito
RW+ = @all
repo infra/luci/client--py
RW+ = @all
repo libyuv/libyuv
RW+ = @all
repo linux--syscall--support
RW+ = @all
repo webm/libvpx
RW+ = @all
repo src
RW+ = @all
repo depot_tools
RW+ = @all
在工作主机上把更新的gitolite的仓库配置上传到docker镜像上去
$ cd gitolite-admin
$ git add conf/gitolite.conf
$ git commit -m "Expose all the related repos"
$ git push origin master
如果更新用户后,用户无法正确拉取库,则登录docker镜像执行以下
$ gitolite compile
18、再工作主机某目录执行下列操作,拉取depot_tools和webrtc源码。下述命令中:"x.x.x.x"代表your-docker-reflex-veth-ip,"port"是your-docker-ssh-reflex-export-port (docker容器导出的映射内部sshd服务22端口的外部端口)
$ git clone ssh://[username]@[x.x.x.x]:[port]/depot_tools.git
$ mkdir webrtc
$ cd webrtc
$ git clone ssh://[username]@[x.x.x.x]:[port]/src.git
19、在webrtc源码“src"文件夹所在目录,新建.gclient文件内容为
solutions = [
{
"url": "ssh://[username]@[x.x.x.x]:[port]/src.git",
"managed": False,
"name": "src",
"deps_file": "DEPS",
"custom_deps": {},
},
]
20、再查看src/DEPS文件,进行如下替换
Replace 'https://chromium.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
Replace 'https://boringssl.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
Replace 'https://aomedia.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
Replace 'https://android.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
21、将depot_tools目录导出到PATH,
export PATH=/root/webrtc/depot_tools:$PATH
在src目录执行
gclient sync --nohooks --verbose
注:上述步骤做完,只是在docker建立了webrtc源码镜像和third_party源码镜像,但是webrtc构建还需要依赖多个cipd库的资源,这些资源由glcient sync
命令获取,由于防火墙\google等的限制不易获取。因此可以拷贝一份docker镜像中拉取完整的webrtc的源码src目录,剔除src下的所有.git,并把.gitignore中cipd相关的忽略项删除(cipd项见src下的DEPS文件,搜索cipd),剔除后对该副本src建立git远程仓库,则所有third_party以及拉取完成的cipd依赖会全部在该远程仓库中。开发、维护可以在该远程仓库下进行。此外,在所有的开发环境中,需要把depot_tools建立好,可以拷贝其他用户环境下现成的depot_tools并设置环境变量DEPOT_TOOLS_UPDATE=0
禁止depot_tools自动更新,或者安装前面的步骤去执行client sync更新depot_tools。
22、webrtc编译
(1)在src目录下执行,gn args out/Default
会打开在src/out/Default下的args.gn文件用于配置gn编译标志。
(2)执行gn args out/Default --list
会展示所有可配置标志