From bc7925985c06b6eafec9000edc0e02b553c00cad Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 14 Aug 2020 09:45:41 +0300 Subject: [PATCH] Added WebRTC building to Github CI. --- .github/workflows/linux.yml | 53 +++++++++++++++++++++- .github/workflows/mac.yml | 39 +++++++++++++++- .github/workflows/win.yml | 89 +++++++++++++++++++++++++++++++------ docs/building-cmake.md | 4 +- docs/building-msvc.md | 6 +-- docs/building-xcode.md | 6 +-- 6 files changed, 172 insertions(+), 25 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 18e05c02d3..63f3684edc 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -95,7 +95,8 @@ jobs: libgtk2.0-dev libice-dev libsm-dev libicu-dev libdrm-dev dh-autoreconf \ autoconf automake build-essential libxml2-dev libass-dev libfreetype6-dev \ libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \ - libvorbis-dev libxcb1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-screensaver0-dev \ + libvorbis-dev libxcb1-dev libxcb-image0-dev libxcb-shm0-dev \ + libxcb-screensaver0-dev libjpeg-dev \ libxcb-xfixes0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libatspi2.0-dev \ libxcb-render-util0-dev libxcb-util0-dev libxcb-xkb-dev libxrender-dev \ libasound-dev libpulse-dev libxcb-sync0-dev libxcb-randr0-dev libegl1-mesa-dev \ @@ -373,7 +374,7 @@ jobs: make -j$(nproc) sudo make DESTDIR="$LibrariesPath/openssl-cache" install_sw cd .. - rm -rf $opensslDir + # rm -rf $opensslDir # Keep this folder for WebRTC. - name: OpenSSL install. run: | cd $LibrariesPath @@ -512,6 +513,54 @@ jobs: mkdir -p breakpad/out/Default/ cp breakpad-cache/dump_syms breakpad/out/Default/dump_syms + - name: WebRTC cache. + id: cache-webrtc + uses: actions/cache@v2 + with: + path: ${{ env.LibrariesPath }}/webrtc + key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ hashFiles('**/patches/webrtc/*') }} + - name: WebRTC. + if: steps.cache-webrtc.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + # # OpenSSL. + # opensslDir=openssl_${OPENSSL_VER} + # mkdir $opensslDir + # cp -R $OPENSSL_PREFIX/ $opensslDir/ + # cd openssl-cache + # cp $(find . | grep libssl.a) $LibrariesPath/$opensslDir + # cp $(find . | grep libcrypto.a) $LibrariesPath/$opensslDir + + # cd $LibrariesPath + + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + export PATH=`pwd`/depot_tools:$PATH + + mkdir webrtc + cd webrtc + cp ../patches/webrtc/.gclient ./ + git clone https://github.com/open-webrtc-toolkit/owt-deps-webrtc src + gclient sync --no-history + + applyPatch() { + cd $LibrariesPath/webrtc/$1 + git apply $LibrariesPath/patches/webrtc/$(basename $1).diff + } + applyPatch src + applyPatch src/build + applyPatch src/third_party + applyPatch src/third_party/libsrtp + + cd $LibrariesPath/webrtc/src + ../../patches/webrtc/configure.sh + + ninja -C out/Debug webrtc + + # Cleanup. + ../../patches/webrtc/cleanup_webrtc.sh + rm -rf $LibrariesPath/openssl_${OPENSSL_VER} + - name: Telegram Desktop build. if: env.ONLY_CACHE == 'false' run: | diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 7036ac9789..0adfa7ff36 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -419,8 +419,8 @@ jobs: run: | cd $LibrariesPath - git clone git://code.qt.io/qt/qt5.git qt$QT - cd qt$QT + git clone git://code.qt.io/qt/qt5.git qt_$QT + cd qt_$QT perl init-repository --module-subset=qtbase,qtimageformats git checkout v5.12.8 git submodule update qtbase @@ -449,6 +449,41 @@ jobs: make clean cp -r $QT_PREFIX $LibrariesPath/qt-cache + - name: WebRTC cache. + id: cache-webrtc + uses: actions/cache@v2 + with: + path: ${{ env.LibrariesPath }}/webrtc + key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ hashFiles('**/patches/webrtc/*') }} + - name: WebRTC. + if: steps.cache-webrtc.outputs.cache-hit != 'true' + run: | + cd $LibrariesPath + + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + export PATH=`pwd`/depot_tools:$PATH + + mkdir webrtc + cd webrtc + cp ../patches/webrtc/.gclient ./ + git clone https://github.com/open-webrtc-toolkit/owt-deps-webrtc src + gclient sync --no-history + + applyPatch() { + cd $LibrariesPath/webrtc/$1 + git apply $LibrariesPath/patches/webrtc/$(basename $1).diff + } + applyPatch src + applyPatch src/build + applyPatch src/third_party + applyPatch src/third_party/libsrtp + + cd $LibrariesPath/webrtc/src + ../../patches/webrtc/configure.sh + + ninja -C out/Debug webrtc + ../../patches/webrtc/cleanup_webrtc.sh + - name: Telegram Desktop build. if: env.ONLY_CACHE == 'false' run: | diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index aaf1ba4a42..4242e73f06 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -60,6 +60,7 @@ jobs: VC: "call vcvars32.bat && cd Libraries" GIT: "https://github.com" QT: "5_12_8" + QT_VER: "5.12.8" OPENSSL_VER: "1_1_1" UPLOAD_ARTIFACT: "false" ONLY_CACHE: "false" @@ -121,6 +122,20 @@ jobs: cd Patches eval $checkoutCommit + - name: Find any version of Python 2. + shell: cmd + run: | + echo Find any version of Python 2. + for /D %%a in (C:\hostedtoolcache\windows\Python\2.*) do ( + SET PY2=%%a\x64 + ) + if [%PY2%] == [] ( + echo Python 2 is not found. + exit 1 + ) + echo Found %PY2%. + echo ::set-env name=PY2::%PY2% + - name: LZMA. shell: cmd run: | @@ -214,16 +229,6 @@ jobs: run: | cd %LibrariesPath% - echo Find any version of Python 2. - for /D %%a in (C:\hostedtoolcache\windows\Python\2.*) do ( - SET PY2=%%a\x64 - ) - IF [%PY2%] == [] ( - echo Python 2 is not found. - exit 1 - ) - echo Found %PY2%. - git clone %GIT%/telegramdesktop/gyp.git cd gyp SET PATH=%PY2%;%cd%;%PATH% @@ -293,7 +298,7 @@ jobs: id: cache-qt uses: actions/cache@v2 with: - path: ${{ env.LibrariesPath }}/Qt-5.12.8 + path: ${{ env.LibrariesPath }}/Qt-${{ env.QT_VER }} key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_8/*') }} - name: Configure Qt 5.12.8. if: steps.cache-qt.outputs.cache-hit != 'true' @@ -304,7 +309,7 @@ jobs: git clone git://code.qt.io/qt/qt5.git qt_%QT% cd qt_%QT% perl init-repository --module-subset=qtbase,qtimageformats - git checkout v5.12.8 + git checkout v%QT_VER% git submodule update qtbase git submodule update qtimageformats cd qtbase @@ -315,7 +320,7 @@ jobs: SET LIBS=libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib configure ^ - -prefix "%LibrariesPath%\Qt-5.12.8" ^ + -prefix "%LibrariesPath%\Qt-%QT_VER%" ^ -debug ^ -force-debug-info ^ -opensource ^ @@ -343,6 +348,64 @@ jobs: cd .. rmdir /S /Q qt_%QT% + - name: WebRTC cache. + id: cache-webrtc + uses: actions/cache@v2 + with: + path: ${{ env.LibrariesPath }}/webrtc + key: ${{ runner.OS }}-webrtc-2-${{ env.CACHE_KEY }}-${{ hashFiles('**/patches/webrtc/*') }} + - name: WebRTC. + if: steps.cache-webrtc.outputs.cache-hit != 'true' + shell: cmd + run: | + %VC% + + # Qt libjpeg. + mkdir qt_%QT% + cd qt_%QT% + git clone -b %QT_VER% https://github.com/qt/qtbase + + move qtbase\src\3rdparty\libjpeg .. + cd .. + dir + rmdir /S /Q qt_%QT% + mkdir qt_%QT%\qtbase\src\3rdparty\ + move libjpeg qt_%QT%\qtbase\src\3rdparty\ + + # Depot tools. + cd %LibrariesPath% + + curl -O https://storage.googleapis.com/chrome-infra/depot_tools.zip + 7z x depot_tools.zip + cd depot_tools + SET PATH=%PY2%;%cd%;%PATH% + SET DEPOT_TOOLS_WIN_TOOLCHAIN=0 + + # WebRTC. + cd %LibrariesPath% + + mkdir webrtc + cd webrtc + copy ..\patches\webrtc\.gclient .gclient + git clone https://github.com/open-webrtc-toolkit/owt-deps-webrtc src + gclient sync --no-history + cd src + git apply ..\..\patches\webrtc\src.diff + cd build + git apply ..\..\..\patches\webrtc\build.diff + cd ..\third_party + git apply ..\..\..\patches\webrtc\third_party.diff + cd libsrtp + git apply ..\..\..\..\patches\webrtc\libsrtp.diff + cd ..\.. + ..\..\patches\webrtc\configure.bat + ninja -C out/Debug webrtc + + # Cleanup. + ..\..\patches\webrtc\cleanup_webrtc.bat + cd %LibrariesPath% + rmdir /S /Q qt_%QT% + - name: Read defines. shell: bash run: | diff --git a/docs/building-cmake.md b/docs/building-cmake.md index aa39155541..907876d6d6 100644 --- a/docs/building-cmake.md +++ b/docs/building-cmake.md @@ -54,7 +54,7 @@ Go to ***BuildPath*** and run git clone https://github.com/desktop-app/patches.git cd patches - git checkout deeea06 + git checkout 08351e3 cd ../ git clone https://github.com/xiph/opus @@ -280,7 +280,7 @@ Go to ***BuildPath*** and run cd webrtc cp ../patches/webrtc/.gclient ./ git clone https://github.com/open-webrtc-toolkit/owt-deps-webrtc src - gclient sync + gclient sync --no-history cd src git apply ../../patches/webrtc/src.diff cd build diff --git a/docs/building-msvc.md b/docs/building-msvc.md index 3c14077c7b..03e2efea16 100644 --- a/docs/building-msvc.md +++ b/docs/building-msvc.md @@ -34,7 +34,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** cd ThirdParty git clone https://github.com/desktop-app/patches.git cd patches - git checkout deeea06 + git checkout 08351e3 cd ../ git clone https://chromium.googlesource.com/external/gyp cd gyp @@ -67,7 +67,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** git clone https://github.com/desktop-app/patches.git cd patches - git checkout deeea06 + git checkout 08351e3 cd .. git clone https://github.com/desktop-app/lzma.git @@ -169,7 +169,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** cd webrtc copy ..\patches\webrtc\.gclient .gclient git clone https://github.com/open-webrtc-toolkit/owt-deps-webrtc src - gclient sync + gclient sync --no-history cd src git apply ../../patches/webrtc/src.diff cd build diff --git a/docs/building-xcode.md b/docs/building-xcode.md index 361c10d0a3..5153fa165d 100644 --- a/docs/building-xcode.md +++ b/docs/building-xcode.md @@ -29,7 +29,7 @@ Go to ***BuildPath*** and run git clone https://github.com/desktop-app/patches.git cd patches - git checkout deeea06 + git checkout 08351e3 cd ../ git clone https://chromium.googlesource.com/external/gyp git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git @@ -47,7 +47,7 @@ Go to ***BuildPath*** and run git clone https://github.com/desktop-app/patches.git cd patches - git checkout deeea06 + git checkout 08351e3 cd .. git clone https://git.tukaani.org/xz.git @@ -276,7 +276,7 @@ Go to ***BuildPath*** and run cd webrtc cp ../patches/webrtc/.gclient ./ git clone https://github.com/open-webrtc-toolkit/owt-deps-webrtc src - gclient sync + gclient sync --no-history cd src git apply ../../patches/webrtc/src.diff cd build