diff --git a/.github/workflows/flutter-engine-arm64.yaml b/.github/workflows/flutter-engine-arm64.yaml deleted file mode 100644 index daab81f..0000000 --- a/.github/workflows/flutter-engine-arm64.yaml +++ /dev/null @@ -1,256 +0,0 @@ -name: Linux arm64 - -on: - workflow_dispatch: - inputs: - srcrev: - description: 'Flutter Engine Commit Hash' - required: True - default: '' - release: - description: 'Release' - required: false - default: 'false' - -jobs: - linux-arm64: - runs-on: [self-hosted, linux, x64] - env: - arch: arm64 - linux_cpu: arm64 - target_triple: aarch64-unknown-linux-gnu - target_sysroot: debian_bullseye_arm64-sysroot - tag_debug: linux-engine-sdk-debug-arm64-${{ inputs.srcrev }} - tag_debug_unopt: linux-engine-sdk-debug-unopt-arm64-${{ inputs.srcrev }} - tag_release: linux-engine-sdk-release-arm64-${{ inputs.srcrev }} - tag_profile: linux-engine-sdk-profile-arm64-${{ inputs.srcrev }} - notes_debug: "Flutter Engine - runtime debug SDK" - notes_debug_unopt: "Flutter Engine - runtime debug SDK" - notes_release: "Flutter Engine - runtime release SDK" - notes_profile: "Flutter Engine - runtime profile SDK" - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install packages - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - - - name: Get Flutter Source - run: | - export PATH=$PATH:$PWD/depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython - git clone https://github.com/flutter/flutter.git - pushd flutter - gclient config --spec 'solutions=[{"managed":False,"name":".","url":"https://github.com/flutter/flutter.git","custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True},"deps_file":"DEPS","safesync_url":""}]' - gclient sync --force --shallow --no-history -R -D --revision ${{ inputs.SRCREV }} -j$(nproc) -v - popd - - # fetch sysroot - cd flutter/engine/src - build/linux/sysroot_scripts/install-sysroot.py --arch=$arch - - - name: Patch Flutter Source - run: | - PATCH_DIR=$PWD/patches - cd flutter - git apply $PATCH_DIR/0001-clang-toolchain.patch - - - name: Build Debug - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_$arch - - - name: Prepare Debug Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_debug_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug.tar.gz flutter/engine/src/out/linux_debug_$arch/engine-sdk/ - - sha256sum -b $tag_debug.tar.gz > $tag_debug.tar.gz.sha256 - - - name: Publish Debug - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug - path: | - linux-engine-sdk-debug-arm64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-arm64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug" --cleanup-tag -y |true - gh release create --draft "$tag_debug" --title "$tag_debug" --notes "$notes_debug" - gh release upload "$tag_debug" "$tag_debug.tar.gz" "$tag_debug.tar.gz.sha256" - gh release edit "$tag_debug" --draft=false - - - name: Build Debug Unoptimized - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --unoptimized \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_unopt_$arch - - - name: Prepare Debug Unoptimized Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_debug_unopt_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug_unopt.tar.gz flutter/engine/src/out/linux_debug_unopt_$arch/engine-sdk/ - - sha256sum -b $tag_debug_unopt.tar.gz > $tag_debug_unopt.tar.gz.sha256 - - - name: Publish Debug Unoptimized - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug-unoptimized - path: | - linux-engine-sdk-debug-unopt-arm64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-unopt-arm64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Unoptimized Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug_unopt" --cleanup-tag -y |true - gh release create --draft "$tag_debug_unopt" --title "$tag_debug_unopt" --notes "$notes_debug_unopt" - gh release upload "$tag_debug_unopt" "$tag_debug_unopt.tar.gz" "$tag_debug_unopt.tar.gz.sha256" - gh release edit "$tag_debug_unopt" --draft=false - - - name: Build Release - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=release \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_release_$arch - - - name: Prepare Release Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_release_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_release.tar.gz flutter/engine/src/out/linux_release_$arch/engine-sdk/ - - sha256sum -b $tag_release.tar.gz > $tag_release.tar.gz.sha256 - - - name: Publish Release - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-release - path: | - linux-engine-sdk-release-arm64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-release-arm64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_release" --cleanup-tag -y |true - gh release create --draft "$tag_release" --title "$tag_release" --notes "$notes_release" - gh release upload "$tag_release" "$tag_release.tar.gz" "$tag_release.tar.gz.sha256" - gh release edit "$tag_release" --draft=false - - - name: Build Profile - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=profile \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_profile_$arch - - - name: Prepare Profile Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_profile_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_profile.tar.gz flutter/engine/src/out/linux_profile_$arch/engine-sdk/ - - sha256sum -b $tag_profile.tar.gz > $tag_profile.tar.gz.sha256 - - - name: Publish Profile - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-profile - path: | - linux-engine-sdk-profile-arm64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-profile-arm64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Profile - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_profile" --cleanup-tag -y |true - gh release create --draft "$tag_profile" --title "$tag_profile" --notes "$notes_profile" - gh release upload "$tag_profile" "$tag_profile.tar.gz" "$tag_profile.tar.gz.sha256" - gh release edit "$tag_profile" --draft=false diff --git a/.github/workflows/flutter-engine-armv7hf.yaml b/.github/workflows/flutter-engine-armv7hf.yaml deleted file mode 100644 index 5f67a22..0000000 --- a/.github/workflows/flutter-engine-armv7hf.yaml +++ /dev/null @@ -1,256 +0,0 @@ -name: Linux armv7hf - -on: - workflow_dispatch: - inputs: - srcrev: - description: 'Flutter Engine Commit Hash' - required: True - default: '' - release: - description: 'Release' - required: false - default: 'false' - -jobs: - linux-armv7hf: - runs-on: [self-hosted, linux, x64] - env: - arch: arm - linux_cpu: arm --arm-float-abi hard - target_triple: armv7-unknown-linux-gnueabihf - target_sysroot: debian_bullseye_armhf-sysroot - tag_debug: linux-engine-sdk-debug-armv7hf-${{ inputs.srcrev }} - tag_debug_unopt: linux-engine-sdk-debug-unopt-armv7hf-${{ inputs.srcrev }} - tag_release: linux-engine-sdk-release-armv7hf-${{ inputs.srcrev }} - tag_profile: linux-engine-sdk-profile-armv7hf-${{ inputs.srcrev }} - notes_debug: "Flutter Engine - Linux armv7hf runtime debug SDK" - notes_debug_unopt: "Flutter Engine - Linux armv7hf runtime debug unoptimized SDK" - notes_release: "Flutter Engine - Linux armv7hf runtime release SDK" - notes_profile: "Flutter Engine - Linux armv7hf runtime profile SDK" - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install packages - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - - - name: Get Flutter Source - run: | - export PATH=$PATH:$PWD/depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython - git clone https://github.com/flutter/flutter.git - pushd flutter - gclient config --spec 'solutions=[{"managed":False,"name":".","url":"https://github.com/flutter/flutter.git","custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True},"deps_file":"DEPS","safesync_url":""}]' - gclient sync --force --shallow --no-history -R -D --revision ${{ inputs.SRCREV }} -j$(nproc) -v - popd - - # fetch sysroot - cd flutter/engine/src - build/linux/sysroot_scripts/install-sysroot.py --arch=$arch - - - name: Patch Flutter Source - run: | - PATCH_DIR=$PWD/patches - cd flutter - git apply $PATCH_DIR/0001-clang-toolchain.patch - - - name: Build Debug - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_$arch - - - name: Prepare Debug Artifacts - run: | - scripts/prepare-sdk-armv7hf.sh flutter/engine/src/out/linux_debug_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug.tar.gz flutter/engine/src/out/linux_debug_$arch/engine-sdk/ - - sha256sum -b $tag_debug.tar.gz > $tag_debug.tar.gz.sha256 - - - name: Publish Debug - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug - path: | - linux-engine-sdk-debug-armv7hf-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-armv7hf-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug" --cleanup-tag -y |true - gh release create --draft "$tag_debug" --title "$tag_debug" --notes "$notes_debug" - gh release upload "$tag_debug" "$tag_debug.tar.gz" "$tag_debug.tar.gz.sha256" - gh release edit "$tag_debug" --draft=false - - - name: Build Debug Unoptimized - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --unoptimized \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_unopt_$arch - - - name: Prepare Debug Unoptimized Artifacts - run: | - scripts/prepare-sdk-armv7hf.sh flutter/engine/src/out/linux_debug_unopt_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug_unopt.tar.gz flutter/engine/src/out/linux_debug_unopt_$arch/engine-sdk/ - - sha256sum -b $tag_debug_unopt.tar.gz > $tag_debug_unopt.tar.gz.sha256 - - - name: Publish Debug Unoptimized - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug-unoptimized - path: | - linux-engine-sdk-debug-unopt-armv7hf-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-unopt-armv7hf-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Unoptimized Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug_unopt" --cleanup-tag -y |true - gh release create --draft "$tag_debug_unopt" --title "$tag_debug_unopt" --notes "$notes_debug_unopt" - gh release upload "$tag_debug_unopt" "$tag_debug_unopt.tar.gz" "$tag_debug_unopt.tar.gz.sha256" - gh release edit "$tag_debug_unopt" --draft=false - - - name: Build Release - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=release \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_release_$arch - - - name: Prepare Release Artifacts - run: | - scripts/prepare-sdk-armv7hf.sh flutter/engine/src/out/linux_release_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_release.tar.gz flutter/engine/src/out/linux_release_$arch/engine-sdk/ - - sha256sum -b $tag_release.tar.gz > $tag_release.tar.gz.sha256 - - - name: Publish Release - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-release - path: | - linux-engine-sdk-release-armv7hf-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-release-armv7hf-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_release" --cleanup-tag -y |true - gh release create --draft "$tag_release" --title "$tag_release" --notes "$notes_release" - gh release upload "$tag_release" "$tag_release.tar.gz" "$tag_release.tar.gz.sha256" - gh release edit "$tag_release" --draft=false - - - name: Build Profile - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=profile \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_profile_$arch - - - name: Prepare Profile Artifacts - run: | - scripts/prepare-sdk-armv7hf.sh flutter/engine/src/out/linux_profile_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_profile.tar.gz flutter/engine/src/out/linux_profile_$arch/engine-sdk/ - - sha256sum -b $tag_profile.tar.gz > $tag_profile.tar.gz.sha256 - - - name: Publish Profile - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-profile - path: | - linux-engine-sdk-profile-armv7hf-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-profile-armv7hf-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Profile - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_profile" --cleanup-tag -y |true - gh release create --draft "$tag_profile" --title "$tag_profile" --notes "$notes_profile" - gh release upload "$tag_profile" "$tag_profile.tar.gz" "$tag_profile.tar.gz.sha256" - gh release edit "$tag_profile" --draft=false diff --git a/.github/workflows/flutter-engine-riscv64.yaml b/.github/workflows/flutter-engine-riscv64.yaml deleted file mode 100644 index 05c89f5..0000000 --- a/.github/workflows/flutter-engine-riscv64.yaml +++ /dev/null @@ -1,215 +0,0 @@ -name: Linux riscv64 - -on: - workflow_dispatch: - inputs: - srcrev: - description: 'Flutter Engine Commit Hash' - required: True - default: '' - release: - description: 'Release' - required: false - default: 'false' - -jobs: - linux-riscv64: - runs-on: [self-hosted, linux, x64] - env: - arch: riscv64 - linux_cpu: riscv64 - target_triple: riscv64-unknown-linux-gnu - target_sysroot: debian_trixie_riscv64-sysroot - tag_debug: linux-engine-sdk-debug-riscv64-${{ inputs.srcrev }} - tag_debug_unopt: linux-engine-sdk-debug-unopt-riscv64-${{ inputs.srcrev }} - tag_release: linux-engine-sdk-release-riscv64-${{ inputs.srcrev }} - tag_profile: linux-engine-sdk-profile-riscv64-${{ inputs.srcrev }} - notes_debug: "Flutter Engine - runtime debug SDK" - notes_debug_unopt: "Flutter Engine - runtime debug SDK" - notes_release: "Flutter Engine - runtime release SDK" - notes_profile: "Flutter Engine - runtime profile SDK" - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install packages - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - - - name: Get Flutter Source - run: | - export PATH=$PATH:$PWD/depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython - git clone https://github.com/flutter/flutter.git - pushd flutter - gclient config --spec 'solutions=[{"managed":False,"name":".","url":"https://github.com/flutter/flutter.git","custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True},"deps_file":"DEPS","safesync_url":""}]' - gclient sync --force --shallow --no-history -R -D --revision ${{ inputs.SRCREV }} -j$(nproc) -v - popd - - # fetch sysroot - cd flutter/engine/src - build/linux/sysroot_scripts/install-sysroot.py --arch=$arch - - - name: Patch Flutter Source - run: | - PATCH_DIR=$PWD/patches - cd flutter - - git apply $PATCH_DIR/0001-clang-toolchain.patch - git apply $PATCH_DIR/0003-gn-riscv32-and-riscv64.patch - git apply $PATCH_DIR/0005-fml-fixes-text_input-compiler-warnings.patch - git apply $PATCH_DIR/0007-flutter-linux-atk-glib-cxx-linkage.patch - - pushd engine/src/flutter/third_party/swiftshader - git apply $PATCH_DIR/flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch - git apply $PATCH_DIR/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch - popd - - - name: Build Debug - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_$arch - - - name: Prepare Debug Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_debug_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug.tar.gz flutter/engine/src/out/linux_debug_$arch/engine-sdk/ - - sha256sum -b $tag_debug.tar.gz > $tag_debug.tar.gz.sha256 - - - name: Publish Debug - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug - path: | - linux-engine-sdk-debug-riscv64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-riscv64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug" --cleanup-tag -y |true - gh release create --draft "$tag_debug" --title "$tag_debug" --notes "$notes_debug" - gh release upload "$tag_debug" "$tag_debug.tar.gz" "$tag_debug.tar.gz.sha256" - gh release edit "$tag_debug" --draft=false - - - name: Build Release - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=release \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_release_$arch - - - name: Prepare Release Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_release_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_release.tar.gz flutter/engine/src/out/linux_release_$arch/engine-sdk/ - - sha256sum -b $tag_release.tar.gz > $tag_release.tar.gz.sha256 - - - name: Publish Release - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-release - path: | - linux-engine-sdk-release-riscv64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-release-riscv64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_release" --cleanup-tag -y |true - gh release create --draft "$tag_release" --title "$tag_release" --notes "$notes_release" - gh release upload "$tag_release" "$tag_release.tar.gz" "$tag_release.tar.gz.sha256" - gh release edit "$tag_release" --draft=false - - - name: Build Profile - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=profile \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_profile_$arch - - - name: Prepare Profile Artifacts - run: | - scripts/prepare-sdk-$arch.sh flutter/engine/src/out/linux_profile_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_profile.tar.gz flutter/engine/src/out/linux_profile_$arch/engine-sdk/ - - sha256sum -b $tag_profile.tar.gz > $tag_profile.tar.gz.sha256 - - - name: Publish Profile - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-profile - path: | - linux-engine-sdk-profile-riscv64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-profile-riscv64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Profile - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_profile" --cleanup-tag -y |true - gh release create --draft "$tag_profile" --title "$tag_profile" --notes "$notes_profile" - gh release upload "$tag_profile" "$tag_profile.tar.gz" "$tag_profile.tar.gz.sha256" - gh release edit "$tag_profile" --draft=false diff --git a/.github/workflows/flutter-engine-x86_64.yaml b/.github/workflows/flutter-engine-x86_64.yaml deleted file mode 100644 index 3355ecd..0000000 --- a/.github/workflows/flutter-engine-x86_64.yaml +++ /dev/null @@ -1,256 +0,0 @@ -name: Linux x86_64 - -on: - workflow_dispatch: - inputs: - srcrev: - description: 'Flutter Engine Commit Hash' - required: True - default: '' - release: - description: 'Release' - required: false - default: 'false' - -jobs: - linux-x86_64: - runs-on: [self-hosted, linux, x64] - env: - arch: x64 - linux_cpu: x64 - target_triple: x86_64-unknown-linux-gnu - target_sysroot: debian_bullseye_amd64-sysroot - tag_debug: linux-engine-sdk-debug-x86_64-${{ inputs.srcrev }} - tag_debug_unopt: linux-engine-sdk-debug-unopt-x86_64-${{ inputs.srcrev }} - tag_release: linux-engine-sdk-release-x86_64-${{ inputs.srcrev }} - tag_profile: linux-engine-sdk-profile-x86_64-${{ inputs.srcrev }} - notes_debug: "Flutter Engine - runtime debug SDK" - notes_debug_unopt: "Flutter Engine - runtime debug SDK" - notes_release: "Flutter Engine - runtime release SDK" - notes_profile: "Flutter Engine - runtime profile SDK" - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install packages - run: | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - - - name: Get Flutter Source - run: | - export PATH=$PATH:$PWD/depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython - git clone https://github.com/flutter/flutter.git - pushd flutter - gclient config --spec 'solutions=[{"managed":False,"name":".","url":"https://github.com/flutter/flutter.git","custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True},"deps_file":"DEPS","safesync_url":""}]' - gclient sync --force --shallow --no-history -R -D --revision ${{ inputs.SRCREV }} -j$(nproc) -v - popd - - # fetch sysroot - cd flutter/engine/src - build/linux/sysroot_scripts/install-sysroot.py --arch=$arch - - - name: Patch Flutter Source - run: | - PATCH_DIR=$PWD/patches - cd flutter - git apply $PATCH_DIR/0001-clang-toolchain.patch - - - name: Build Debug - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_$arch - - - name: Prepare Debug Artifacts - run: | - scripts/prepare-sdk-x86-64.sh flutter/engine/src/out/linux_debug_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug.tar.gz flutter/engine/src/out/linux_debug_$arch/engine-sdk/ - - sha256sum -b $tag_debug.tar.gz > $tag_debug.tar.gz.sha256 - - - name: Publish Debug - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug - path: | - linux-engine-sdk-debug-x86_64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-x86_64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug" --cleanup-tag -y |true - gh release create --draft "$tag_debug" --title "$tag_debug" --notes "$notes_debug" - gh release upload "$tag_debug" "$tag_debug.tar.gz" "$tag_debug.tar.gz.sha256" - gh release edit "$tag_debug" --draft=false - - - name: Build Debug Unoptimized - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=debug \ - --unoptimized \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_debug_unopt_$arch - - - name: Prepare Debug Unoptimized Artifacts - run: | - scripts/prepare-sdk-x86-64.sh flutter/engine/src/out/linux_debug_unopt_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_debug_unopt.tar.gz flutter/engine/src/out/linux_debug_unopt_$arch/engine-sdk/ - - sha256sum -b $tag_debug_unopt.tar.gz > $tag_debug_unopt.tar.gz.sha256 - - - name: Publish Debug Unoptimized - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-debug-unoptimized - path: | - linux-engine-sdk-debug-unopt-x86_64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-unopt-x86_64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Debug Unoptimized Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_debug_unopt" --cleanup-tag -y |true - gh release create --draft "$tag_debug_unopt" --title "$tag_debug_unopt" --notes "$notes_debug_unopt" - gh release upload "$tag_debug_unopt" "$tag_debug_unopt.tar.gz" "$tag_debug_unopt.tar.gz.sha256" - gh release edit "$tag_debug_unopt" --draft=false - - - name: Build Release - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=release \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_release_$arch - - - name: Prepare Release Artifacts - run: | - scripts/prepare-sdk-x86-64.sh flutter/engine/src/out/linux_release_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_release.tar.gz flutter/engine/src/out/linux_release_$arch/engine-sdk/ - - sha256sum -b $tag_release.tar.gz > $tag_release.tar.gz.sha256 - - - name: Publish Release - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-release - path: | - linux-engine-sdk-release-x86_64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-release-x86_64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Release - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_release" --cleanup-tag -y |true - gh release create --draft "$tag_release" --title "$tag_release" --notes "$notes_release" - gh release upload "$tag_release" "$tag_release.tar.gz" "$tag_release.tar.gz.sha256" - gh release edit "$tag_release" --draft=false - - - name: Build Profile - working-directory: flutter/engine/src - run: | - export PATH=$PATH:$PWD/../../../depot_tools - export VPYTHON_VIRTUALENV_ROOT=$PWD/../../../vpython - CLANG_ROOT=$(find -iname clang++) - CLANG_ROOT=$(dirname $CLANG_ROOT) - export CLANG_ROOT=$(dirname $CLANG_ROOT) - ./flutter/tools/gn --runtime-mode=profile \ - --embedder-for-target \ - --no-build-embedder-examples \ - --no-goma --no-rbe \ - --no-stripped --no-enable-unittests \ - --no-dart-version-git-info \ - --linux-cpu $linux_cpu \ - --target-os linux \ - --target-sysroot $PWD/build/linux/$target_sysroot \ - --target-toolchain $PWD/$CLANG_ROOT \ - --target-triple $target_triple - ninja -C out/linux_profile_$arch - - - name: Prepare Profile Artifacts - run: | - scripts/prepare-sdk-x86-64.sh flutter/engine/src/out/linux_profile_$arch $PWD/flutter/engine/src/build/linux/$target_sysroot - - tar czfhv $tag_profile.tar.gz flutter/engine/src/out/linux_profile_$arch/engine-sdk/ - - sha256sum -b $tag_profile.tar.gz > $tag_profile.tar.gz.sha256 - - - name: Publish Profile - if: ${{ inputs.release != 'true' }} - uses: actions/upload-artifact@v4 - with: - name: engine-sdk-profile - path: | - linux-engine-sdk-profile-x86_64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-profile-x86_64-${{ inputs.srcrev }}.tar.gz.sha256 - - - name: Release - Publish Profile - if: ${{ inputs.release == 'true' }} - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - run: | - gh release delete "$tag_profile" --cleanup-tag -y |true - gh release create --draft "$tag_profile" --title "$tag_profile" --notes "$notes_profile" - gh release upload "$tag_profile" "$tag_profile.tar.gz" "$tag_profile.tar.gz.sha256" - gh release edit "$tag_profile" --draft=false diff --git a/.github/workflows/flutter-engine.yaml b/.github/workflows/flutter-engine.yaml new file mode 100644 index 0000000..b236b43 --- /dev/null +++ b/.github/workflows/flutter-engine.yaml @@ -0,0 +1,148 @@ +name: Flutter Engine + +# One job builds every (arch, runtime-mode) from a SINGLE gclient sync. +# +# The engine source closure (flutter monorepo + DEPS) is arch-independent, so it +# is fetched once. Each target arch adds only its Debian sysroot — installed side +# by side under build/linux/ — and its own gn invocation + out dir. The patch +# series is applied once to the shared tree: every patch is either inert for the +# other arches (0003 just adds riscv as a valid --linux-cpu; 0005/0007 are +# arch-neutral source fixes) or arch-conditional at gn time (swiftshader picks +# llvm-16 only for riscv64), so the superset is safe for all targets. +# +# Builds run SERIALLY. One `ninja -j nproc` already saturates the cores, so +# running arches/modes in parallel adds no throughput — only memory pressure +# (overlapping LTO release links is what exhausts RAM). Serial also keeps the +# source page-cache warm across modes, so it is if anything faster. + +on: + workflow_dispatch: + inputs: + srcrev: + description: 'Flutter Engine Commit Hash' + required: true + default: '' + release: + description: 'Release' + required: false + default: 'false' + # TEMPORARY (remove before merge): lets this workflow be exercised from the + # adoption branch, since workflow_dispatch only works once it is on the default + # branch. Pushes here build the default srcrev below with release=false. + push: + branches: [adopt-build-engine-sh] + +jobs: + build: + runs-on: [self-hosted, linux, x64] + env: + # From the dispatch input, or a known-good default for the push-triggered + # validation run. + SRCREV: ${{ github.event.inputs.srcrev || '77e2e94772b6eb43759e34ed1ad7da4674e19cab' }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Configure build for the shared machine (nproc-1, no-LTO on validation) + env: + RELEASE: ${{ inputs.release }} + run: | + # The self-hosted runner shares this machine with interactive work, so + # leave one core free. build-engine.sh honors EMB_JOBS for both the + # gclient sync (-j) and every ninja build. + n=$(nproc) + echo "EMB_JOBS=$(( n > 1 ? n - 1 : 1 ))" >> "$GITHUB_ENV" + # Validation (non-release) builds drop LTO: the release-mode LTO link is + # a single-threaded RAM spike that -j cannot tame on a shared machine. + # Real releases (release=true) keep LTO for a production engine. + if [ "$RELEASE" != "true" ]; then + echo "validation build: EMB_NO_LTO=1" + echo "EMB_NO_LTO=1" >> "$GITHUB_ENV" + fi + + - name: Fetch engine source (once, arch-independent) + run: | + # fetch is arch/mode-agnostic — the arch/mode args below are placeholders. + scripts/build-engine.sh fetch release x86_64 "$SRCREV" glibc "$PWD/engine-src" + + - name: Install all target sysroots (side by side) + working-directory: engine-src/engine/src + run: | + set -euo pipefail + for a in amd64 arm64 armhf riscv64; do + echo "::group::install-sysroot $a" + build/linux/sysroot_scripts/install-sysroot.py --arch="$a" + echo "::endgroup::" + done + + - name: Stage the unified patch series + run: cp patches/series-all patches/series + + - name: Build + package every arch × mode (serial, shared tree) + run: | + declare -A MODES=( + [x86_64]="debug debug-unopt profile release" + [arm64]="debug debug-unopt profile release" + [armv7hf]="debug debug-unopt profile release" + [riscv64]="debug profile release" + ) + # ninja out-dir naming mirrors build-engine.sh, so a packaged combo can be + # pruned to bound disk (all combos share one checkout — they accumulate). + cpu_of() { case "$1" in x86_64) echo x64;; arm64) echo arm64;; armv7hf) echo arm;; riscv64) echo riscv64;; esac; } + dir_of() { [ "$1" = debug-unopt ] && echo debug_unopt || echo "$1"; } + + failures=() + for arch in x86_64 arm64 armv7hf riscv64; do + for mode in ${MODES[$arch]}; do + echo "::group::build $arch $mode" + if EMB_SRC_DIR="$PWD/engine-src" \ + EMB_PATCH_DIR="$PWD/patches" \ + EMB_PREPARE_DIR="$PWD/scripts" \ + scripts/build-engine.sh build "$mode" "$arch" \ + "$SRCREV" glibc "$PWD/out/$arch/$mode"; then + tag="linux-engine-sdk-${mode}-${arch}-${SRCREV}" + tar czf "$tag.tar.gz" -C "$PWD/out/$arch/$mode" engine-sdk + sha256sum -b "$tag.tar.gz" > "$tag.tar.gz.sha256" + # reclaim the ninja + staged output for this combo + rm -rf "$PWD/out/$arch/$mode" \ + "engine-src/engine/src/out/linux_$(dir_of "$mode")_$(cpu_of "$arch")" + else + echo "::error::build failed: $arch $mode" + failures+=("$arch/$mode") + fi + echo "::endgroup::" + done + done + + if [ ${#failures[@]} -gt 0 ]; then + printf 'FAILED combos: %s\n' "${failures[*]}" >&2 + exit 1 + fi + + - name: Publish artifacts + if: ${{ always() && inputs.release != 'true' }} + uses: actions/upload-artifact@v4 + with: + name: engine-sdk + if-no-files-found: warn + path: | + linux-engine-sdk-*.tar.gz + linux-engine-sdk-*.tar.gz.sha256 + + - name: Release + if: ${{ inputs.release == 'true' }} + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + set -euo pipefail + shopt -s nullglob + for f in linux-engine-sdk-*.tar.gz; do + tag="${f%.tar.gz}" + gh release delete "$tag" --cleanup-tag -y || true + gh release create --draft "$tag" --title "$tag" --notes "Flutter Engine SDK: $tag" + gh release upload "$tag" "$tag.tar.gz" "$tag.tar.gz.sha256" + gh release edit "$tag" --draft=false + done diff --git a/patches/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch b/patches/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch index 0709b54..9e4e2f1 100644 --- a/patches/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch +++ b/patches/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch @@ -1,28 +1,43 @@ From d4ce6b54e3009ef96f55358e367a4a114a503b7f Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Mon, 24 Nov 2025 16:34:21 -0800 -Subject: [PATCH] [flutter/third_party/swiftshader] llvm-16.0 required for +Subject: [PATCH] [flutter/third_party/swiftshader] use llvm-16.0 for riscv64 + Reactor + +The swiftshader Reactor JIT selects its backend per target CPU (reactor.gni): +subzero for x86/arm32, the vendored LLVM for arm64 and riscv64. riscv64's +Reactor codegen needs llvm-16; arm64 builds green on the stock llvm-10. + +Make llvm_dir arch-conditional rather than an unconditional llvm-10 -> llvm-16 +bump, so this patch can belong to one shared, all-arch series applied once to a +single gclient closure: riscv64 gets llvm-16, every other arch keeps the llvm-10 +it was validated against. Both trees are vendored under +flutter/third_party/swiftshader/third_party. GN has no ternary, so this uses an +if/else (current_cpu is the target CPU gn resolves per build). Upstream-Status: Inappropriate Signed-off-by: Joel Winarske --- - src/Reactor/BUILD.gn | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/Reactor/BUILD.gn | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Reactor/BUILD.gn b/src/Reactor/BUILD.gn index 67dfeb0ec..dcb13614a 100644 --- a/src/Reactor/BUILD.gn +++ b/src/Reactor/BUILD.gn -@@ -307,7 +307,7 @@ if (supports_subzero) { - +@@ -307,7 +307,11 @@ if (supports_subzero) { + if (supports_llvm) { swiftshader_source_set("swiftshader_llvm_reactor") { - llvm_dir = "../../third_party/llvm-10.0" -+ llvm_dir = "../../third_party/llvm-16.0" - ++ if (current_cpu == "riscv64") { ++ llvm_dir = "../../third_party/llvm-16.0" ++ } else { ++ llvm_dir = "../../third_party/llvm-10.0" ++ } + deps = [ ":swiftshader_reactor_base", --- +-- 2.52.0 - diff --git a/patches/series-all b/patches/series-all new file mode 100644 index 0000000..6b3b312 --- /dev/null +++ b/patches/series-all @@ -0,0 +1,13 @@ +# Unified series for the single-tree CI build: applied ONCE to the shared gclient +# closure, it serves every arch. Each entry is either inert for the other arches +# (0003 only adds riscv as a valid --linux-cpu; 0005/0007 are arch-neutral source +# fixes) or arch-conditional at gn time (swiftshader-0002 picks llvm-16 for riscv64 +# and llvm-10 elsewhere), so the superset is safe for x86_64/arm64/armv7hf/riscv64. +# Columns: . Patches are rooted at the gclient solution +# (a/engine/src/...), so strip 3 lands them at the engine-src root. +0001-clang-toolchain.patch . 3 +0003-gn-riscv32-and-riscv64.patch . 3 +0005-fml-fixes-text_input-compiler-warnings.patch . 3 +0007-flutter-linux-atk-glib-cxx-linkage.patch . 3 +flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch flutter/third_party/swiftshader 1 +flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch flutter/third_party/swiftshader 1 diff --git a/patches/series-default b/patches/series-default new file mode 100644 index 0000000..172b564 --- /dev/null +++ b/patches/series-default @@ -0,0 +1,2 @@ +# arm64 / armv7hf / x86_64 +0001-clang-toolchain.patch . 3 diff --git a/patches/series-riscv64 b/patches/series-riscv64 new file mode 100644 index 0000000..9cbd008 --- /dev/null +++ b/patches/series-riscv64 @@ -0,0 +1,6 @@ +0001-clang-toolchain.patch . 3 +0003-gn-riscv32-and-riscv64.patch . 3 +0005-fml-fixes-text_input-compiler-warnings.patch . 3 +0007-flutter-linux-atk-glib-cxx-linkage.patch . 3 +flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch flutter/third_party/swiftshader 1 +flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch flutter/third_party/swiftshader 1 diff --git a/scripts/build-engine.sh b/scripts/build-engine.sh new file mode 100755 index 0000000..a2fe5db --- /dev/null +++ b/scripts/build-engine.sh @@ -0,0 +1,272 @@ +#!/usr/bin/env bash +# build-engine.sh — the single Flutter engine build recipe, shared by emb's +# EngineBuilder, meta-flutter/flutter-engine CI, and a meta-flutter (Yocto) +# recipe. +# +# Usage: +# build-engine.sh fetch +# build-engine.sh build +# +# Phases mirror the Yocto do_fetch / do_compile split: +# fetch — ALL network. depot_tools + `gclient sync` WITH hooks -> : the +# self-contained engine-src closure that must survive `unshare --net` +# (clang, sysroot, dart deps, cipd cache, vpython virtualenv). +# build — patch -> gn -> ninja -> prepare-sdk; emits /engine-sdk/. With +# EMB_OFFLINE=1 it must touch no network (never runs `gclient sync`). +# +# Env: +# EMB_OFFLINE=1 deny network in the build phase (an offline build) +# EMB_SRC_DIR= the fetched closure to build from (build phase) +# EMB_SYSROOT_DIR= override --target-sysroot (e.g. OE STAGING_DIR_TARGET) +# EMB_PATCH_DIR= engine patch series, applied in the build phase +# EMB_PREPARE_DIR= dir holding prepare-sdk-.sh (default: this dir) +# EMB_NO_LTO=1 drop LTO (a memory-constrained validation build) +# EMB_GN_ARGS= extra raw gn args (e.g. concurrent_toolchain_jobs=6) +# EMB_JOBS= ninja parallelism (default: nproc) +# +# The engine is always built with clang (its own bundled toolchain); the target +# libc is selected by the sysroot + triple, never by the compiler. +set -euo pipefail + +# Resolve this script's own directory once, up front: the build phase cd's into +# the engine tree before it needs the co-located prepare-sdk-.sh, so a +# later `dirname "$0"` would resolve against the wrong cwd. +self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +phase=${1:?phase: fetch|build} +mode=${2:?mode: release|profile|debug|debug-unopt} +arch=${3:?arch: x86_64|arm64|armv7hf|riscv64} +commit=${4:?engine commit} +libc=${5:?libc: glibc|musl} +out=${6:?output dir} +jobs=${EMB_JOBS:-$(nproc 2>/dev/null || echo 4)} + +# arch -> gn --linux-cpu, dpkg sysroot arch, and the toolchain cpu. The engine's +# gn wrapper expects LLVM-style `-unknown-linux-` triples (even for the +# x86_64 host build), which is what the bundled clang's tool names key off — a +# plain `x86_64-linux-gnu` triple makes it look for a nonexistent `-ar`. +case "$arch" in + x86_64) linux_cpu=x64; dpkg_arch=amd64; tcpu=x86_64 ;; + arm64) linux_cpu=arm64; dpkg_arch=arm64; tcpu=aarch64 ;; + armv7hf) linux_cpu=arm; dpkg_arch=armhf; tcpu=armv7 ;; + riscv64) linux_cpu=riscv64; dpkg_arch=riscv64; tcpu=riscv64 ;; + *) echo "build-engine: unknown arch '$arch'" >&2; exit 2 ;; +esac +case "$libc" in + glibc) abi=gnu ;; + musl) abi=musl ;; + *) echo "build-engine: unsupported libc '$libc' (clang-only; glibc|musl)" >&2; exit 2 ;; +esac +# `debug-unopt` is --runtime-mode=debug + --unoptimized, output under a +# linux_debug_unopt_ dir; the plain modes map straight through. +case "$mode" in + debug-unopt) runtime_mode=debug; mode_dir=debug_unopt; unopt=1 ;; + release|profile|debug) runtime_mode="$mode"; mode_dir="$mode"; unopt= ;; + *) echo "build-engine: unknown mode '$mode' (release|profile|debug|debug-unopt)" >&2; exit 2 ;; +esac +# armv7hf uses the hard-float eabihf ABI suffix. +[ "$arch" = armv7hf ] && abi="${abi}eabihf" +triple="${tcpu}-unknown-linux-${abi}" + +log() { printf '[build-engine %s] %s\n' "$phase" "$*" >&2; } + +fetch_phase() { + mkdir -p "$out" + cd "$out" + if [ ! -d depot_tools ]; then + log "cloning depot_tools" + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git + fi + export PATH="$out/depot_tools:$PATH" + # Pin to the flutter monorepo; download only the linux target deps. + gclient config --spec \ + 'solutions=[{"managed":False,"name":".","url":"https://github.com/flutter/flutter.git","custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True},"deps_file":"DEPS","safesync_url":""}]' + # HOOKS are essential: they materialise clang, the sysroot, dart deps, the + # cipd cache and the vpython virtualenv into the closure. Without them the + # offline build phase would try to fetch and fail. + log "gclient sync @ $commit (with hooks)" + gclient sync --force --shallow --no-history -R -D --revision "$commit" -j"$jobs" -v + log "closure ready at $out" +} + +build_phase() { + local src="${EMB_SRC_DIR:-$out}" + # Locate the engine build root: a from-scratch gclient (solution name ".") + # puts it at /engine/src; some CI layouts nest it under flutter/. + local eng + if [ -d "$src/engine/src" ]; then + eng="$src/engine/src" + elif [ -d "$src/flutter/engine/src" ]; then + eng="$src/flutter/engine/src" + else + echo "build-engine: no engine src under $src (run the fetch phase first)" >&2 + exit 3 + fi + cd "$eng" + export PATH="$src/depot_tools:$PATH" + [ -d "$src/vpython" ] && export VPYTHON_VIRTUALENV_ROOT="$src/vpython" + + if [ -n "${EMB_OFFLINE:-}" ]; then + # Belt-and-braces: an offline build must never sync. emb's --offline-strict + # (and Yocto's do_compile sandbox) enforce this at the process level too. + export DEPOT_TOOLS_UPDATE=0 CIPD_CACHE_DIR="$src/.cipd" NO_AUTO_UPDATE=1 + log "OFFLINE build (network denied)" + fi + if [ -n "${EMB_PATCH_DIR:-}" ]; then + log "applying patch series from $EMB_PATCH_DIR" + # An optional `series` file gives per-patch apply dirs (" ", + # blanks/#comments ignored), mirroring OE's patchdir= — the musl libc++/dart + # patches live under flutter/third_party. Without a series, patches apply at + # the engine-src root. + # Plain `patch`, not `git apply`: engine DEPS pull subtrees like + # flutter/third_party/dart in as nested git repos that the outer tree + # ignores, and `git apply` silently refuses to touch files under them. GNU + # patch has no such boundary. Idempotent: a patch that reverse-applies + # cleanly is already in, so skip it (safe to re-run / incremental checkout). + # series line: " [subdir] [strip]" — subdir is the -d apply dir + # (default the engine-src root, "."), strip is -p (default 1). This lets + # a repo keep patches that git apply reads from a different root: e.g. paths + # rooted at the gclient solution (a/engine/src/...) apply here with strip 3. + if [ -f "$EMB_PATCH_DIR/series" ]; then + while read -r pf pdir pstrip _; do + [ -z "$pf" ] && continue + case "$pf" in \#*) continue ;; esac + local pd="${pdir:-.}" ps="${pstrip:-1}" + if patch -p"$ps" -d "$pd" -R --dry-run --force \ + < "$EMB_PATCH_DIR/$pf" >/dev/null 2>&1; then + log " skip $pf (already applied)" + continue + fi + log " apply $pf${pdir:+ (in $pdir)}${pstrip:+ -p$pstrip}" + patch -p"$ps" -d "$pd" --force --no-backup-if-mismatch \ + < "$EMB_PATCH_DIR/$pf" + done < "$EMB_PATCH_DIR/series" + else + for p in "$EMB_PATCH_DIR"/*.patch; do + [ -e "$p" ] || continue + patch -p1 --force --no-backup-if-mismatch < "$p" || true + done + fi + fi + + # musl target tweaks (mirror meta-flutter's flutter-engine recipe): honor the + # overridden --target-sysroot instead of the bundled Debian one, and drop the + # glibc-only mallinfo define swiftshader's vendored LLVM assumes. + if [ "$libc" = musl ]; then + log "musl: default-sysroot off + swiftshader mallinfo fix" + [ -f build/config/sysroot.gni ] && sed -i \ + 's|use_default_linux_sysroot = true|use_default_linux_sysroot = false|g' \ + build/config/sysroot.gni + # swiftshader vendors an LLVM whose Linux config.h assumes glibc — turn off + # the features musl lacks (mallinfo/mallinfo2, and execinfo.h backtrace) in + # whichever copy this engine ships (llvm-subzero and/or the older llvm-10.0). + local ssd='flutter/third_party/swiftshader/third_party' + for scfg in \ + "$ssd"/llvm-subzero/build/Linux/include/llvm/Config/config.h \ + "$ssd"/llvm-*/configs/linux/include/llvm/Config/config.h; do + [ -f "$scfg" ] && sed -i -E \ + 's@^#define (HAVE_MALLINFO2?|HAVE_BACKTRACE|HAVE_EXECINFO_H) 1$@/* #undef \1 */@' \ + "$scfg" + done + # The custom target toolchain (from --target-toolchain) compiles with its own + # BUILD.gn, which does not pick up extra_cflags_cc — so inject the musl compile + # defines straight into its commands: tell in-tree libc++ it is on musl (it + # then selects its native musl locale path, no libc++ patch needed), and force + # flatbuffers off its locale-independent path (it keys on _XOPEN_VERSION>=700, + # which musl advertises without providing strtoll_l/strtoull_l). Normalize any + # prior injection back to the bare anchor first, so re-runs are deterministic. + ctc='build/toolchain/custom/BUILD.gn' + if [ -f "$ctc" ]; then + sed -i -E 's|\$sysroot_flags[^{]* \{\{defines\}\}|$sysroot_flags {{defines}}|g' "$ctc" + sed -i 's|\$sysroot_flags {{defines}}|$sysroot_flags -D_LIBCPP_HAS_MUSL_LIBC -DFLATBUFFERS_LOCALE_INDEPENDENT=0 {{defines}}|g' "$ctc" + fi + fi + + local outdir="out/linux_${mode_dir}_${linux_cpu}" + + # Sysroot (all targets, x86_64 host included — it also supplies wayland etc. + # that gn config like ANGLE needs): OE/musl override via EMB_SYSROOT_DIR, else + # auto-discover the gclient-provided Debian sysroot by its dpkg arch. + local sysroot="${EMB_SYSROOT_DIR:-}" + [ -z "$sysroot" ] && sysroot=$(ls -d "$eng"/build/linux/debian_*_"${dpkg_arch}"-sysroot 2>/dev/null | head -n1) + [ -n "$sysroot" ] && [ -d "$sysroot" ] || { + echo "build-engine: no sysroot for $arch (dpkg=$dpkg_arch); set EMB_SYSROOT_DIR" >&2 + exit 4 + } + local clang_root + clang_root=$(dirname "$(dirname "$(find "$eng/flutter/buildtools" -iname clang++ 2>/dev/null | head -n1)")") + + # The engine's gn linux toolchain compiles with an unprefixed clang but + # archives/strips with -{ar,nm,...}; the bundled clang ships only the + # llvm-* multitools, so provide the prefixed names (llvm-ar acts as ar, etc.). + local cbin="$clang_root/bin" t + for t in ar nm objcopy objdump strip ranlib readelf dwp; do + if [ ! -e "$cbin/${triple}-${t}" ] && [ -e "$cbin/llvm-${t}" ]; then + ln -sf "llvm-${t}" "$cbin/${triple}-${t}" + fi + done + + # musl compiler-rt fallback: the bundled clang ships builtins only for -gnu + # triples. clang resolves most musl targets to their -gnu builtins, but some + # (riscv64) find nothing and fail to link; point the missing musl per-target + # runtime dir at the -gnu one so the builtins/crt resolve. + if [ "$libc" = musl ]; then + local gnutriple rtbase + gnutriple="${triple/musl/gnu}" # e.g. ...-linux-musl -> ...-linux-gnu + rtbase=$(ls -d "$clang_root"/lib/clang/*/lib 2>/dev/null | head -n1 || true) + if [ -n "$rtbase" ] && [ -d "$rtbase/$gnutriple" ] && \ + [ ! -e "$rtbase/$triple" ]; then + ln -sfn "$gnutriple" "$rtbase/$triple" + fi + fi + + local -a gnargs=( + --runtime-mode="$runtime_mode" --embedder-for-target --no-build-embedder-examples + --disable-desktop-embeddings + --no-goma --no-rbe --no-stripped --no-enable-unittests + --no-dart-version-git-info --linux-cpu "$linux_cpu" --target-os linux + --target-sysroot "$sysroot" --target-toolchain "$clang_root" + --target-triple "$triple" + ) + + # EMB_NO_LTO makes the release link far lighter (a memory-constrained + # validation; production keeps LTO). + [ -n "${EMB_NO_LTO:-}" ] && gnargs+=(--no-lto) + + # musl has no glibc execinfo backtrace. The libc++ musl define is injected into + # the custom toolchain above (extra_cflags_cc does not reach it). EMB_GN_ARGS + # passes through any caller-supplied raw gn args. + [ -n "${EMB_GN_ARGS:-}" ] && gnargs+=(--gn-args="$EMB_GN_ARGS") + [ "$libc" = musl ] && gnargs+=(--no-backtrace) + + # armv7hf is hard-float: the triple/sysroot are gnueabihf, but gn defaults arm + # to softfp, which then looks for the hard-float sysroot's nonexistent + # gnu/stubs-soft.h. Select hard float to match. + [ "$arch" = armv7hf ] && gnargs+=(--arm-float-abi hard) + [ -n "$unopt" ] && gnargs+=(--unoptimized) + + log "gn ($mode/$arch/$libc cpu=$linux_cpu ${EMB_NO_LTO:+ no-lto})" + ./flutter/tools/gn "${gnargs[@]}" + ninja -C "$outdir" -j"$jobs" + + # Assemble the engine-sdk/ contract via the co-located prepare-sdk + # (EMB_PREPARE_DIR overrides). x64's script is prepare-sdk-x86-64.sh (dash). + local prep_arch="$arch"; [ "$arch" = x86_64 ] && prep_arch=x86-64 + local prep_dir="${EMB_PREPARE_DIR:-$self_dir}" + local prep="$prep_dir/prepare-sdk-${prep_arch}.sh" + [ -x "$prep" ] || prep=$(command -v "prepare-sdk-${prep_arch}.sh") || { + echo "build-engine: prepare-sdk-${prep_arch}.sh not found (set EMB_PREPARE_DIR)" >&2 + exit 5 + } + log "prepare-sdk -> engine-sdk/" + "$prep" "$outdir" "$sysroot" + mkdir -p "$out" + cp -a "$outdir/engine-sdk/." "$out/engine-sdk/" + log "engine-sdk staged at $out/engine-sdk" +} + +case "$phase" in + fetch) fetch_phase ;; + build) build_phase ;; + *) echo "build-engine: unknown phase '$phase' (fetch|build)" >&2; exit 2 ;; +esac