From 404f54a8ff2bd5901b4ca52778d71291fe7b5de5 Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Tue, 25 Nov 2025 10:30:22 -0800 Subject: [PATCH] Flutter 3.38.3 -moves to debian bullseye -riscv64 Signed-off-by: Joel Winarske --- .github/workflows/flutter-engine-riscv64.yaml | 66 +++---------- ...rty-abseil-cpp-clang-compiler-warnin.patch | 39 ++++++++ ...rty-googletest-fix-implicit-conversi.patch | 34 +++++++ ...rty-swiftshader-pointer-cast-to-void.patch | 42 ++++++++ ...rty-swiftshader-llvm-16.0-required-f.patch | 28 ++++++ scripts/prepare-sdk-riscv64.sh | 95 +++++++++++++++++++ 6 files changed, 253 insertions(+), 51 deletions(-) create mode 100644 patches/flutter/third_party/abseil-cpp/0001-flutter-third_party-abseil-cpp-clang-compiler-warnin.patch create mode 100644 patches/flutter/third_party/googletest/0001-flutter-third_party-googletest-fix-implicit-conversi.patch create mode 100644 patches/flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch create mode 100644 patches/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch create mode 100755 scripts/prepare-sdk-riscv64.sh diff --git a/.github/workflows/flutter-engine-riscv64.yaml b/.github/workflows/flutter-engine-riscv64.yaml index 55196ec..0ff3b92 100644 --- a/.github/workflows/flutter-engine-riscv64.yaml +++ b/.github/workflows/flutter-engine-riscv64.yaml @@ -56,11 +56,25 @@ jobs: 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/0006-impeller-unnecessary-virtual-specifier.patch - + + pushd engine/src/flutter/third_party/abseil-cpp + git apply $PATCH_DIR/flutter/third_party/abseil-cpp/0001-flutter-third_party-abseil-cpp-clang-compiler-warnin.patch + popd + + pushd engine/src/flutter/third_party/googletest + git apply $PATCH_DIR/flutter/third_party/googletest/0001-flutter-third_party-googletest-fix-implicit-conversi.patch + popd + + 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: | @@ -110,56 +124,6 @@ jobs: 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-riscv64-${{ inputs.srcrev }}.tar.gz - linux-engine-sdk-debug-unopt-riscv64-${{ 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: | diff --git a/patches/flutter/third_party/abseil-cpp/0001-flutter-third_party-abseil-cpp-clang-compiler-warnin.patch b/patches/flutter/third_party/abseil-cpp/0001-flutter-third_party-abseil-cpp-clang-compiler-warnin.patch new file mode 100644 index 0000000..d692a10 --- /dev/null +++ b/patches/flutter/third_party/abseil-cpp/0001-flutter-third_party-abseil-cpp-clang-compiler-warnin.patch @@ -0,0 +1,39 @@ +From 08320737783dea5aa976783d6578bda03917165b Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Sun, 9 Nov 2025 09:06:19 -0800 +Subject: [PATCH] [flutter/third_party/abseil-cpp] clang compiler warnings + +-rebase patch + +Upstream-Status: Inappropriate + +Signed-off-by: Joel Winarske +--- + absl/debugging/internal/stacktrace_riscv-inl.inc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/absl/debugging/internal/stacktrace_riscv-inl.inc b/absl/debugging/internal/stacktrace_riscv-inl.inc +index 20183fa..be94560 100644 +--- a/absl/debugging/internal/stacktrace_riscv-inl.inc ++++ b/absl/debugging/internal/stacktrace_riscv-inl.inc +@@ -44,7 +44,7 @@ template + static inline uintptr_t ComputeStackFrameSize(const T *low, const T *high) { + const char *low_char_ptr = reinterpret_cast(low); + const char *high_char_ptr = reinterpret_cast(high); +- return low < high ? high_char_ptr - low_char_ptr : kUnknownFrameSize; ++ return low < high ? static_cast(high_char_ptr - low_char_ptr) : kUnknownFrameSize; + } + + // Given a pointer to a stack frame, locate and return the calling stackframe, +@@ -151,7 +151,7 @@ static int UnwindImpl(void **result, int *sizes, int max_depth, int skip_count, + } else { + result[n] = return_address; + if (IS_STACK_FRAMES) { +- sizes[n] = ComputeStackFrameSize(frame_pointer, next_frame_pointer); ++ sizes[n] = static_cast(ComputeStackFrameSize(frame_pointer, next_frame_pointer)); + } + n++; + } +-- +2.51.1 + diff --git a/patches/flutter/third_party/googletest/0001-flutter-third_party-googletest-fix-implicit-conversi.patch b/patches/flutter/third_party/googletest/0001-flutter-third_party-googletest-fix-implicit-conversi.patch new file mode 100644 index 0000000..c45c797 --- /dev/null +++ b/patches/flutter/third_party/googletest/0001-flutter-third_party-googletest-fix-implicit-conversi.patch @@ -0,0 +1,34 @@ +From b8817a6a271d1b3738ef275ac1020b4189957716 Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Mon, 10 Nov 2025 07:18:28 -0800 +Subject: [PATCH] [flutter/third_party/googletest] fix implicit conversion + error + +Upstream-Status: Inappropriate + +Signed-off-by: Joel Winarske +--- + googletest/include/gtest/gtest-printers.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h +index 1b12ef68..e56cfd15 100644 +--- a/googletest/include/gtest/gtest-printers.h ++++ b/googletest/include/gtest/gtest-printers.h +@@ -517,11 +517,11 @@ GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os); + + GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os); + inline void PrintTo(char16_t c, ::std::ostream* os) { +- PrintTo(ImplicitCast_(c), os); ++ PrintTo(static_cast(c), os); + } + #ifdef __cpp_lib_char8_t + inline void PrintTo(char8_t c, ::std::ostream* os) { +- PrintTo(ImplicitCast_(c), os); ++ PrintTo(static_cast(c), os); + } + #endif + +-- +2.51.1 + diff --git a/patches/flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch b/patches/flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch new file mode 100644 index 0000000..60f4b9c --- /dev/null +++ b/patches/flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch @@ -0,0 +1,42 @@ +From 68828dc53efbf4cd42a748e2a637d36ad2a7da12 Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Mon, 10 Nov 2025 10:53:11 -0800 +Subject: [PATCH 1/2] [flutter/third_party/swiftshader] pointer cast to void* + +Upstream-Status: Inappropriate + +Signed-off-by: Joel Winarske +--- + src/Device/Memset.hpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/Device/Memset.hpp b/src/Device/Memset.hpp +index 91c7e4d73..5b5e1e6c5 100644 +--- a/src/Device/Memset.hpp ++++ b/src/Device/Memset.hpp +@@ -39,19 +39,19 @@ struct Memset + { + static_assert(std::is_base_of, T>::value, "Memset must only clear the memory of a type of which it is a base class"); + static_assert(!std::is_polymorphic::value, "Memset must not be used with classes that have virtual functions"); +- ::memset(object, 0, sizeof(T)); ++ ::memset(static_cast(object), 0, sizeof(T)); + } + + // Don't rely on the implicitly declared copy constructor and copy assignment operator. + // They can leave padding bytes uninitialized. + Memset(const Memset &rhs) + { +- ::memcpy(this, &rhs, sizeof(T)); ++ ::memcpy((void*)this, (void*)&rhs, sizeof(T)); + } + + Memset &operator=(const Memset &rhs) + { +- ::memcpy(this, &rhs, sizeof(T)); ++ ::memcpy((void*)this, (void*)&rhs, sizeof(T)); + return *this; + } + +-- +2.51.1 + 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 new file mode 100644 index 0000000..0709b54 --- /dev/null +++ b/patches/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch @@ -0,0 +1,28 @@ +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 + +Upstream-Status: Inappropriate + +Signed-off-by: Joel Winarske +--- + src/Reactor/BUILD.gn | 2 +- + 1 file changed, 1 insertion(+), 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) { + + if (supports_llvm) { + swiftshader_source_set("swiftshader_llvm_reactor") { +- llvm_dir = "../../third_party/llvm-10.0" ++ llvm_dir = "../../third_party/llvm-16.0" + + deps = [ + ":swiftshader_reactor_base", +-- +2.52.0 + diff --git a/scripts/prepare-sdk-riscv64.sh b/scripts/prepare-sdk-riscv64.sh new file mode 100755 index 0000000..0a064d9 --- /dev/null +++ b/scripts/prepare-sdk-riscv64.sh @@ -0,0 +1,95 @@ +#! /bin/bash + +pushd $1 + +SYSROOT=$2 + +mkdir -p engine-sdk/{bin,include,lib,data,clang_x64/bin,clang_x64/lib64} + +# +# Include +# +cp *.h engine-sdk/include/ + +# +# /data +# +cp icudtl.dat engine-sdk/data/ + +# +# cpp_client_wrapper_glfw +# +if [ -e cpp_client_wrapper_glfw ]; then + mkdir -p engine-sdk/sdk/cpp_client_wrapper_glfw/ + cp -r cpp_client_wrapper_glfw/* engine-sdk/sdk/cpp_client_wrapper_glfw/ +fi + +# +# flutter_linux +# +if [ -e flutter_linux ]; then + mkdir -p engine-sdk/include/flutter_linux + cp -r flutter_linux/* engine-sdk/include/flutter_linux/ +fi + +# +# flutter_patched_sdk +# +if [ -e flutter_patched_sdk ]; then + mkdir -p engine-sdk/sdk/flutter_patched_sdk + cp -r flutter_patched_sdk/* engine-sdk/sdk/flutter_patched_sdk/ +fi + +# +# shader_lib +# +if [ -e shader_lib ]; then + mkdir -p engine-sdk/sdk/flutter_patched_sdk + cp -r shader_lib engine-sdk/ +fi + +# +# zip archives +# +if [ -e zip_archives ]; then + mkdir -p engine-sdk/sdk/zip_archives + cp -r zip_archives/* engine-sdk/sdk/zip_archives/ +fi + + +export cwd=$(pwd) + +# +# host - x64 +# +cd clang_x64/exe.unstripped +for file in *; do + cp "../$file" $cwd/engine-sdk/clang_x64/bin/ + + # Copy each library with its parent directories to the target directory + for library in $(ldd "$file" | cut -d '>' -f 2 | awk '{print $1}') + do + [ -f "${library}" ] && cp --verbose --parents "${library}" "$cwd/engine-sdk/clang_x64/" + done +done +cd $cwd + +# +# /bin +# +cd exe.unstripped +for file in *; do + cp "../$file" $cwd/engine-sdk/bin/ +done +cd $cwd + +# +# /lib +# +cd so.unstripped +for file in *; do + cp "../$file" $cwd/engine-sdk/lib/ +done +cd $cwd + +popd