Today talk about the build tool depot_tools

----------------------------------------------------------------------------------------------------------------------

Quickly build rtmpd server in one minute: https://blog.csdn.net/freeabc/article/details/102880984

Software download address: http://www.qiyicc.com/download/rtmpd.zip

github address: https://github.com/superconvert/smart_rtmpd

----------------------------------------------------------------------------------------------------------------------

 Today talk about the build tool depot_tools

 

Dependency of depot_tools:

Please make sure that git and python are installed on your machine. In fact, many commands under depot_tools are actually bash files, and finally execute the corresponding python files. such as:

fetch     --->     fetch.py
gn        --->     gn.py
gclient   --->     gclient.py

When downloading code, version management tools such as git or svn are used 

 

The role of depot_tools:

The compilation of chrome and webrtc is inseparable from a build tool depot_tools. Because the chrome and webrtc projects are too large and depend on more, a build tool is needed to manage them, so that subsequent developers can use this tool to quickly download code , Build the compilation environment, and compile correctly.

因此 depot_tools 的作用就是:

1. 下载,更新,同步代码

2. 构建编译环境,利用 gn 生成 ninja 文件

3. gn 生成的 ninjia 文件并通过工具 ninjia 进行最终编译成想要的目标

 

How to download depot_tools:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

We configure the corresponding environment under the downloaded depot_tools, which is actually adding the path to the system variables (linux, Mac, Windows), so that we can directly use fetch, gclient, gn, ninja commands 

 

 Download code (webrtc as an example):

mkdir webrtc && cd webrtc
linux : fetch --nohooks webrtc
android: fetch --nohooks webrtc_android
ios: fetch --nohooks webrtc_ios
gclient sync

 It was largely unsuccessful because we have a great GFW. Domestic

声网镜像 https://webrtc.org.cn/mirror

学而思镜像 https://gitlab.com/webrtc-mirror

 

Fetch is to get the source code, and glcient basically encapsulates some functions of git and provides batch operations of multiple git repositories.

 

Compile the source code (for example, the android version of webrtc):

Installation dependencies

cd src
./build/install-build-deps.sh
./build/install-build-deps-android.sh

Compilation file generation and compilation

./build/android/envsetup.h
gn gen android/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm64\""
ninja -C android/Release

 After we customize the underlying library, we can recompile according to the above steps and use

 

Common errors and reasons:

1. gn.py: Could not find checkout in any parent of the current path

This is generally because depot_tools is not installed and initialized correctly.

For example, lack of .gclient, .gclient_entries

2.  Could not find gn.exe

This is generally because depot_tools is not installed and initialized correctly.

Guess you like

Origin blog.csdn.net/freeabc/article/details/109027732