├── .github ├── actions │ ├── combine_library │ │ └── action.yml │ └── tar_headers │ │ └── action.yml └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md └── gclient /.github/actions/combine_library/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Combine libraries' 2 | description: 'Combine the WebRTC static libraries into one using platform specific tools.' 3 | inputs: 4 | platform: 5 | description: 'The platform we are building for (android, ios, linux, mac, win).' 6 | required: true 7 | builddir: 8 | description: 'The the ninja build path.' 9 | required: true 10 | allowlist: 11 | description: 'The libraries to copy objects from' 12 | required: true 13 | default: "webrtc boringssl protobuf_lite field_trial_default metrics_default" 14 | outputs: 15 | library: 16 | description: "Path to generated library." 17 | value: ${{ steps.combine.outputs.library }} 18 | runs: 19 | using: "composite" 20 | steps: 21 | - shell: bash 22 | working-directory: ${{ inputs.builddir }} 23 | id: combine 24 | run: | 25 | set -x 26 | 27 | # Detect library extension. 28 | platform=${{ inputs.platform }} 29 | libext="a" 30 | if [ "${platform}" = "win" ]; then 31 | libext="lib" 32 | fi 33 | libname=libwebrtc_full.${libext} 34 | 35 | # Library allowlist filter 36 | allowlist=$(echo ${{ inputs.allowlist }}\\.${libext} | sed "s/ /\\\\.${libext}|/g") 37 | 38 | LIBS=$(cat .ninja_log | tr '\t' '\n' | grep -E "^obj/" | grep -E $allowlist | sort -u) 39 | # Combine libraries based on platform-specific tools 40 | case $platform in 41 | win) 42 | echo $LIBS | tr ' ' '\n' >$libname.list 43 | # LIB.exe from Microsoft C++ Toolset 44 | lib.exe /OUT:$libname @$libname.list 45 | ;; 46 | mac|ios) 47 | # libtool from XCode Command line tools 48 | libtool -static -o $libname $LIBS 49 | ;; 50 | *) 51 | # GNU ar + runlib 52 | echo "CREATE $libname" >$libname.ar 53 | for lib in $LIBS 54 | do 55 | echo "ADDLIB $lib" >>$libname.ar 56 | done 57 | echo "SAVE" >>$libname.ar 58 | echo "END" >>$libname.ar 59 | ar -M < $libname.ar 60 | ranlib $libname 61 | ;; 62 | esac 63 | 64 | ls -l 65 | echo "::set-output name=library::${libname}" 66 | -------------------------------------------------------------------------------- /.github/actions/tar_headers/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Tar required WebRTC header files.' 2 | description: 'Tar required WebRTC header files to be used by your application.' 3 | inputs: 4 | srcdir: 5 | description: 'The source dir where the WebRTC library has been checked out.' 6 | required: true 7 | exclude: 8 | description: 'The paths to exclude from header copying' 9 | required: true 10 | default: out ios sdk examples test build buildtools third_party/blink third_party/llvm-build third_party/win_build_output third_party/android_ndk third_party/catapult third_party/googletest third_party/android_deps third_party/android_sdk third_party/crashpad third_party/perfetto third_party/hunspell third_party/icu third_party/khronos 11 | outputs: 12 | tarball: 13 | description: "Path to generated tarball." 14 | value: ${{ steps.tar-headers.outputs.tarball }} 15 | runs: 16 | using: "composite" 17 | steps: 18 | - shell: bash 19 | id: tar-headers 20 | working-directory: "${{ inputs.srcdir }}" 21 | run: | 22 | set -x 23 | 24 | for p in ${{ inputs.exclude }} 25 | do 26 | EXCLUDE="$EXCLUDE -path ./${p} -prune -o" 27 | done 28 | 29 | TAR_FILE=headers.tar 30 | find . $EXCLUDE -type f -a \( -name "*.h" -o -name LICENSE -o -name COPYING \) -print -exec tar -rf $TAR_FILE "{}" \; 31 | echo "::set-output name=tarball::${TAR_FILE}" 32 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Builds matrix 2 | on: [push] 3 | 4 | # Global Settings 5 | env: 6 | WEBRTC_BRANCH: branch-heads/4472 7 | WEBRTC_URL: https://chromium.googlesource.com/external/webrtc 8 | MSVC_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC' 9 | 10 | jobs: 11 | config: 12 | name: "Find git revision" 13 | runs-on: "ubuntu-20.04" 14 | outputs: 15 | revision: ${{ steps.config.outputs.revision }} 16 | name: ${{ steps.config.outputs.name }} 17 | steps: 18 | - name: Configure shared properties. 19 | id: config 20 | shell: bash 21 | run: | 22 | REVISION=$(git ls-remote $WEBRTC_URL --heads $WEBRTC_BRANCH | head -n 1 | cut -f 1) 23 | INTERNAL=$(curl --silent ${WEBRTC_URL}/+/${REVISION}?format=TEXT | base64 -d | tail -1 | egrep -o '{#([0-9]+)}' | tr -d '{}#' | cut -c1-7) 24 | NAME="webrtc-${INTERNAL}-${REVISION:0:7}" 25 | 26 | echo "Repository: ${WEBRTC_URL}" 27 | echo "Branch: ${WEBRTC_BRANCH}" 28 | echo "Revision: ${REVISION}" 29 | echo "Internal revision: ${INTERNAL}" 30 | echo "Output: ${NAME}" 31 | 32 | echo "::set-output name=revision::${REVISION}" 33 | echo "::set-output name=name::${NAME}" 34 | 35 | build: 36 | name: "Build" 37 | needs: config 38 | runs-on: ${{ matrix.os }} 39 | strategy: 40 | fail-fast: false 41 | matrix: 42 | include: 43 | # Android 44 | - target_os: android 45 | arch: arm 46 | custom_gnargs: use_custom_libcxx=false 47 | gclient_os: '["android", "unix"]' 48 | os: ubuntu-20.04 49 | - target_os: android 50 | arch: arm64 51 | custom_gnargs: use_custom_libcxx=false 52 | gclient_os: '["android", "unix"]' 53 | os: ubuntu-20.04 54 | - target_os: android 55 | arch: x86 56 | custom_gnargs: use_custom_libcxx=false 57 | gclient_os: '["android", "unix"]' 58 | os: ubuntu-20.04 59 | - target_os: android 60 | arch: x64 61 | custom_gnargs: use_custom_libcxx=false 62 | gclient_os: '["android", "unix"]' 63 | os: ubuntu-20.04 64 | 65 | # iOS 66 | - target_os: ios 67 | arch: arm 68 | custom_gnargs: use_custom_libcxx=false ios_enable_code_signing=false 69 | gclient_os: '["ios", "mac"]' 70 | os: macos-latest 71 | - target_os: ios 72 | arch: arm64 73 | custom_gnargs: use_custom_libcxx=false ios_enable_code_signing=false 74 | gclient_os: '["ios", "mac"]' 75 | os: macos-latest 76 | - target_os: ios 77 | arch: x64 78 | custom_gnargs: use_custom_libcxx=false ios_enable_code_signing=false 79 | gclient_os: '["ios", "mac"]' 80 | os: macos-latest 81 | 82 | # Linux 83 | - target_os: linux 84 | arch: x86 85 | custom_gnargs: use_custom_libcxx=false use_glib=false 86 | gclient_os: '["linux"]' 87 | os: ubuntu-20.04 88 | - target_os: linux 89 | arch: x64 90 | custom_gnargs: use_custom_libcxx=false use_glib=false 91 | gclient_os: '["linux"]' 92 | os: ubuntu-20.04 93 | 94 | # macOS 95 | - target_os: mac 96 | arch: arm64 97 | custom_gnargs: use_custom_libcxx=false 98 | gclient_os: '["mac"]' 99 | os: macos-latest 100 | - target_os: mac 101 | arch: x64 102 | custom_gnargs: use_custom_libcxx=false 103 | gclient_os: '["mac"]' 104 | os: macos-latest 105 | 106 | # Windows 107 | - target_os: win 108 | arch: x86 109 | # Windows 32 goes out memory when building libaom release. Disable libaom. 110 | custom_gnargs: is_clang=false enable_iterator_debugging=true enable_libaom=false 111 | gclient_os: '["win"]' 112 | msvc_arch: amd64_x86 113 | os: windows-2019 114 | - target_os: win 115 | arch: x64 116 | custom_gnargs: is_clang=false enable_iterator_debugging=true 117 | gclient_os: '["win"]' 118 | msvc_arch: amd64_x86 119 | os: windows-2019 120 | 121 | env: 122 | DEPOT_TOOLS: ${{ github.workspace }}/depot_tools 123 | DEPOT_TOOLS_WIN_TOOLCHAIN: 0 124 | GNARGS: 'is_component_build=false rtc_include_tests=false treat_warnings_as_errors=false rtc_build_examples=false use_rtti=true target_os=\"${{ matrix.target_os }}\" target_cpu=\"${{ matrix.arch }}\" ${{ matrix.custom_gnargs }}' 125 | GNARGS_RELEASE: "is_debug=false strip_debug_info=true symbol_level=0" 126 | OUTPUT_NAME: ${{ needs.config.outputs.name }}-${{ matrix.target_os }}-${{ matrix.arch }} 127 | TEMP_ARTIFACT: ${{ github.job }}-${{ matrix.target_os }}-${{ matrix.arch }} 128 | steps: 129 | - uses: actions/checkout@v2 130 | 131 | - name: Setup MSVC environment 132 | if: ${{ matrix.target_os == 'win' }} 133 | shell: bash 134 | run: | 135 | '${{ env.MSVC_PATH }}\Auxiliary\Build\vcvarsall.bat' ${{ matrix.msvc_arch }} 136 | MSVC_TOOLS=$(find '${{ env.MSVC_PATH }}\Tools\MSVC' -maxdepth 1 -type d | sort -r | head -n 1) 137 | echo ${MSVC_TOOLS}'\bin\Hostx64\x64\' >> $GITHUB_PATH 138 | 139 | - name: Install Linux dependencies 140 | if: ${{ matrix.target_os == 'linux' }} 141 | run: | 142 | sudo dpkg --add-architecture i386 143 | sudo apt-get install clang gcc gcc-multilib g++ g++-multilib 144 | 145 | - name: Install depot tools 146 | shell: bash 147 | run: | 148 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS 149 | echo $DEPOT_TOOLS >> $GITHUB_PATH 150 | 151 | # We should always be explicit with our flags usage here since it's gonna be sure to always set those flags 152 | - name: Setup gclient build config 153 | shell: bash 154 | run: | 155 | # Create config 156 | mkdir out 157 | cp gclient out/.gclient 158 | echo 'target_os = ${{ matrix.gclient_os }}' >> out/.gclient 159 | 160 | - name: Checkout WebRTC and run hooks 161 | shell: bash 162 | working-directory: out 163 | run: | 164 | gclient sync --no_bootstrap --shallow --no-history -vv --revision ${{ needs.config.outputs.revision }} 165 | 166 | - name: Patch the WebRTC sources (allow dynamic crt on windows) 167 | if: ${{ matrix.target_os == 'win' }} 168 | shell: bash 169 | working-directory: out 170 | run: | 171 | sed -i 's|:static_crt|:dynamic_crt|' src/build/config/win/BUILD.gn 172 | cat src/build/config/win/BUILD.gn 173 | 174 | - name: Tar headers 175 | id: tar-headers 176 | uses: ./.github/actions/tar_headers 177 | with: 178 | srcdir: out/src 179 | 180 | - name: Upload header artifact 181 | uses: actions/upload-artifact@v2 182 | with: 183 | name: ${{ env.TEMP_ARTIFACT }}-headers 184 | path: out/src/${{ steps.tar-headers.outputs.tarball }} 185 | retention-days: 1 186 | 187 | - name: Build - Debug 188 | shell: bash 189 | working-directory: out/src 190 | run: | 191 | gn gen out --args="${{ env.GNARGS }}" 192 | ninja -v -C out webrtc 193 | 194 | - name: Combine - Debug 195 | uses: ./.github/actions/combine_library 196 | id: combine-debug 197 | with: 198 | platform: ${{ matrix.target_os }} 199 | builddir: out/src/out 200 | 201 | - name: Upload debug artifact 202 | uses: actions/upload-artifact@v2 203 | with: 204 | name: ${{ env.TEMP_ARTIFACT }}-debug 205 | path: out/src/out/${{ steps.combine-debug.outputs.library }} 206 | retention-days: 1 207 | 208 | # Release 209 | - name: Build - Release 210 | shell: bash 211 | working-directory: out/src 212 | run: | 213 | echo "Clean up debug build to free up space" 214 | rm -rf out 215 | gn gen out --args="${{ env.GNARGS }} ${{ env.GNARGS_RELEASE }}" 216 | ninja -v -C out webrtc 217 | 218 | - name: Combine - Release 219 | uses: ./.github/actions/combine_library 220 | id: combine-release 221 | with: 222 | platform: ${{ matrix.target_os }} 223 | builddir: out/src/out 224 | 225 | - name: Upload release artifact 226 | uses: actions/upload-artifact@v2 227 | with: 228 | name: ${{ env.TEMP_ARTIFACT }}-release 229 | path: out/src/out/${{ steps.combine-release.outputs.library }} 230 | retention-days: 1 231 | 232 | - name: Cleanup space 233 | shell: bash 234 | run: | 235 | rm -rf out 236 | 237 | - name: Download library artifact - Debug 238 | uses: actions/download-artifact@v2 239 | with: 240 | path: ${{ matrix.target_os }}/lib/${{ matrix.arch }}/Debug 241 | name: ${{ env.TEMP_ARTIFACT }}-debug 242 | 243 | - name: Download library artifact - Release 244 | uses: actions/download-artifact@v2 245 | with: 246 | path: ${{ matrix.target_os }}/lib/${{ matrix.arch }}/Release 247 | name: ${{ env.TEMP_ARTIFACT }}-release 248 | 249 | - name: Download includes 250 | uses: actions/download-artifact@v2 251 | with: 252 | path: ${{ matrix.target_os }} 253 | name: ${{ env.TEMP_ARTIFACT }}-headers 254 | 255 | - name: Pack full release artifact 256 | working-directory: ${{ matrix.target_os }} 257 | shell: bash 258 | run: | 259 | mkdir include 260 | tar -xf ${{ steps.tar-headers.outputs.tarball }} -C include 261 | tar -czf $OUTPUT_NAME.tar.gz include lib 262 | 263 | - name: Upload final artifact 264 | uses: actions/upload-artifact@v2 265 | with: 266 | name: ${{ env.OUTPUT_NAME }}.tar.gz 267 | path: ${{ matrix.target_os }}/${{ env.OUTPUT_NAME }}.tar.gz 268 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Fabio Alessandrelli 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NOTE: 2 | # THIS REPOSITORY IS ARCHIVED, AND LEFT FOR HISTORICAL PURPOSE ONLY. 3 | # Recent versions of the [Godot WebRTC Plugin](https://github.com/godotengine/webrtc-native) no longer require the Chromium WebRTC library. 4 | # Visit [https://github.com/godotengine/webrtc-native](https://github.com/godotengine/webrtc-native) for more informations. 5 | 6 | # webrtc-actions 7 | A set of github actions to build WebRTC as a single static library. 8 | -------------------------------------------------------------------------------- /gclient: -------------------------------------------------------------------------------- 1 | solutions = [ 2 | { 3 | "name": "src", 4 | "url": "https://webrtc.googlesource.com/src.git", 5 | "managed": False, 6 | "custom_deps": { 7 | #"src/testing": None, 8 | "src/third_party/gtest-parallel": None, 9 | "src/third_party/accessibility_test_framework": None, 10 | "src/third_party/android_support_test_runner": None, 11 | "src/tools/swarming_client": None, 12 | "src/tools/luci-go": None, 13 | }, 14 | "custom_hooks": [ 15 | {"name": "test_fonts"}, 16 | {"name": "Generate component metadata for tests"}, 17 | # The download hook... hopefully 18 | {"name": ""}, 19 | ], 20 | }, 21 | ] 22 | --------------------------------------------------------------------------------