From 7ccedeb4edcdb4d54378993d894385f5cd22844f Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Thu, 30 Nov 2023 19:31:44 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/dart.patch1 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/attachment/repos/dart.patch1 b/attachment/repos/dart.patch1 index 8ca8517164..7c90194787 100644 --- a/attachment/repos/dart.patch1 +++ b/attachment/repos/dart.patch1 @@ -102,15 +102,6 @@ index 36c7e9f4fb4..00a1cb64be8 100644 default_warning_flags += [ "-Wno-type-limits" ] } -diff --git a/build/config/gclient_args.gni b/build/config/gclient_args.gni -new file mode 100755 -index 00000000000..69d89776479 ---- /dev/null -+++ b/build/config/gclient_args.gni -@@ -0,0 +1,2 @@ -+# Generated from 'DEPS' -+checkout_llvm = false -\ No newline at end of file diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni index c7da74b09fe..8c11b3401dc 100644 --- a/build/config/sanitizers/sanitizers.gni -- Gitee From d48b9228b4888d7a5a26a37e63a093ab056ee7cb Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Thu, 30 Nov 2023 21:09:06 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E7=A7=BB=E9=99=A4gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/dart.patch1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/attachment/repos/dart.patch1 b/attachment/repos/dart.patch1 index 7c90194787..8ca8517164 100644 --- a/attachment/repos/dart.patch1 +++ b/attachment/repos/dart.patch1 @@ -102,6 +102,15 @@ index 36c7e9f4fb4..00a1cb64be8 100644 default_warning_flags += [ "-Wno-type-limits" ] } +diff --git a/build/config/gclient_args.gni b/build/config/gclient_args.gni +new file mode 100755 +index 00000000000..69d89776479 +--- /dev/null ++++ b/build/config/gclient_args.gni +@@ -0,0 +1,2 @@ ++# Generated from 'DEPS' ++checkout_llvm = false +\ No newline at end of file diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni index c7da74b09fe..8c11b3401dc 100644 --- a/build/config/sanitizers/sanitizers.gni -- Gitee From 32c9e34127e8bbe411c8cef4625b01a486f78e38 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Fri, 1 Dec 2023 12:07:17 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0readme;=E7=A7=BB?= =?UTF-8?q?=E9=99=A4ignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- README.md | 3 +++ attachment/repos/dart.patch1 | 31 +------------------------------ 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index e02286dfc4..06cb71c805 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,9 @@ Flutter Engine 6. 更新代码:在engine目录,执行`./update_engine.sh`(Linux/Mac平台)或`update_engine.bat`(Windows平台) +## FAQ +1. 运行项目工程报Member notfound:'isOhos'的错误:请确保src/third_party/dart目录下应用了所有的dart patch(补丁位于src/flutter/attachment/repos目录,可使用git apply应用patch);若有变动,重新编译engine + ## embedding层代码构建指导 1. 编辑shell/platform/ohos/flutter_embedding/local.properties: diff --git a/attachment/repos/dart.patch1 b/attachment/repos/dart.patch1 index 8ca8517164..c76a5933e7 100644 --- a/attachment/repos/dart.patch1 +++ b/attachment/repos/dart.patch1 @@ -1,25 +1,3 @@ -diff --git a/.gitignore b/.gitignore -index 3c7338f1ac8..dc54d947c56 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -76,7 +76,7 @@ packages - pubspec.lock - - # The top level package file (this is auto-generated per checkout). --/.dart_tool/package_config.json -+#/.dart_tool/package_config.json - - # Local pub storage - .pub -@@ -100,7 +100,7 @@ tools/xcodebuild - /outline.dill - /generated/ - /crash_logs/ --/build/config/gclient_args.gni -+#/build/config/gclient_args.gni - /pkg/front_end/testcases/old_dills/ - logs/logs.json - logs/results.json diff --git a/BUILD.gn b/BUILD.gn index a25f379b0ff..c413327b217 100644 --- a/BUILD.gn @@ -102,14 +80,7 @@ index 36c7e9f4fb4..00a1cb64be8 100644 default_warning_flags += [ "-Wno-type-limits" ] } -diff --git a/build/config/gclient_args.gni b/build/config/gclient_args.gni -new file mode 100755 -index 00000000000..69d89776479 ---- /dev/null -+++ b/build/config/gclient_args.gni -@@ -0,0 +1,2 @@ -+# Generated from 'DEPS' -+checkout_llvm = false + \ No newline at end of file diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni index c7da74b09fe..8c11b3401dc 100644 -- Gitee From d0696e716ee4984154229655c6964f007bc78bd7 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Fri, 1 Dec 2023 12:15:52 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06cb71c805..05d9473e1d 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Flutter Engine 6. 更新代码:在engine目录,执行`./update_engine.sh`(Linux/Mac平台)或`update_engine.bat`(Windows平台) ## FAQ -1. 运行项目工程报Member notfound:'isOhos'的错误:请确保src/third_party/dart目录下应用了所有的dart patch(补丁位于src/flutter/attachment/repos目录,可使用git apply应用patch);若有变动,重新编译engine +1. 运行项目工程报Member notfound:'isOhos'的错误:请确保src/third_party/dart目录下应用了所有的dart patch(补丁位于src/flutter/attachment/repos目录,可使用git apply应用patch)应用patch后重新编译engine ## embedding层代码构建指导 -- Gitee From 64de12f9bacf58f677df4a568aca8c0affc62c8a Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Sun, 3 Dec 2023 23:42:12 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmac=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/build4.bin | 48 ++++++++ attachment/repos/dart.patch2 | 48 ++++++++ attachment/repos/skia.patch | 193 ++++++++++++++++++++++++++++++++- attachment/scripts/config.json | 12 ++ 4 files changed, 296 insertions(+), 5 deletions(-) create mode 100644 attachment/repos/build4.bin create mode 100644 attachment/repos/dart.patch2 diff --git a/attachment/repos/build4.bin b/attachment/repos/build4.bin new file mode 100644 index 0000000000..e8de5d4566 --- /dev/null +++ b/attachment/repos/build4.bin @@ -0,0 +1,48 @@ +diff --cc build/config/BUILDCONFIG.gn +index bd3476a,ab4252a..0000000 +--- a/build/config/BUILDCONFIG.gn ++++ b/build/config/BUILDCONFIG.gn +@@@ -34,9 -34,9 +34,8 @@@ + # When writing build files, to do something only for the host: + # if (current_toolchain == host_toolchain) { ... + +-- + if (target_os == "") { +-- target_os = "ohos" +++ target_os = host_os + } + + if (target_cpu == "") { +@@@ -57,11 -57,8 +56,8 @@@ if (current_cpu == "") + if (current_os == "") { + if (host_os == "win") { + current_os = "win" +- } else if (host_os == "mac" && (target_os == "ohos" || target_os == "linux")) { +- current_os = "ohos" +-- } else { +- #current_os = target_os +- current_os = host_os +++ } else { ++ current_os = target_os + } + } + +diff --cc build/config/ohos/pkg_config.gni +index cb7a4b3,3708ffc..0000000 +--- a/build/config/ohos/pkg_config.gni ++++ b/build/config/ohos/pkg_config.gni +@@@ -127,7 -127,13 +127,5 @@@ template("pkg_config") + } + } + + -<<<<<<< Updated upstream +--#OHOS_NDK_ROOT = "//third_party/ohos_tools/ndk/linux/4.0/native" +--#OHOS_NDK_ROOT = "//third_party/ohos_tools/ndk/linux/4.0/native" + OHOS_NDK_ROOT = "//build/ohos/ohos-sysroot" + -OHOS_NDK_LIB = "$OHOS_NDK_ROOT/usr/aarch64-linux-ohos" + -======= + -OHOS_NDK_ROOT = "//build/ohos/ohos-sysroot" +--OHOS_NDK_LIB = "$OHOS_NDK_ROOT/usr/aarch64-linux-ohos" + - + ->>>>>>> Stashed changes +++OHOS_NDK_LIB = "$OHOS_NDK_ROOT/usr/aarch64-linux-ohos" diff --git a/attachment/repos/dart.patch2 b/attachment/repos/dart.patch2 new file mode 100644 index 0000000000..3e9d6b9815 --- /dev/null +++ b/attachment/repos/dart.patch2 @@ -0,0 +1,48 @@ +diff --cc runtime/BUILD.gn +index 7f89f9fcd06,57184dee228..00000000000 +--- a/runtime/BUILD.gn ++++ b/runtime/BUILD.gn +@@@ -104,7 -100,7 +100,6 @@@ config("dart_os_config") + defines += [ "DART_TARGET_OS_LINUX" ] + } else if (target_os == "ohos") { + defines += [ "DART_TARGET_OS_OHOS" ] +-- print("DART TARGET OS OHOS") + } else if (target_os == "mac") { + defines += [ "DART_TARGET_OS_MACOS" ] + } else if (target_os == "win") { +diff --cc runtime/bin/BUILD.gn +index 14548125acb,3ff723b7bbf..00000000000 +--- a/runtime/bin/BUILD.gn ++++ b/runtime/bin/BUILD.gn +@@@ -37,9 -38,6 +37,7 @@@ config("libdart_builtin_config") + is_linux = false + } + +- print("dart runtime is_linux:" ,is_linux) +- print("dart runtime is_win:" ,is_win) +- print("dart runtime is_ohos:" , is_ohos) +++ + if(is_ohos && !is_win){ + libs +=[ + "hilog_ndk.z" +diff --cc runtime/platform/globals.h +index f8a861e6c54,c19c00606a1..00000000000 +--- a/runtime/platform/globals.h ++++ b/runtime/platform/globals.h +@@@ -131,6 -122,15 +122,15 @@@ + // Windows, both 32- and 64-bit, regardless of the check for _WIN32. + #define DART_HOST_OS_WINDOWS 1 + + -#elif defined(DART_TARGET_OS_OHOS) && !defined(_WIN32) +++#elif defined(DART_TARGET_OS_OHOS) && !defiend(DART_TARGET_OS_LINUX) ++ ++ #define DART_HOST_OS_OHOS 1 ++ ++ #elif defined(__linux__) || defined(__FreeBSD__) ++ ++ // Generic Linux. ++ #define DART_HOST_OS_LINUX 1 ++ + #elif defined(__Fuchsia__) + #define DART_HOST_OS_FUCHSIA + diff --git a/attachment/repos/skia.patch b/attachment/repos/skia.patch index 1e6e940827..10f7e88610 100644 --- a/attachment/repos/skia.patch +++ b/attachment/repos/skia.patch @@ -1,8 +1,8 @@ diff --git a/BUILD.gn b/BUILD.gn -index ebbd898ec9..c829d7bb3f 100644 +index ebbd898ec9..660dde475a 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -26,7 +26,8 @@ import("gn/ios.gni") +@@ -26,16 +26,21 @@ import("gn/ios.gni") # Skia public API, generally provided by :skia. config("skia_public") { @@ -12,8 +12,11 @@ index ebbd898ec9..c829d7bb3f 100644 defines = [] cflags_objcc = [] -@@ -36,6 +37,10 @@ config("skia_public") { - if (is_fuchsia || is_linux) { + if (is_component_build) { + defines += [ "SKIA_DLL" ] + } +- if (is_fuchsia || is_linux) { ++ if (is_fuchsia || is_linux || is_ohos) { defines += [ "SK_R32_SHIFT=16" ] } + @@ -77,6 +80,33 @@ index ebbd898ec9..c829d7bb3f 100644 optional("fontmgr_custom") { enabled = skia_enable_fontmgr_custom_directory || +@@ -690,7 +733,7 @@ if (skia_compile_modules) { + sources += [ "tools/SkGetExecutablePath_win.cpp" ] + } else if (is_mac || is_ios) { + sources += [ "tools/SkGetExecutablePath_mac.cpp" ] +- } else if (is_linux || is_android) { ++ } else if (is_linux || is_android || is_ohos) { + sources += [ "tools/SkGetExecutablePath_linux.cpp" ] + } + if (is_win) { +@@ -818,7 +861,7 @@ if (skia_compile_sksl_tests) { + sources += [ "tools/SkGetExecutablePath_win.cpp" ] + } else if (is_mac || is_ios) { + sources += [ "tools/SkGetExecutablePath_mac.cpp" ] +- } else if (is_linux || is_android) { ++ } else if (is_linux || is_android || is_ohos) { + sources += [ "tools/SkGetExecutablePath_linux.cpp" ] + } + if (is_win) { +@@ -1077,7 +1120,7 @@ optional("gpu") { + libs += [ "EGL" ] + } else if (skia_use_webgl) { + sources += [ "src/gpu/ganesh/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ] +- } else if (is_linux && skia_use_x11) { ++ } else if ((is_linux || is_ohos) && skia_use_x11) { + sources += [ + "src/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.cpp", + "src/gpu/ganesh/gl/glx/GrGLMakeNativeInterface_glx.cpp", @@ -1092,8 +1135,16 @@ optional("gpu") { if (target_cpu != "arm64") { libs += [ "OpenGL32.lib" ] @@ -104,8 +134,101 @@ index ebbd898ec9..c829d7bb3f 100644 ":fontmgr_win_gdi", ":gpu", ":graphite", +@@ -1559,7 +1611,7 @@ skia_component("skia") { + ] + } + +- if (is_linux || is_wasm) { ++ if (is_linux || is_wasm || is_ohos) { + sources += [ "src/ports/SkDebug_stdio.cpp" ] + if (skia_use_egl) { + libs += [ "GLESv2" ] +@@ -1962,7 +2014,7 @@ if (skia_enable_tools) { + if (is_android || skia_use_egl) { + sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] + libs += [ "EGL" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] + libs += [ + "GLU", +@@ -2281,7 +2333,7 @@ if (skia_enable_tools) { + ] + } + +- if (is_linux || is_mac || skia_enable_optimize_size) { ++ if (is_linux || is_mac || skia_enable_optimize_size || is_ohos) { + if (skia_enable_skottie) { + test_app("skottie_tool") { + deps = [ "modules/skottie:tool" ] +@@ -2777,7 +2829,7 @@ if (skia_enable_tools) { + "tools/sk_app/android/surface_glue_android.h", + ] + libs += [ "android" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ + "tools/SkGetExecutablePath_linux.cpp", + "tools/sk_app/unix/RasterWindowContext_unix.cpp", +@@ -2830,7 +2882,7 @@ if (skia_enable_tools) { + sources += [ "tools/sk_app/GLWindowContext.h" ] + if (is_android) { + sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ] + } else if (is_win) { + sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ] +@@ -2855,7 +2907,7 @@ if (skia_enable_tools) { + sources += [ "tools/sk_app/VulkanWindowContext.h" ] + if (is_android) { + sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ] + libs += [ "X11-xcb" ] + } else if (is_win) { +@@ -2887,7 +2939,7 @@ if (skia_enable_tools) { + if (skia_use_dawn) { + sources += [ "tools/sk_app/DawnWindowContext.cpp" ] + sources += [ "tools/sk_app/DawnWindowContext.h" ] +- if (is_linux) { ++ if (is_linux || is_ohos) { + if (dawn_enable_vulkan) { + sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ] + defines = [ "VK_USE_PLATFORM_XCB_KHR" ] +@@ -2931,7 +2983,7 @@ if (skia_enable_tools) { + } + } + +- if (!skia_use_vulkan && (is_mac || is_linux || is_win)) { ++ if (!skia_use_vulkan && (is_mac || is_linux || is_win || is_ohos)) { + test_app("fiddle_examples") { + sources = [ + "tools/fiddle/all_examples.cpp", +@@ -3088,7 +3140,7 @@ if (skia_enable_tools) { + } + } + +- if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) { ++ if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac || is_ohos)) { + test_app("HelloWorld") { + sources = [ "example/HelloWorld.cpp" ] + libs = [] +diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn +index 44f39c5aaa..c4eac1eb66 100644 +--- a/gn/BUILDCONFIG.gn ++++ b/gn/BUILDCONFIG.gn +@@ -63,6 +63,7 @@ is_linux = current_os == "linux" + is_mac = current_os == "mac" + is_wasm = current_os == "wasm" + is_win = current_os == "win" ++is_ohos = current_os == "ohos" + + # This is just to make the Dawn build files happy. Skia itself uses target_os = "linux" + # for ChromeOS, so this variable will not affect Skia proper. diff --git a/gn/skia.gni b/gn/skia.gni -index b81c0dae54..af04cdacdf 100644 +index b81c0dae54..deb6451271 100644 --- a/gn/skia.gni +++ b/gn/skia.gni @@ -20,6 +20,7 @@ declare_args() { @@ -116,6 +239,35 @@ index b81c0dae54..af04cdacdf 100644 skia_enable_gpu = true skia_enable_optimize_size = false skia_enable_pdf = !is_wasm +@@ -46,9 +47,9 @@ declare_args() { + skia_use_expat = !is_wasm + skia_use_ffmpeg = false + skia_use_fixed_gamma_text = is_android +- skia_use_fontconfig = is_linux ++ skia_use_fontconfig = is_linux || is_ohos + skia_use_fonthost_mac = is_mac || is_ios +- skia_use_freetype = is_android || is_fuchsia || is_linux || is_wasm ++ skia_use_freetype = is_android || is_fuchsia || is_linux || is_wasm || is_ohos + skia_use_harfbuzz = true + skia_use_gl = !is_fuchsia + skia_use_icu = !is_fuchsia +@@ -64,14 +65,14 @@ declare_args() { + skia_use_lua = is_skia_dev_build && !is_ios + skia_use_metal = false + skia_use_ndk_images = is_android && defined(ndk_api) && ndk_api >= 30 +- skia_use_perfetto = is_linux || is_mac || is_android ++ skia_use_perfetto = is_linux || is_mac || is_android || is_ohos + skia_use_piet = false + skia_use_piex = !is_win && !is_wasm + skia_use_sfml = false + skia_use_webgl = is_wasm + skia_use_webgpu = is_wasm + skia_use_wuffs = true +- skia_use_x11 = is_linux ++ skia_use_x11 = is_linux || is_ohos + skia_use_xps = true + skia_enable_graphite = false + skia_use_zlib = true @@ -119,6 +120,8 @@ declare_args() { } @@ -136,6 +288,37 @@ index b81c0dae54..af04cdacdf 100644 skia_fontmgr_factory = ":fontmgr_empty_factory" } else if (is_android && skia_enable_fontmgr_android) { skia_fontmgr_factory = ":fontmgr_android_factory" +diff --git a/gn/skia/BUILD.gn b/gn/skia/BUILD.gn +index b43526fe1f..fb34289da7 100644 +--- a/gn/skia/BUILD.gn ++++ b/gn/skia/BUILD.gn +@@ -235,7 +235,7 @@ config("default") { + } + } + +- if (is_linux) { ++ if (is_linux || is_ohos) { + libs += [ "pthread" ] + } + +@@ -333,7 +333,7 @@ config("default") { + ldflags += [ "-fsanitize=$sanitizers" ] + } + +- if (is_linux) { ++ if (is_linux || is_ohos) { + cflags_cc += [ "-stdlib=libc++" ] + ldflags += [ "-stdlib=libc++" ] + } +@@ -685,7 +685,7 @@ config("executable") { + ] + } else if (is_mac) { + ldflags = [ "-Wl,-rpath,@loader_path/." ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + ldflags = [ + "-rdynamic", + "-Wl,-rpath,\$ORIGIN", diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index ab23b24edd..c5f714712b 100644 --- a/src/core/SkCanvas.cpp diff --git a/attachment/scripts/config.json b/attachment/scripts/config.json index 9104bbda1c..848c8b0c86 100644 --- a/attachment/scripts/config.json +++ b/attachment/scripts/config.json @@ -16,6 +16,12 @@ "type": "patch", "file_path": "../../flutter/attachment/repos/dart.patch1" }, + { + "name": "dart2", + "target": "./src/third_party/dart", + "type": "patch", + "file_path": "../../flutter/attachment/repos/dart.patch2" + }, { "name": "skia", "target": "./src/third_party/skia", @@ -63,5 +69,11 @@ "target": "./src/build", "type": "patch", "file_path": "../flutter/attachment/repos/build3.bin" + }, + { + "name": "build4", + "target": "./src/build", + "type": "patch", + "file_path": "../flutter/attachment/repos/build4.bin" } ] -- Gitee From 8615de05fcc3ab1d1218b08e412dc5d7d7a4cdca Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Mon, 4 Dec 2023 10:35:50 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E6=AD=A3patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/build4.bin | 100 ++++++++++++++++++--------------- attachment/repos/dart.patch2 | 90 +++++++++++++++-------------- attachment/repos/zlib.patch | 13 +++++ attachment/scripts/config.json | 7 +++ 4 files changed, 122 insertions(+), 88 deletions(-) create mode 100644 attachment/repos/zlib.patch diff --git a/attachment/repos/build4.bin b/attachment/repos/build4.bin index e8de5d4566..6094a9a9cc 100644 --- a/attachment/repos/build4.bin +++ b/attachment/repos/build4.bin @@ -1,48 +1,56 @@ -diff --cc build/config/BUILDCONFIG.gn -index bd3476a,ab4252a..0000000 +diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn +index bd3476a..f1c88b9 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn -@@@ -34,9 -34,9 +34,8 @@@ - # When writing build files, to do something only for the host: - # if (current_toolchain == host_toolchain) { ... - --- - if (target_os == "") { --- target_os = "ohos" -++ target_os = host_os - } - - if (target_cpu == "") { -@@@ -57,11 -57,8 +56,8 @@@ if (current_cpu == "") - if (current_os == "") { - if (host_os == "win") { - current_os = "win" -- } else if (host_os == "mac" && (target_os == "ohos" || target_os == "linux")) { -- current_os = "ohos" --- } else { -- #current_os = target_os -- current_os = host_os -++ } else { -+ current_os = target_os - } - } - -diff --cc build/config/ohos/pkg_config.gni -index cb7a4b3,3708ffc..0000000 ---- a/build/config/ohos/pkg_config.gni -+++ b/build/config/ohos/pkg_config.gni -@@@ -127,7 -127,13 +127,5 @@@ template("pkg_config") - } - } - - -<<<<<<< Updated upstream ---#OHOS_NDK_ROOT = "//third_party/ohos_tools/ndk/linux/4.0/native" ---#OHOS_NDK_ROOT = "//third_party/ohos_tools/ndk/linux/4.0/native" - OHOS_NDK_ROOT = "//build/ohos/ohos-sysroot" - -OHOS_NDK_LIB = "$OHOS_NDK_ROOT/usr/aarch64-linux-ohos" - -======= - -OHOS_NDK_ROOT = "//build/ohos/ohos-sysroot" ---OHOS_NDK_LIB = "$OHOS_NDK_ROOT/usr/aarch64-linux-ohos" - - - ->>>>>>> Stashed changes -++OHOS_NDK_LIB = "$OHOS_NDK_ROOT/usr/aarch64-linux-ohos" +@@ -36,7 +36,7 @@ + + + if (target_os == "") { +- target_os = "ohos" ++ target_os = host_os + } + + if (target_cpu == "") { +@@ -57,11 +57,8 @@ if (current_cpu == "") { + if (current_os == "") { + if (host_os == "win") { + current_os = "win" +- } else if (host_os == "mac" && (target_os == "ohos" || target_os == "linux")) { +- current_os = "ohos" + } else { +- #current_os = target_os +- current_os = host_os ++ current_os = target_os + } + } + +@@ -261,27 +258,13 @@ if (current_os == "win") { + is_posix = true + is_win = false + is_wasm = false +-} else if (current_os == "linux" && target_os == "ohos") { +- target_os="linux" ++} else if (current_os == "ohos") { + is_android = false + is_chromeos = false + is_fuchsia = false + is_fuchsia_host = false + is_ios = false +- is_linux = true +- is_ohos = true +- is_mac = false +- is_posix = true +- is_win = false +- is_wasm = false +-} else if ((current_os == "ohos" || current_os == "linux") && host_os == "mac") { +- target_os="linux" +- is_android = false +- is_chromeos = false +- is_fuchsia = false +- is_fuchsia_host = false +- is_ios = false +- is_linux = true ++ is_linux = false + is_ohos = true + is_mac = false + is_posix = true diff --git a/attachment/repos/dart.patch2 b/attachment/repos/dart.patch2 index 3e9d6b9815..2ac542f697 100644 --- a/attachment/repos/dart.patch2 +++ b/attachment/repos/dart.patch2 @@ -1,48 +1,54 @@ -diff --cc runtime/BUILD.gn -index 7f89f9fcd06,57184dee228..00000000000 +diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn +index 7f89f9fcd06..cd5494e7b33 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn -@@@ -104,7 -100,7 +100,6 @@@ config("dart_os_config") - defines += [ "DART_TARGET_OS_LINUX" ] - } else if (target_os == "ohos") { - defines += [ "DART_TARGET_OS_OHOS" ] --- print("DART TARGET OS OHOS") - } else if (target_os == "mac") { - defines += [ "DART_TARGET_OS_MACOS" ] - } else if (target_os == "win") { -diff --cc runtime/bin/BUILD.gn -index 14548125acb,3ff723b7bbf..00000000000 +@@ -87,11 +87,6 @@ config("dart_precompiler_config") { + + config("dart_os_config") { + defines = [] +- if (target_os == "linux" && !is_mac) { +- target_os = "ohos" +- } else if (is_mac){ +- target_os = "mac" +- } + print("DART TARGET OS: "+target_os ) + if (target_os == "android") { + defines += [ "DART_TARGET_OS_ANDROID" ] +@@ -104,7 +99,9 @@ config("dart_os_config") { + defines += [ "DART_TARGET_OS_LINUX" ] + } else if (target_os == "ohos") { + defines += [ "DART_TARGET_OS_OHOS" ] +- print("DART TARGET OS OHOS") ++ if (is_ohos) { ++ defines += [ "DART_RUNTIME_OS_OHOS" ] ++ } + } else if (target_os == "mac") { + defines += [ "DART_TARGET_OS_MACOS" ] + } else if (target_os == "win") { +diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn +index 14548125acb..2b758ae2db9 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn -@@@ -37,9 -38,6 +37,7 @@@ config("libdart_builtin_config") - is_linux = false - } - -- print("dart runtime is_linux:" ,is_linux) -- print("dart runtime is_win:" ,is_win) -- print("dart runtime is_ohos:" , is_ohos) -++ - if(is_ohos && !is_win){ - libs +=[ - "hilog_ndk.z" -diff --cc runtime/platform/globals.h -index f8a861e6c54,c19c00606a1..00000000000 +@@ -37,9 +37,6 @@ config("libdart_builtin_config") { + is_linux = false + } + +- print("dart runtime is_linux:" ,is_linux) +- print("dart runtime is_win:" ,is_win) +- print("dart runtime is_ohos:" , is_ohos) + if(is_ohos && !is_win){ + libs +=[ + "hilog_ndk.z" +diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h +index f8a861e6c54..ca859e2b421 100644 --- a/runtime/platform/globals.h +++ b/runtime/platform/globals.h -@@@ -131,6 -122,15 +122,15 @@@ - // Windows, both 32- and 64-bit, regardless of the check for _WIN32. - #define DART_HOST_OS_WINDOWS 1 - - -#elif defined(DART_TARGET_OS_OHOS) && !defined(_WIN32) -++#elif defined(DART_TARGET_OS_OHOS) && !defiend(DART_TARGET_OS_LINUX) -+ -+ #define DART_HOST_OS_OHOS 1 -+ -+ #elif defined(__linux__) || defined(__FreeBSD__) -+ -+ // Generic Linux. -+ #define DART_HOST_OS_LINUX 1 -+ - #elif defined(__Fuchsia__) - #define DART_HOST_OS_FUCHSIA - +@@ -108,7 +108,7 @@ + // Check for Android first, to determine its difference from Linux. + #define DART_HOST_OS_ANDROID 1 + +-#elif defined(DART_TARGET_OS_OHOS) && !defined(_WIN32) ++#elif defined(DART_TARGET_OS_OHOS) && defined(DART_RUNTIME_OS_OHOS) + + #define DART_HOST_OS_OHOS 1 + diff --git a/attachment/repos/zlib.patch b/attachment/repos/zlib.patch new file mode 100644 index 0000000000..a7354c878f --- /dev/null +++ b/attachment/repos/zlib.patch @@ -0,0 +1,13 @@ +diff --git a/BUILD.gn b/BUILD.gn +index 3a71693..dfd052c 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -119,7 +119,7 @@ if (use_arm_neon_optimizations) { + defines = [ "CRC32_ARMV8_CRC32" ] + if (is_android) { + defines += [ "ARMV8_OS_ANDROID" ] +- } else if (is_linux || is_chromeos) { ++ } else if (is_linux || is_chromeos || is_ohos) { + defines += [ "ARMV8_OS_LINUX" ] + } else if (is_mac) { + defines += [ "ARMV8_OS_MACOS" ] diff --git a/attachment/scripts/config.json b/attachment/scripts/config.json index 848c8b0c86..1c8f929ef7 100644 --- a/attachment/scripts/config.json +++ b/attachment/scripts/config.json @@ -76,4 +76,11 @@ "type": "patch", "file_path": "../flutter/attachment/repos/build4.bin" } + , + { + "name": "zlib", + "target": "./src/third_party/zlib", + "type": "patch", + "file_path": "../flutter/attachment/repos/zlib.patch" + } ] -- Gitee From a1c4bddb0bce8b7413272206536c796ee9c1cf49 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Mon, 4 Dec 2023 11:58:11 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/bootstrap/update_engine.bat | 2 +- attachment/repos/bootstrap/update_engine.sh | 4 ++-- attachment/scripts/config.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/attachment/repos/bootstrap/update_engine.bat b/attachment/repos/bootstrap/update_engine.bat index de3d208a60..1db3138353 100644 --- a/attachment/repos/bootstrap/update_engine.bat +++ b/attachment/repos/bootstrap/update_engine.bat @@ -14,4 +14,4 @@ @echo off py -3 .\src\flutter\attachment\scripts\ohos_reverse_patch.py %1 call git -C .\src\flutter checkout master && git -C .\src\flutter pull origin master -py -3 .\src\flutter\attachment\scripts\ohos_setup.py %1 \ No newline at end of file +gclient sync \ No newline at end of file diff --git a/attachment/repos/bootstrap/update_engine.sh b/attachment/repos/bootstrap/update_engine.sh index be214136b7..557e507972 100644 --- a/attachment/repos/bootstrap/update_engine.sh +++ b/attachment/repos/bootstrap/update_engine.sh @@ -12,6 +12,6 @@ # limitations under the License. #! /bin/bash -python3 ./src/flutter/attachment/scripts/ohos_reverse_patch.py $1 +python3 ./src/flutter/attachment/scripts/ohos_reverse_patch.py $1 $2 git -C ./src/flutter checkout master && git -C ./src/flutter pull origin master -python3 ./src/flutter/attachment/scripts/ohos_setup.py $1 +gclient sync \ No newline at end of file diff --git a/attachment/scripts/config.json b/attachment/scripts/config.json index 1c8f929ef7..4f1847f58d 100644 --- a/attachment/scripts/config.json +++ b/attachment/scripts/config.json @@ -81,6 +81,6 @@ "name": "zlib", "target": "./src/third_party/zlib", "type": "patch", - "file_path": "../flutter/attachment/repos/zlib.patch" + "file_path": "../../flutter/attachment/repos/zlib.patch" } ] -- Gitee From cf59ba768ffa0bcad465c33ba152501c468dc8a3 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Mon, 4 Dec 2023 12:11:42 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/bootstrap/update_engine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachment/repos/bootstrap/update_engine.sh b/attachment/repos/bootstrap/update_engine.sh index 557e507972..fca1267491 100644 --- a/attachment/repos/bootstrap/update_engine.sh +++ b/attachment/repos/bootstrap/update_engine.sh @@ -12,6 +12,6 @@ # limitations under the License. #! /bin/bash -python3 ./src/flutter/attachment/scripts/ohos_reverse_patch.py $1 $2 +python3 ./src/flutter/attachment/scripts/ohos_reverse_patch.py $1 git -C ./src/flutter checkout master && git -C ./src/flutter pull origin master gclient sync \ No newline at end of file -- Gitee From 8586632877591c51329ffe2829c0c50e64290ef4 Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Mon, 4 Dec 2023 14:37:01 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E4=BF=AE=E6=AD=A3win=E4=B8=8Brelease?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- attachment/repos/bootstrap/ohos.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachment/repos/bootstrap/ohos.bat b/attachment/repos/bootstrap/ohos.bat index 11f503836a..45d771d6ec 100644 --- a/attachment/repos/bootstrap/ohos.bat +++ b/attachment/repos/bootstrap/ohos.bat @@ -15,7 +15,7 @@ setlocal EnableDelayedExpansion call python .\src\flutter\tools\gn --unoptimized --runtime-mode=debug --ohos --ohos-cpu=arm64 -call python .\src\flutter\tools\gn --runtime-mode=release --ohos --unoptimized --ohos-cpu=arm64 +call python .\src\flutter\tools\gn --runtime-mode=release --ohos --ohos-cpu=arm64 ninja -C .\src\out\ohos_debug_unopt_arm64 ninja -C .\src\out\ohos_release_arm64 -- Gitee From e31f6cca7fa0470752099b4651196791bc1efadd Mon Sep 17 00:00:00 2001 From: zmf <279822581@qq.com> Date: Mon, 4 Dec 2023 21:58:34 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF=E6=A0=BC=E5=BC=8F=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zmf <279822581@qq.com> --- OAT.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OAT.xml b/OAT.xml index 472375df83..eaadc3d1be 100644 --- a/OAT.xml +++ b/OAT.xml @@ -95,8 +95,12 @@ used to filter file path. + + + + -- Gitee