diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 527055a..af14439 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: matrix: name: - windows_x86_64 - runs-on: windows-latest + runs-on: windows-2022 steps: - uses: actions/checkout@v4 - name: Disk Cleanup @@ -51,7 +51,7 @@ jobs: fail-fast: false matrix: name: - # - macos_arm64 + - macos_arm64 - macos_x86_64 # - ios runs-on: macos-15 @@ -60,6 +60,10 @@ jobs: - name: Select Xcode 16.1 run: sudo xcode-select --switch /Applications/Xcode_16.1.app/Contents/Developer - run: brew install ninja + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - run: pip install setuptools - run: ./build.${{ matrix.name }}.sh "${{ github.event.inputs.commitHash }}" - name: Upload Artifact uses: actions/upload-artifact@v4 @@ -80,11 +84,11 @@ jobs: # - ubuntu-18.04_armv8 # - ubuntu-20.04_armv8 # - ubuntu-18.04_x86_64 - - ubuntu-20.04_x86_64 - # - ubuntu-22.04_x86_64 + # - ubuntu-20.04_x86_64 + - ubuntu-22.04_x86_64 # - android # - android_prefixed - runs-on: linux-large + runs-on: linux-large steps: - uses: actions/checkout@v4 - name: Disk Cleanup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13b3e9b..0c2569c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - windows_x86_64 # - windows_arm64 # - windows_x86 - runs-on: windows-latest + runs-on: windows-2022 outputs: output-artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }} steps: @@ -49,7 +49,7 @@ jobs: uses: actions/upload-artifact@v4 id: artifact-upload-step with: - name: webrtc.${{ matrix.name }}.tar.bz2 + name: webrtc.${{ matrix.name }} path: build\_package\${{ matrix.name }}\webrtc.tar.bz2 build-macos: defaults: @@ -59,7 +59,7 @@ jobs: fail-fast: false matrix: name: - # - macos_arm64 + - macos_arm64 - macos_x86_64 # - ios runs-on: macos-15 @@ -70,6 +70,10 @@ jobs: - name: Select Xcode 16.1 run: sudo xcode-select --switch /Applications/Xcode_16.1.app/Contents/Developer - run: brew install ninja + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - run: pip install setuptools - name: Determine Release Tag env: RELEASE: ${{ github.ref_name }} @@ -77,12 +81,12 @@ jobs: run: | echo "tag=${RELEASE%%.*}" >> "$GITHUB_OUTPUT" echo "3P_WEBRTC_BUILD_RELEASE_VERSION=${RELEASE}" >> "VERSION" - - run: ./build.${{ matrix.name }}.sh "${{ steps.release_tag.outputs.tag }}_release" + - run: ./build.${{ matrix.name }}.sh "${{ steps.release_tag.outputs.tag }}_release" - name: Upload Artifact uses: actions/upload-artifact@v4 id: artifact-upload-step with: - name: webrtc.${{ matrix.name }}.tar.bz2 + name: webrtc.${{ matrix.name }} path: build/_package/${{ matrix.name }}/webrtc.tar.bz2 build-linux: defaults: @@ -128,33 +132,78 @@ jobs: uses: actions/upload-artifact@v4 id: artifact-upload-step with: - name: webrtc.${{ matrix.name }}.tar.bz2 + name: webrtc.${{ matrix.name }} path: build/_package/${{ matrix.name }}/webrtc.tar.bz2 package-macos: needs: - build-macos runs-on: macos-15 steps: - - uses: secondlife/action-autobuild@v3 + # Checkout first to avoid damaging artifact download below + - name: Checkout + uses: actions/checkout@v4 + with: + # Work around the fact that in the context of a pull request github.sha + # references a dynamic merge commit rather than the branch head + # https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + submodules: recursive + - name: Download webrtc artifacts + uses: actions/download-artifact@v4 with: + path: _packages + - uses: secondlife/action-autobuild@v5 + with: + checkout: false token: ${{ github.token }} build-args: ../build-cmd.sh ${{ needs.build-macos.outputs.output-artifact-id }} package-windows: needs: - - build-windows - runs-on: windows-latest + - build-windows + runs-on: windows-2022 steps: - - uses: secondlife/action-autobuild@v3 + # Checkout first to avoid damaging artifact download below + - name: Checkout + uses: actions/checkout@v4 + with: + # Work around the fact that in the context of a pull request github.sha + # references a dynamic merge commit rather than the branch head + # https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + submodules: recursive + - name: Download webrtc artifacts + uses: actions/download-artifact@v4 with: + path: _packages + - uses: secondlife/action-autobuild@v5 + with: + checkout: false token: ${{ github.token }} build-args: ../build-cmd.sh ${{ needs.build-windows.outputs.output-artifact-id }} package-linux: needs: - build-linux - runs-on: ubuntu-latest + runs-on: ubuntu-latest steps: - - uses: secondlife/action-autobuild@v3 + # Checkout first to avoid damaging artifact download below + - name: Checkout + uses: actions/checkout@v4 + with: + # Work around the fact that in the context of a pull request github.sha + # references a dynamic merge commit rather than the branch head + # https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + submodules: recursive + - name: Download webrtc artifacts + uses: actions/download-artifact@v4 + with: + path: _packages + - uses: secondlife/action-autobuild@v5 with: + checkout: false token: ${{ github.token }} build-args: ../build-cmd.sh ${{ needs.build-linux.outputs.output-artifact-id }} release: diff --git a/build-cmd.sh b/build-cmd.sh index a5a3b09..7aa9934 100755 --- a/build-cmd.sh +++ b/build-cmd.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash cd "$(dirname "$0")" -artifact_id="$1" +#artifact_id="$1" # turn on verbose debugging output for logs. exec 4>&1; export BASH_XTRACEFD=4; set -x @@ -17,66 +17,75 @@ set -u # this command to stop it doing that... [[ "$OSTYPE" == "cygwin" ]] && set -o igncr -top="$(pwd)" -stage="${top}"/stage - case "$AUTOBUILD_PLATFORM" in - windows64) + windows*) autobuild="$(cygpath -u "$AUTOBUILD")" build_type="windows_x86_64" ;; - darwin64) - build_type="macos_x86_64" + darwin*) autobuild="$AUTOBUILD" ;; linux*) - build_type="linux_x86_64" + build_type="ubuntu-22.04_x86_64" autobuild="$AUTOBUILD" ;; *) echo "This project is not currently supported for $AUTOBUILD_PLATFORM" 1>&2 ; exit 1 - + ;; esac +top="$(pwd)" +stage="${top}"/stage + source_environment_tempfile="$stage/source_environment.sh" "$autobuild" source_environment > "$source_environment_tempfile" . "$source_environment_tempfile" pushd "$stage" -# download the artifact -curl -o webrtc.tar.bz2.zip -L -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - -H "Authorization: Bearer $AUTOBUILD_GITHUB_TOKEN" \ - https://api.github.com/repos/secondlife/3p-webrtc-build/actions/artifacts/"$artifact_id"/zip - -# delete it so autobuild upload doesn't assume it's a bad autobuild artifact -# TODO: Find a better way to do this that doesn't involve a 3rd party action -#curl -X DELETE -H "Accept: application/vnd.github+json" \ -# -H "X-GitHub-Api-Version: 2022-11-28" \ -# -H "Authorization: Bearer $AUTOBUILD_GITHUB_TOKEN" \ -# https://api.github.com/repos/secondlife/3p-webrtc-build/actions/artifacts/"$artifact_id" - -unzip webrtc.tar.bz2.zip -tar xjf webrtc.tar.bz2 --strip-components=1 -rm webrtc.tar.bz2.zip -rm webrtc.tar.bz2 - -# Munge the WebRTC Build package contents into something compatible -# with the layout we use for other autobuild pacakges -mv include webrtc -mkdir include -mv webrtc include -mv lib release -mkdir lib -mv release lib -mkdir LICENSES -mv NOTICE LICENSES/webrtc-license.txt - case "$AUTOBUILD_PLATFORM" in - darwin64) - mv Frameworks/WebRTC.xcframework/macos-x86_64/WebRTC.framework lib/release + darwin*) + mkdir "x86_64" + pushd "x86_64" + tar -xjf "$top"/_packages/webrtc.macos_x86_64/webrtc.tar.bz2 --strip-components=1 + popd + + mkdir "arm64" + pushd "arm64" + tar -xjf "$top"/_packages/webrtc.macos_arm64/webrtc.tar.bz2 --strip-components=1 + popd + + # Munge the WebRTC Build package contents into something compatible + # with the layout we use for other autobuild pacakges + + # Create universal library + mkdir -p lib/release + lipo -create -output "$stage/lib/release/libwebrtc.a" "$stage/x86_64/lib/libwebrtc.a" "$stage/arm64/lib/libwebrtc.a" + + mkdir -p include/webrtc + mv x86_64/include/* include/webrtc + + mkdir LICENSES + mv x86_64/NOTICE LICENSES/webrtc-license.txt + ;; + *) + tar -xjf "$top"/_packages/webrtc."$build_type"/webrtc.tar.bz2 --strip-components=1 + + # Munge the WebRTC Build package contents into something compatible + # with the layout we use for other autobuild pacakges + mv include webrtc + mkdir include + mv webrtc include + mv lib release + mkdir lib + mv release lib + mkdir LICENSES + mv NOTICE LICENSES/webrtc-license.txt + ;; + *) + echo "This project is not currently supported for $AUTOBUILD_PLATFORM" 1>&2 ; exit 1 + ;; esac diff --git a/build-local.sh b/build-local.sh index 9b4a8a6..6640252 100644 --- a/build-local.sh +++ b/build-local.sh @@ -22,7 +22,7 @@ stage="${top}"/stage build="${top}"/build rm -rf "$stage"/* -rm -rf "$build"/_package +#rm -rf "$build"/_package case "$AUTOBUILD_PLATFORM" in windows64) autobuild="$(cygpath -u "$AUTOBUILD")" @@ -32,48 +32,89 @@ case "$AUTOBUILD_PLATFORM" in autobuild="$(cygpath -u "$AUTOBUILD")" build_type="windows_x86_64" ;; - darwin64) - build_type="macos_x86_64" - autobuild="$AUTOBUILD" - ;; - darwin) + darwin*) build_type="macos_x86_64" autobuild="$AUTOBUILD" ;; linux*) - build_type="linux_x86_64" + build_type="ubuntu-22.04_x86_64" autobuild="$AUTOBUILD" ;; *) echo "This project is not currently supported for $AUTOBUILD_PLATFORM" 1>&2 ; exit 1 - + ;; esac pushd "$build" -bash ./build."$build_type".sh m137_release - -source_environment_tempfile="$stage/source_environment.sh" -autobuild source_environment > "$source_environment_tempfile" -. "$source_environment_tempfile" - -pushd "$stage" - -tar -xjf "$build"/_package/"$build_type"/webrtc.tar.bz2 --strip-components=1 - -# Munge the WebRTC Build package contents into something compatible -# with the layout we use for other autobuild pacakges -mv include webrtc -mkdir include -mv webrtc include -mv lib release -mkdir lib -mv release lib -mkdir LICENSES -mv NOTICE LICENSES/webrtc-license.txt - -build=${AUTOBUILD_BUILD_ID:=0} -echo "m137_release.${build}" > "$stage/VERSION.txt" -echo "m137_release.${build}" > "$top/VERSION.txt" -popd + +# Special case for macos universal packages +case "$AUTOBUILD_PLATFORM" in + darwin*) + # bash ./build.macos_x86_64.sh m137_release + # bash ./build.macos_arm64.sh m137_release + + source_environment_tempfile="$stage/source_environment.sh" + autobuild source_environment > "$source_environment_tempfile" + . "$source_environment_tempfile" + + pushd "$stage" + + mkdir "x86_64" + pushd "x86_64" + tar -xjf "$build"/_package/macos_x86_64/webrtc.tar.bz2 --strip-components=1 + popd + + mkdir "arm64" + pushd "arm64" + tar -xjf "$build"/_package/macos_arm64/webrtc.tar.bz2 --strip-components=1 + popd + + # Munge the WebRTC Build package contents into something compatible + # with the layout we use for other autobuild pacakges + + # Create universal library + mkdir -p lib/release + lipo -create -output "$stage/lib/release/libwebrtc.a" "$stage/x86_64/lib/libwebrtc.a" "$stage/arm64/lib/libwebrtc.a" + + mkdir -p include/webrtc + mv x86_64/include/* include/webrtc + + mkdir LICENSES + mv x86_64/NOTICE LICENSES/webrtc-license.txt + + build=${AUTOBUILD_BUILD_ID:=0} + echo "m137_release.${build}" > "$stage/VERSION.txt" + echo "m137_release.${build}" > "$top/VERSION.txt" + popd + ;; + *) + bash ./build."$build_type".sh m137_release + + source_environment_tempfile="$stage/source_environment.sh" + autobuild source_environment > "$source_environment_tempfile" + . "$source_environment_tempfile" + + pushd "$stage" + + tar -xjf "$build"/_package/"$build_type"/webrtc.tar.bz2 --strip-components=1 + + # Munge the WebRTC Build package contents into something compatible + # with the layout we use for other autobuild pacakges + mv include webrtc + mkdir include + mv webrtc include + mv lib release + mkdir lib + mv release lib + mkdir LICENSES + mv NOTICE LICENSES/webrtc-license.txt + + build=${AUTOBUILD_BUILD_ID:=0} + echo "m137_release.${build}" > "$stage/VERSION.txt" + echo "m137_release.${build}" > "$top/VERSION.txt" + popd + ;; +esac + popd diff --git a/build/build.macos_arm64.sh b/build/build.macos_arm64.sh index 5dcfcc0..30857ad 100755 --- a/build/build.macos_arm64.sh +++ b/build/build.macos_arm64.sh @@ -2,5 +2,5 @@ set -ex cd `dirname $0` -python3 run.py build macos_arm64 --commit "$1" +python3 run.py build macos_arm64 --webrtc-fetch --commit "$1" python3 run.py package macos_arm64 \ No newline at end of file diff --git a/build/build.macos_x86_64.sh b/build/build.macos_x86_64.sh index 281911a..b11097f 100755 --- a/build/build.macos_x86_64.sh +++ b/build/build.macos_x86_64.sh @@ -2,8 +2,5 @@ set -ex cd `dirname $0` -python3 -m venv ./venv -source ./venv/bin/activate -pip3 install setuptools python3 run.py build macos_x86_64 --webrtc-fetch --commit "$1" python3 run.py package macos_x86_64 diff --git a/build/patches/enable_gcc_permissive.patch b/build/patches/enable_gcc_permissive.patch new file mode 100644 index 0000000..e0275ad --- /dev/null +++ b/build/patches/enable_gcc_permissive.patch @@ -0,0 +1,15 @@ +diff --git a/BUILD.gn b/BUILD.gn +index e4a82bc8d6..54fde4ce9a 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -384,6 +384,10 @@ config("common_config") { + # warning. + "-Wctad-maybe-unsupported", + ] ++ } else { ++ if(is_linux) { ++ cflags += [ "-fpermissive" ] ++ } + } + + if (build_with_chromium) { diff --git a/build/patches/gcc_fpermissive_error.patch b/build/patches/gcc_fpermissive_error.patch new file mode 100644 index 0000000..52ffa1f --- /dev/null +++ b/build/patches/gcc_fpermissive_error.patch @@ -0,0 +1,12 @@ +diff -durN webrtc-m137/p2p/base/port_interface.h webrtc-m137-patched/p2p/base/port_interface.h +--- webrtc-m137/p2p/base/port_interface.h 2025-09-01 14:30:40.000000000 +0200 ++++ webrtc-m137-patched/p2p/base/port_interface.h 2025-09-05 15:07:36.904283022 +0200 +@@ -55,7 +55,7 @@ + virtual ~PortInterface(); + + virtual IceCandidateType Type() const = 0; +- virtual const Network* Network() const = 0; ++ virtual const webrtc::Network* Network() const = 0; + + // Methods to set/get ICE role and tiebreaker values. + virtual void SetIceRole(IceRole role) = 0; diff --git a/build/run.py b/build/run.py index 63f91aa..af5c3f9 100644 --- a/build/run.py +++ b/build/run.py @@ -268,6 +268,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'raspberry-pi-os_armv7': [ 'add_license_dav1d.patch', @@ -276,6 +278,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'raspberry-pi-os_armv8': [ 'add_license_dav1d.patch', @@ -284,6 +288,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'ubuntu-18.04_armv8': [ 'add_license_dav1d.patch', @@ -292,6 +298,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'ubuntu-20.04_armv8': [ 'add_license_dav1d.patch', @@ -300,6 +308,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'ubuntu-18.04_x86_64': [ 'add_license_dav1d.patch', @@ -308,6 +318,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'ubuntu-20.04_x86_64': [ 'add_license_dav1d.patch', @@ -316,6 +328,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], 'ubuntu-22.04_x86_64': [ 'add_license_dav1d.patch', @@ -324,6 +338,8 @@ def get_depot_tools(source_dir, fetch=False): 'bug_8759_workaround.patch', 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', + 'gcc_fpermissive_error.patch', + 'enable_gcc_permissive.patch', ], } @@ -374,7 +390,7 @@ def get_webrtc(source_dir, patch_dir, version, target, cmd(['git', 'branch']) cmd(['git', 'checkout', '-f', version]) cmd(['git', 'clean', '-df']) - cmd(['gclient', 'sync', '-D', '--force', '--reset', '--with_branch_heads', '--jobs=8']) + cmd(['gclient', 'sync', '-D', '--force', '--reset', '--revision', version, '--no-history', '--jobs=8']) for patch in PATCHES[target]: depth, dirs = PATCH_INFO.get(patch, (1, ['.'])) dir = os.path.join(src_dir, *dirs) @@ -752,7 +768,8 @@ def build_webrtc( f'target_cpu="{target_cpus[target]}"', "use_custom_libcxx=false", "use_custom_libcxx_for_host=false", - "is_clang=true" + "is_clang=true", + 'use_lld=false', ] elif target in ('macos_x86_64', 'macos_arm64'): gn_args += [ @@ -797,9 +814,14 @@ def build_webrtc( gn_args += [ 'target_os="linux"', 'rtc_use_pipewire=false', + 'rtc_use_x11=false', "use_custom_libcxx=false", "use_custom_libcxx_for_host=false", - 'rtc_include_pulse_audio=false', + 'is_clang=false', + 'clang_use_chrome_plugins=false', + 'use_lld=false', + 'use_thin_lto=false', + 'rtc_include_pulse_audio=true', 'rtc_include_internal_audio_device=true', ] else: @@ -824,10 +846,8 @@ def build_webrtc( if target in ['windows_x86_64', 'windows_x86', 'windows_arm64']: pass - elif target in ('macos_x86_64', 'macos_arm64'): - ar = '/usr/bin/ar' else: - ar = os.path.join(webrtc_src_dir, 'third_party/llvm-build/Release+Asserts/bin/llvm-ar') + ar = '/usr/bin/ar' # ar で libwebrtc.a を生成する # Create libwebrtc.a with ar @@ -1218,7 +1238,7 @@ def main(): commit = version_info.webrtc_commit if args.commit: commit = args.commit - + print("Building for commit: ", commit) # ソース取得 diff --git a/build/scripts/apt_install_x86_64.sh b/build/scripts/apt_install_x86_64.sh index 4044bff..1dc77af 100755 --- a/build/scripts/apt_install_x86_64.sh +++ b/build/scripts/apt_install_x86_64.sh @@ -8,7 +8,7 @@ apt-get -y upgrade # tzdata を noninteractive にしないと実行が止まってしまう # need to set tzdata to noninteractive or else it'll stop apt-get -y install tzdata -echo 'Asia/Tokyo' > /etc/timezone +echo 'America/New_York' > /etc/timezone dpkg-reconfigure -f noninteractive tzdata export DEBIAN_FRONTEND=noninteractive @@ -27,4 +27,5 @@ apt-get -y install \ unzip \ vim \ wget \ - xz-utils + xz-utils \ + build-essential