Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 15 additions & 51 deletions .github/workflows/flutter-engine-riscv64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 08320737783dea5aa976783d6578bda03917165b Mon Sep 17 00:00:00 2001
From: Joel Winarske <joel.winarske@gmail.com>
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 <joel.winarske@gmail.com>
---
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 <typename T>
static inline uintptr_t ComputeStackFrameSize(const T *low, const T *high) {
const char *low_char_ptr = reinterpret_cast<const char *>(low);
const char *high_char_ptr = reinterpret_cast<const char *>(high);
- return low < high ? high_char_ptr - low_char_ptr : kUnknownFrameSize;
+ return low < high ? static_cast<uintptr_t>(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<int>(ComputeStackFrameSize(frame_pointer, next_frame_pointer));
}
n++;
}
--
2.51.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From b8817a6a271d1b3738ef275ac1020b4189957716 Mon Sep 17 00:00:00 2001
From: Joel Winarske <joel.winarske@gmail.com>
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 <joel.winarske@gmail.com>
---
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_<char32_t>(c), os);
+ PrintTo(static_cast<char32_t>(c), os);
}
#ifdef __cpp_lib_char8_t
inline void PrintTo(char8_t c, ::std::ostream* os) {
- PrintTo(ImplicitCast_<char32_t>(c), os);
+ PrintTo(static_cast<char32_t>(c), os);
}
#endif

--
2.51.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 68828dc53efbf4cd42a748e2a637d36ad2a7da12 Mon Sep 17 00:00:00 2001
From: Joel Winarske <joel.winarske@gmail.com>
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 <joel.winarske@gmail.com>
---
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<Memset<T>, T>::value, "Memset<T> must only clear the memory of a type of which it is a base class");
static_assert(!std::is_polymorphic<T>::value, "Memset<T> must not be used with classes that have virtual functions");
- ::memset(object, 0, sizeof(T));
+ ::memset(static_cast<void*>(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

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From d4ce6b54e3009ef96f55358e367a4a114a503b7f Mon Sep 17 00:00:00 2001
From: Joel Winarske <joel.winarske@gmail.com>
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 <joel.winarske@gmail.com>
---
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

95 changes: 95 additions & 0 deletions scripts/prepare-sdk-riscv64.sh
Original file line number Diff line number Diff line change
@@ -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