Skip to content

Commit fdffaca

Browse files
committed
flutter-engine
-rename flutter-engine to flutter-engine-deprecated -rename flutter-engine-mono to flutter-engine -update riscv patches -apply riscv patches for all build scenarios improve test milage enable future path of building flutter-engine directly on riscv64 machine Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
1 parent 93dd95a commit fdffaca

8 files changed

Lines changed: 289 additions & 139 deletions
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "flutter-engine-mono",
2+
"id": "flutter-engine-deprecated",
33
"load": false,
44
"supported_archs": [
55
"aarch64",
@@ -15,24 +15,23 @@
1515
"PATH": "${FLUTTER_WORKSPACE}/app/depot_tools:${PATH}",
1616
"RUNTIME_MODE": "debug",
1717
"DEPOT_TOOLS": "${FLUTTER_WORKSPACE}/app/depot_tools",
18-
"ENGINE_ROOT": "${FLUTTER_WORKSPACE}/flutter",
18+
"ENGINE_ROOT": "${FLUTTER_WORKSPACE}/app/engine",
1919
"VPYTHON_VIRTUALENV_ROOT": "${ENGINE_ROOT}/.vpython",
20-
"ENGINE_SRC_DIR_RELATIVE": "engine/src",
20+
"ENGINE_SRC_DIR_RELATIVE": "src",
2121
"ENGINE_SRC_DIR": "${ENGINE_ROOT}/${ENGINE_SRC_DIR_RELATIVE}",
22-
"ENGINE_BUILD_FLAGS": "--unoptimized --runtime-mode=${RUNTIME_MODE} --no-prebuilt-dart-sdk --embedder-for-target --enable-fontconfig --disable-desktop-embeddings --no-build-embedder-examples --enable-impeller-3d --no-lto --no-goma --no-rbe --no-stripped --no-enable-unittests",
23-
"ENGINE_BUILD_DIR": "${ENGINE_SRC_DIR}/out/host_debug_unopt",
22+
"ENGINE_BUILD_FLAGS": "--runtime-mode=${RUNTIME_MODE} --embedder-for-target --enable-fontconfig --disable-desktop-embeddings --no-build-embedder-examples --enable-impeller-3d --no-lto --no-goma --no-rbe --no-stripped --no-enable-unittests",
23+
"ENGINE_BUILD_DIR": "${ENGINE_SRC_DIR}/out/host_debug",
2424
"GN_ARGS_FILE": "${ENGINE_BUILD_DIR}/args.gn",
2525
"GN_ARGS_APPEND": "",
26-
"PATCH_FOLDER": "${FLUTTER_WORKSPACE}/patches/flutter-engine-mono"
26+
"PATCH_FOLDER": "${FLUTTER_WORKSPACE}/patches/flutter-engine-deprecated"
2727
},
2828
"src": [],
2929
"runtime": {
3030
"gclient_config": {
3131
"path": "${ENGINE_ROOT}",
3232
"managed": false,
33-
"name": ".",
34-
"url": "https://github.com/flutter/flutter.git",
35-
"custom_deps": {},
33+
"name": "src/flutter",
34+
"url": "https://github.com/flutter/engine.git",
3635
"custom_vars": {
3736
"download_android_deps": false,
3837
"download_windows_deps": false,
@@ -74,7 +73,7 @@
7473
{
7574
"cwd": "${ENGINE_ROOT}",
7675
"cmds": [
77-
"gclient sync -D -R -j${HARDWARE_THREADS} -v"
76+
"gclient sync -D -R --revision ${FLUTTER_ENGINE_VERSION} -j${HARDWARE_THREADS} -v"
7877
]
7978
},
8079
{

configs/flutter-engine.json

Lines changed: 133 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,134 @@
1-
{
2-
"id": "flutter-engine",
3-
"load": false,
4-
"supported_archs": [
5-
"aarch64",
6-
"arm64",
7-
"x86_64"
8-
],
9-
"supported_host_types": [
10-
"ubuntu",
11-
"fedora"
12-
],
13-
"type": "dependency",
14-
"env": {
15-
"PATH": "${FLUTTER_WORKSPACE}/app/depot_tools:${PATH}",
16-
"RUNTIME_MODE": "debug",
17-
"DEPOT_TOOLS": "${FLUTTER_WORKSPACE}/app/depot_tools",
18-
"ENGINE_ROOT": "${FLUTTER_WORKSPACE}/app/engine",
19-
"VPYTHON_VIRTUALENV_ROOT": "${ENGINE_ROOT}/.vpython",
20-
"ENGINE_SRC_DIR_RELATIVE": "src",
21-
"ENGINE_SRC_DIR": "${ENGINE_ROOT}/${ENGINE_SRC_DIR_RELATIVE}",
22-
"ENGINE_BUILD_FLAGS": "--runtime-mode=${RUNTIME_MODE} --embedder-for-target --enable-fontconfig --disable-desktop-embeddings --no-build-embedder-examples --enable-impeller-3d --no-lto --no-goma --no-rbe --no-stripped --no-enable-unittests",
23-
"ENGINE_BUILD_DIR": "${ENGINE_SRC_DIR}/out/host_debug",
24-
"GN_ARGS_FILE": "${ENGINE_BUILD_DIR}/args.gn",
25-
"GN_ARGS_APPEND": "",
26-
"PATCH_FOLDER": "${FLUTTER_WORKSPACE}/patches/flutter-engine"
27-
},
28-
"src": [],
29-
"runtime": {
30-
"gclient_config": {
31-
"path": "${ENGINE_ROOT}",
32-
"managed": false,
33-
"name": "src/flutter",
34-
"url": "https://github.com/flutter/engine.git",
35-
"custom_vars": {
36-
"download_android_deps": false,
37-
"download_windows_deps": false,
38-
"download_linux_deps": true,
39-
"download_emsdk": false
40-
},
41-
"deps_file": "DEPS",
42-
"safesync_url": ""
43-
},
44-
"pre-requisites": {
45-
"aarch64": {
46-
"ubuntu": {
47-
"cmds": [
48-
"sudo apt-get install -yq pkg-config libfreetype-dev git"
49-
]
50-
}
51-
},
52-
"x86_64": {
53-
"ubuntu": {
54-
"cmds": [
55-
"sudo apt-get install -yq pkg-config libfreetype-dev git"
56-
]
57-
},
58-
"fedora": {
59-
"cmds": [
60-
"sudo dnf install -y pkg-config freetype-devel git"
61-
]
62-
}
63-
}
64-
},
65-
"post_cmds": [
66-
{
67-
"cwd": "${ENGINE_SRC_DIR}",
68-
"cmds": [
69-
"git reset --hard",
70-
"git apply ${PATCH_FOLDER}/0001-clang-toolchain.patch"
71-
]
72-
},
73-
{
74-
"cwd": "${ENGINE_ROOT}",
75-
"cmds": [
76-
"gclient sync -D -R --revision ${FLUTTER_ENGINE_VERSION} -j${HARDWARE_THREADS} -v"
77-
]
78-
},
79-
{
80-
"cwd": "${ENGINE_SRC_DIR}/flutter",
81-
"cmds": [
82-
"git reset --hard"
83-
]
84-
},
85-
{
86-
"cwd": "${ENGINE_SRC_DIR}",
87-
"cmds": [
88-
"./flutter/tools/gn ${ENGINE_BUILD_FLAGS}",
89-
"echo ${GN_ARGS_APPEND} >> ${GN_ARGS_FILE}",
90-
"${AUTONINJA} -C ${ENGINE_BUILD_DIR}"
91-
]
92-
},
93-
{
94-
"cwd": "${ENGINE_BUILD_DIR}",
95-
"cmds": [
96-
"rm -rf ${PLATFORM_ID_DIR}/bundle | true",
97-
"mkdir -p ${PLATFORM_ID_DIR}/bundle/data/",
98-
"mkdir -p ${PLATFORM_ID_DIR}/bundle/lib/",
99-
"cp ${ENGINE_BUILD_DIR}/icudtl.dat ${PLATFORM_ID_DIR}/bundle/data/",
100-
"cp ${ENGINE_BUILD_DIR}/libflutter_engine.so ${PLATFORM_ID_DIR}/bundle/lib/"
101-
]
102-
}
103-
],
104-
"do_clean": [
105-
{
106-
"cwd": "${ENGINE_BUILD_DIR}",
107-
"cmds": [
108-
"ninja -t clean"
109-
]
110-
}
111-
]
112-
}
1+
{
2+
"id": "flutter-engine",
3+
"load": false,
4+
"supported_archs": [
5+
"aarch64",
6+
"arm64",
7+
"x86_64"
8+
],
9+
"supported_host_types": [
10+
"ubuntu",
11+
"fedora"
12+
],
13+
"type": "dependency",
14+
"env": {
15+
"PATH": "${FLUTTER_WORKSPACE}/app/depot_tools:${PATH}",
16+
"RUNTIME_MODE": "debug",
17+
"DEPOT_TOOLS": "${FLUTTER_WORKSPACE}/app/depot_tools",
18+
"ENGINE_ROOT": "${FLUTTER_WORKSPACE}/flutter",
19+
"VPYTHON_VIRTUALENV_ROOT": "${ENGINE_ROOT}/.vpython",
20+
"ENGINE_SRC_DIR_RELATIVE": "engine/src",
21+
"ENGINE_SRC_DIR": "${ENGINE_ROOT}/${ENGINE_SRC_DIR_RELATIVE}",
22+
"ENGINE_BUILD_FLAGS": "--unoptimized --runtime-mode=${RUNTIME_MODE} --no-prebuilt-dart-sdk --embedder-for-target --enable-fontconfig --disable-desktop-embeddings --no-build-embedder-examples --no-lto --no-goma --no-rbe --no-stripped --no-enable-unittests",
23+
"ENGINE_BUILD_DIR": "${ENGINE_SRC_DIR}/out/host_debug_unopt",
24+
"GN_ARGS_FILE": "${ENGINE_BUILD_DIR}/args.gn",
25+
"GN_ARGS_APPEND": "",
26+
"PATCH_FOLDER": "${FLUTTER_WORKSPACE}/patches/flutter-engine"
27+
},
28+
"src": [],
29+
"runtime": {
30+
"gclient_config": {
31+
"path": "${ENGINE_ROOT}",
32+
"managed": false,
33+
"name": ".",
34+
"url": "https://github.com/flutter/flutter.git",
35+
"custom_deps": {},
36+
"custom_vars": {
37+
"download_android_deps": false,
38+
"download_windows_deps": false,
39+
"download_linux_deps": true,
40+
"download_emsdk": false
41+
},
42+
"deps_file": "DEPS",
43+
"safesync_url": ""
44+
},
45+
"pre-requisites": {
46+
"aarch64": {
47+
"ubuntu": {
48+
"cmds": [
49+
"sudo apt-get install -yq pkg-config libfreetype-dev git"
50+
]
51+
}
52+
},
53+
"x86_64": {
54+
"ubuntu": {
55+
"cmds": [
56+
"sudo apt-get install -yq pkg-config libfreetype-dev git"
57+
]
58+
},
59+
"fedora": {
60+
"cmds": [
61+
"sudo dnf install -y pkg-config freetype-devel git"
62+
]
63+
}
64+
}
65+
},
66+
"post_cmds": [
67+
{
68+
"cwd": "${ENGINE_ROOT}",
69+
"cmds": [
70+
"gclient sync -R --jobs=${HARDWARE_THREADS}"
71+
]
72+
},
73+
{
74+
"cwd": "${ENGINE_SRC_DIR}",
75+
"cmds": [
76+
"git reset --hard",
77+
"git apply ${PATCH_FOLDER}/0001-clang-toolchain.patch",
78+
"git apply ${PATCH_FOLDER}/0002-fml-build-config-add-riscv.patch",
79+
"git apply ${PATCH_FOLDER}/0003-gn-riscv32-and-riscv64.patch",
80+
"git apply ${PATCH_FOLDER}/0004-Add-risc-v-32-64-support-to-native-assets.patch",
81+
"git apply ${PATCH_FOLDER}/0005-tonic-riscv-support.patch"
82+
]
83+
},
84+
{
85+
"cwd": "${ENGINE_SRC_DIR}/flutter/third_party/abseil-cpp",
86+
"cmds": [
87+
"git reset --hard",
88+
"git apply ${PATCH_FOLDER}/flutter/third_party/abseil-cpp/0001-flutter-third_party-abseil-cpp-clang-compiler-warnin.patch"
89+
]
90+
},
91+
{
92+
"cwd": "${ENGINE_SRC_DIR}/flutter/third_party/skia",
93+
"cmds": [
94+
"git reset --hard",
95+
"git apply ${PATCH_FOLDER}/flutter/third_party/skia/0001-flutter-third_party-skia-memcpy-void-cast.patch"
96+
]
97+
},
98+
{
99+
"cwd": "${ENGINE_SRC_DIR}/flutter/third_party/swiftshader",
100+
"cmds": [
101+
"git reset --hard",
102+
"git apply ${PATCH_FOLDER}/flutter/third_party/swiftshader/0001-flutter-third_party-swiftshader-pointer-cast-to-void.patch",
103+
"git apply ${PATCH_FOLDER}/flutter/third_party/swiftshader/0002-flutter-third_party-swiftshader-llvm-16.0-required-f.patch"
104+
]
105+
},
106+
{
107+
"cwd": "${ENGINE_SRC_DIR}",
108+
"cmds": [
109+
"./flutter/tools/gn ${ENGINE_BUILD_FLAGS}",
110+
"echo ${GN_ARGS_APPEND} >> ${GN_ARGS_FILE}",
111+
"${AUTONINJA} -C ${ENGINE_BUILD_DIR}"
112+
]
113+
},
114+
{
115+
"cwd": "${ENGINE_BUILD_DIR}",
116+
"cmds": [
117+
"rm -rf ${PLATFORM_ID_DIR}/bundle | true",
118+
"mkdir -p ${PLATFORM_ID_DIR}/bundle/data/",
119+
"mkdir -p ${PLATFORM_ID_DIR}/bundle/lib/",
120+
"cp ${ENGINE_BUILD_DIR}/icudtl.dat ${PLATFORM_ID_DIR}/bundle/data/",
121+
"cp ${ENGINE_BUILD_DIR}/libflutter_engine.so ${PLATFORM_ID_DIR}/bundle/lib/"
122+
]
123+
}
124+
],
125+
"do_clean": [
126+
{
127+
"cwd": "${ENGINE_BUILD_DIR}",
128+
"cmds": [
129+
"ninja -t clean"
130+
]
131+
}
132+
]
133+
}
113134
}

patches/flutter-engine-mono/0001-clang-toolchain.patch renamed to patches/flutter-engine-deprecated/0001-clang-toolchain.patch

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
From 5e4bf78183f9bf30d093b3e766f36a5780f068ab Mon Sep 17 00:00:00 2001
1+
From eb564c8be13a16158056890069deef5bad533529 Mon Sep 17 00:00:00 2001
22
From: Joel Winarske <joel.winarske@gmail.com>
3-
Date: Thu, 13 Feb 2025 12:44:11 -0800
3+
Date: Mon, 26 Aug 2024 12:25:58 -0700
44
Subject: [PATCH] clang toolchain
55

66
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
77
---
8-
engine/src/build/toolchain/custom/BUILD.gn | 8 ++++----
8+
build/toolchain/custom/BUILD.gn | 8 ++++----
99
1 file changed, 4 insertions(+), 4 deletions(-)
1010

11-
diff --git a/engine/src/build/toolchain/custom/BUILD.gn b/engine/src/build/toolchain/custom/BUILD.gn
12-
index 3da5f93026..05de4d7e3c 100644
13-
--- a/engine/src/build/toolchain/custom/BUILD.gn
14-
+++ b/engine/src/build/toolchain/custom/BUILD.gn
11+
diff --git a/build/toolchain/custom/BUILD.gn b/build/toolchain/custom/BUILD.gn
12+
index 3da5f93..05de4d7 100644
13+
--- a/build/toolchain/custom/BUILD.gn
14+
+++ b/build/toolchain/custom/BUILD.gn
1515
@@ -12,11 +12,11 @@ toolchain("custom") {
1616
# these values in our scope.
1717
cc = "${toolchain_bin}/clang"
@@ -29,5 +29,4 @@ index 3da5f93026..05de4d7e3c 100644
2929
target_triple_flags = "--target=${custom_target_triple}"
3030
sysroot_flags = "--sysroot ${custom_sysroot}"
3131
--
32-
2.43.5
33-
32+
2.43.5

patches/flutter-engine/0001-clang-toolchain.patch

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
From eb564c8be13a16158056890069deef5bad533529 Mon Sep 17 00:00:00 2001
1+
From 5e4bf78183f9bf30d093b3e766f36a5780f068ab Mon Sep 17 00:00:00 2001
22
From: Joel Winarske <joel.winarske@gmail.com>
3-
Date: Mon, 26 Aug 2024 12:25:58 -0700
3+
Date: Thu, 13 Feb 2025 12:44:11 -0800
44
Subject: [PATCH] clang toolchain
55

66
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
77
---
8-
build/toolchain/custom/BUILD.gn | 8 ++++----
8+
engine/src/build/toolchain/custom/BUILD.gn | 8 ++++----
99
1 file changed, 4 insertions(+), 4 deletions(-)
1010

11-
diff --git a/build/toolchain/custom/BUILD.gn b/build/toolchain/custom/BUILD.gn
12-
index 3da5f93..05de4d7 100644
13-
--- a/build/toolchain/custom/BUILD.gn
14-
+++ b/build/toolchain/custom/BUILD.gn
11+
diff --git a/engine/src/build/toolchain/custom/BUILD.gn b/engine/src/build/toolchain/custom/BUILD.gn
12+
index 3da5f93026..05de4d7e3c 100644
13+
--- a/engine/src/build/toolchain/custom/BUILD.gn
14+
+++ b/engine/src/build/toolchain/custom/BUILD.gn
1515
@@ -12,11 +12,11 @@ toolchain("custom") {
1616
# these values in our scope.
1717
cc = "${toolchain_bin}/clang"
@@ -29,4 +29,5 @@ index 3da5f93..05de4d7 100644
2929
target_triple_flags = "--target=${custom_target_triple}"
3030
sysroot_flags = "--sysroot ${custom_sysroot}"
3131
--
32-
2.43.5
32+
2.43.5
33+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 8b34fbdace418dcf338492ac63ce1048ecc20bf5 Mon Sep 17 00:00:00 2001
2+
From: Joel Winarske <joel.winarske@gmail.com>
3+
Date: Wed, 13 Mar 2024 21:28:43 +0000
4+
Subject: [PATCH] fml build config add riscv
5+
6+
Upstream-Status: Inappropriate
7+
8+
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
9+
---
10+
engine/src/flutter/fml/build_config.h | 10 ++++++++++
11+
1 file changed, 10 insertions(+)
12+
13+
diff --git a/engine/src/flutter/fml/build_config.h b/fml/build_config.h
14+
index d42a88e..9ee6e04 100644
15+
--- a/engine/src/flutter/fml/build_config.h
16+
+++ b/engine/src/flutter/fml/build_config.h
17+
@@ -93,6 +93,16 @@
18+
#define FML_ARCH_CPU_ARM64 1
19+
#define FML_ARCH_CPU_64_BITS 1
20+
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
21+
+#elif defined(__riscv)
22+
+#define FML_ARCH_CPU_RISC_FAMILY 1
23+
+#if (__riscv_xlen == 32)
24+
+#define FML_ARCH_CPU_RISCV32 1
25+
+#define FML_ARCH_CPU_32_BITS 1
26+
+#elif (__riscv_xlen == 64)
27+
+#define FML_ARCH_CPU_RISCV64 1
28+
+#define FML_ARCH_CPU_64_BITS 1
29+
+#endif
30+
+#define FML_ARCH_CPU_LITTLE_ENDIAN 1
31+
#elif defined(__pnacl__)
32+
#define FML_ARCH_CPU_32_BITS 1
33+
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
34+
--
35+
2.44.0
36+

0 commit comments

Comments
 (0)