mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Compare commits
2 commits
92fb3fdc01
...
c4917e8f86
| Author | SHA1 | Date | |
|---|---|---|---|
| c4917e8f86 | |||
| 4475233318 |
4 changed files with 81 additions and 97 deletions
20
README.md
20
README.md
|
|
@ -61,12 +61,7 @@ You can pass WebRTC version (branch) to script to fetch specific version.
|
|||
```
|
||||
git clone https://github.com/UltraCoderRU/libwebrtc.git
|
||||
cd libwebrtc
|
||||
|
||||
# Linux
|
||||
./sync.sh [WEBRTC_VERSION]
|
||||
|
||||
# Windows
|
||||
sync.bat [WEBRTC_VERSION]
|
||||
python3 sync.py [WEBRTC_VERSION]
|
||||
```
|
||||
|
||||
## Compiling
|
||||
|
|
@ -76,23 +71,14 @@ Create an output directory, browse inside it, then run CMake to configure projec
|
|||
```
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Linux:
|
||||
cmake -DCMAKE_BUILD_TYPE=<Debug/Release> -DCMAKE_INSTALL_PREFIX=<install_path> ..
|
||||
|
||||
# Windows
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=<install_path> ..
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=<Debug/Release> -DCMAKE_INSTALL_PREFIX=<install_path> ..
|
||||
```
|
||||
|
||||
After configuration build library using standard CMake commands.
|
||||
|
||||
```
|
||||
# Linux:
|
||||
cmake --build .
|
||||
sudo cmake --build . --target install
|
||||
|
||||
# Windows:
|
||||
cmake --build . --config <Debug/Release> --target INSTALL
|
||||
cmake --install .
|
||||
```
|
||||
|
||||
The library will be located inside the `lib` subdirectory of the `<install_path>`.
|
||||
|
|
|
|||
39
sync.bat
39
sync.bat
|
|
@ -1,39 +0,0 @@
|
|||
@echo off
|
||||
|
||||
REM To determine last stable WebRTC revision,
|
||||
REM see https://chromiumdash.appspot.com/branches
|
||||
REM and https://chromiumdash.appspot.com/schedule
|
||||
set WEBRTC_REVISION=4280
|
||||
|
||||
if not "%1"=="" set WEBRTC_REVISION="%1"
|
||||
|
||||
set REPO_ROOT=%~dp0
|
||||
set PATH=%REPO_ROOT%depot_tools;%PATH%
|
||||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
|
||||
cd %REPO_ROOT%
|
||||
if not exist "depot_tools" (
|
||||
echo Cloning Depot Tools...
|
||||
git.exe clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
)
|
||||
|
||||
echo Updating Depot Tools...
|
||||
cd %REPO_ROOT%\depot_tools
|
||||
call update_depot_tools.bat
|
||||
|
||||
cd %REPO_ROOT%
|
||||
if not exist "webrtc" (
|
||||
echo Cloning WebRTC...
|
||||
mkdir webrtc
|
||||
cd webrtc
|
||||
fetch --nohooks --no-history webrtc
|
||||
)
|
||||
|
||||
echo Updating WebRTC to version %WEBRTC_REVISION%...
|
||||
cd %REPO_ROOT%\webrtc\src
|
||||
call gclient sync --with_branch_heads --reset
|
||||
git.exe fetch
|
||||
git.exe checkout -f -B %WEBRTC_REVISION% branch-heads/%WEBRTC_REVISION%
|
||||
call gclient sync --force -D --reset
|
||||
|
||||
cd %REPO_ROOT%
|
||||
78
sync.py
Executable file
78
sync.py
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def execute(command: str):
|
||||
subprocess.run(command, shell=True, check=True)
|
||||
|
||||
|
||||
def get_output(command: str):
|
||||
return subprocess.run(command, capture_output=True, shell=True, check=True).stdout.decode()
|
||||
|
||||
|
||||
# To determine last stable WebRTC revision,
|
||||
# see https://chromiumdash.appspot.com/branches
|
||||
# and https://chromiumdash.appspot.com/schedule
|
||||
WEBRTC_REVISION = 4692
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
WEBRTC_REVISION = sys.argv[1]
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent
|
||||
DEPOT_TOOLS_DIR = REPO_ROOT / 'depot_tools'
|
||||
WEBRTC_DIR = REPO_ROOT / 'webrtc'
|
||||
SRC_DIR = WEBRTC_DIR / 'src'
|
||||
|
||||
os.environ['PATH'] = '{}{}{}'.format(DEPOT_TOOLS_DIR, os.pathsep, os.environ['PATH'])
|
||||
if sys.platform == 'win32':
|
||||
os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
|
||||
|
||||
os.chdir(REPO_ROOT)
|
||||
if not os.path.isdir(DEPOT_TOOLS_DIR):
|
||||
print('Cloning Depot Tools...')
|
||||
execute('git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git')
|
||||
os.chdir(DEPOT_TOOLS_DIR)
|
||||
|
||||
if sys.platform == 'win32':
|
||||
execute('gclient --version')
|
||||
execute('where python')
|
||||
|
||||
execute('python update_depot_tools_toggle.py --disable')
|
||||
else:
|
||||
print('Updating Depot Tools to the latest revision...')
|
||||
os.chdir(DEPOT_TOOLS_DIR)
|
||||
execute('git checkout -q -f main')
|
||||
execute('git pull -q')
|
||||
|
||||
if not os.path.isdir(WEBRTC_DIR):
|
||||
print('Cloning WebRTC...')
|
||||
os.mkdir(WEBRTC_DIR)
|
||||
os.chdir(WEBRTC_DIR)
|
||||
execute('fetch --nohooks webrtc')
|
||||
os.chdir(SRC_DIR)
|
||||
execute('gclient sync --with_branch_heads --nohooks')
|
||||
else:
|
||||
print('Updating WebRTC branches info...')
|
||||
os.chdir(SRC_DIR)
|
||||
execute('gclient sync --with_branch_heads --nohooks')
|
||||
|
||||
# Latest Depot Tools versions are not compatible
|
||||
# with old WebRTC versions, so we peek revision
|
||||
# from around the same time as the WebRTC and
|
||||
# forbid gclient to auto-update Depot Tools.
|
||||
os.chdir(SRC_DIR)
|
||||
LAST_WEBRTC_COMMIT_DATE = get_output('git log -n 1 --pretty=format:%ci branch-heads/{}'.format(WEBRTC_REVISION)).strip()
|
||||
os.chdir(DEPOT_TOOLS_DIR)
|
||||
DEPOT_TOOLS_COMPATIBLE_REVISION = get_output('git rev-list -n 1 --before="{}" main'.format(LAST_WEBRTC_COMMIT_DATE)).strip()
|
||||
print('Updating Depot Tools to a compatible revision {}...'.format(DEPOT_TOOLS_COMPATIBLE_REVISION))
|
||||
execute('git checkout -f {}'.format(DEPOT_TOOLS_COMPATIBLE_REVISION))
|
||||
|
||||
print('Updating WebRTC to version {}...'.format(WEBRTC_REVISION))
|
||||
os.chdir(SRC_DIR)
|
||||
execute('git clean -ffd')
|
||||
execute('git checkout -q -B {} branch-heads/{}'.format(WEBRTC_REVISION, WEBRTC_REVISION))
|
||||
execute('gclient sync --force -D --reset')
|
||||
41
sync.sh
41
sync.sh
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# To determine last stable WebRTC revision,
|
||||
# see https://chromiumdash.appspot.com/branches
|
||||
# and https://chromiumdash.appspot.com/schedule
|
||||
WEBRTC_REVISION=4280
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
WEBRTC_REVISION=$1
|
||||
fi
|
||||
|
||||
REPO_ROOT=$(dirname $(readlink -f $0))
|
||||
export PATH=${REPO_ROOT}/depot_tools:$PATH
|
||||
|
||||
cd ${REPO_ROOT}
|
||||
if [ ! -d depot_tools ];
|
||||
then
|
||||
echo "Cloning Depot Tools..."
|
||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
fi
|
||||
|
||||
echo "Updating Depot Tools..."
|
||||
cd ${REPO_ROOT}/depot_tools
|
||||
./update_depot_tools
|
||||
|
||||
cd ${REPO_ROOT}
|
||||
if [ ! -d webrtc ];
|
||||
then
|
||||
echo "Cloning WebRTC..."
|
||||
mkdir webrtc
|
||||
cd webrtc
|
||||
fetch --nohooks --no-history webrtc
|
||||
fi
|
||||
|
||||
echo "Updating WebRTC to version ${WEBRTC_REVISION}..."
|
||||
cd ${REPO_ROOT}/webrtc/src
|
||||
gclient sync --with_branch_heads --reset
|
||||
git fetch
|
||||
git checkout -f -B ${WEBRTC_REVISION} branch-heads/${WEBRTC_REVISION}
|
||||
gclient sync --force -D --reset
|
||||
Loading…
Add table
Reference in a new issue