diff --git a/recipes-openharmony/prebuilts/oniro-openharmony-bundle.bb b/recipes-openharmony/prebuilts/oniro-openharmony-bundle.bb index 6f4397f9634fd71092e79a97a692c36a1507eb90..7c02da7809e562860873aa2e9431a57a6b5be799 100644 --- a/recipes-openharmony/prebuilts/oniro-openharmony-bundle.bb +++ b/recipes-openharmony/prebuilts/oniro-openharmony-bundle.bb @@ -11,6 +11,10 @@ require oniro-openharmony-toolchain.bb TOOLCHAIN_HOST_TASK += "nativesdk-oniro-openharmony-thirdparty-integration" +# OpenSSL for target DEPENDS += "openssl" RDEPENDS:${PN} = "libcrypto libssl openssl-conf openssl-engines openssl-staticdev" TOOLCHAIN_TARGET_TASK += "openssl-dev" + +# OpenSSL for build host +TOOLCHAIN_HOST_TASK += "nativesdk-openssl-dev" diff --git a/recipes-openharmony/prebuilts/oniro-openharmony-thirdparty-integration-3.1.inc b/recipes-openharmony/prebuilts/oniro-openharmony-thirdparty-integration-3.1.inc new file mode 100644 index 0000000000000000000000000000000000000000..318923ff269233ab5e671159c7d68d51f451c952 --- /dev/null +++ b/recipes-openharmony/prebuilts/oniro-openharmony-thirdparty-integration-3.1.inc @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +SRC_URI += "file://patches/base_user_iam_pin_auth.patch;apply=no;subdir=src" diff --git a/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc b/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc new file mode 100644 index 0000000000000000000000000000000000000000..8f3e07603f80107b1aed1a67b7b87daa0c2ef838 --- /dev/null +++ b/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +SRC_URI += "file://patches/ace_napi.patch;apply=no;subdir=src" +SRC_URI += "file://patches/base_notification_ans_standard.patch;apply=no;subdir=src" +SRC_URI += "file://patches/base_update_updater.patch;apply=no;subdir=src" +SRC_URI += "file://patches/base_usb_usb_manager.patch;apply=no;subdir=src" +SRC_URI += "file://patches/build_lite.patch;apply=no;subdir=src" +SRC_URI += "file://patches/developtools_hdc_standard.patch;apply=no;subdir=src" +SRC_URI += "file://patches/developtools_hiperf.patch;apply=no;subdir=src" +SRC_URI += "file://patches/foundation_aafwk_standard.patch;apply=no;subdir=src" +SRC_URI += "file://patches/foundation_appexecfwk_standard.patch;apply=no;subdir=src" +SRC_URI += "file://patches/foundation_graphic_standard.patch;apply=no;subdir=src" +SRC_URI += "file://patches/productdefine_common.patch;apply=no;subdir=src" +SRC_URI += "file://patches/third_party_libevdev.patch;apply=no;subdir=src" +SRC_URI += "file://patches/third_party_libusb.patch;apply=no;subdir=src" diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/BUILD.gn b/recipes-openharmony/prebuilts/openharmony-3.1/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cb9b362f270a7a91a3f55b6ef624bb974708da89 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/BUILD.gn @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import("third_party.gni") + +group("third_party") { + if (install_oniro_third_party) { + deps = [ + "//third_party/openssl:libcrypto", + "//third_party/openssl:libssl", + ] + } +} + +import("//build/toolchain/gcc_toolchain.gni") + +# While it would be nice to call this toolchain "host_toolchain", we are calling +# it "clang_x64" to avoid additional patching, as the toolchain label name is +# used for various hard-coded paths all over the code. +gcc_toolchain("clang_x64") { + toolchain_args = { + current_cpu = "x64" + current_os = "linux" + is_clang = false + } + + cc = "gcc -Uunix" + cxx = "g++ -Uunix" + ar = "ar" + ld = cxx # GN expects a compiler, not a linker. + nm = "nm" + readelf = "readelf" + + extra_cppflags = "-Wno-pedantic" + extra_cppflags += " -Wno-error=unused-but-set-variable" + extra_cppflags += " -Wno-error=format-truncation" + extra_cppflags += " -Wno-error=stringop-overflow" + extra_cppflags += " -Wno-error=stringop-truncation" + extra_cppflags += " -Wno-error=unused-result" + extra_cppflags += " -Wno-error=int-in-bool-context" + extra_cppflags += " -Wno-error=sign-compare" + extra_cxxflags = "-Wno-error=shadow" + extra_cxxflags += " -Wno-error=implicit-function-declaration" +} diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/BUILD_host.gn b/recipes-openharmony/prebuilts/openharmony-3.1/BUILD_host.gn new file mode 100644 index 0000000000000000000000000000000000000000..092d49e1f6bb271722c5a60826c2e13725d217e0 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/BUILD_host.gn @@ -0,0 +1,60 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# +# This file contains GN toolchain definition for SDK/host clang toolchain +# +# It uses a simple template format, where variables are substituted by +# bitbake during SDK build. Variables to be substituted must be +# written as @VARIABLE@, and the recipe must be extended for each +# variable to be substituted. + +import("//build/toolchain/gcc_toolchain.gni") +import("//oniro/toolchain.gni") + +# While it would be nice to call this toolchain "host_toolchain", we are calling +# it "clang_x64" to avoid additional patching, as the toolchain label name is +# used for various hard-coded paths all over the code. +gcc_toolchain("clang_x64") { + toolchain_args = { + current_cpu = "@SDK_GN_CPU@" + current_os = "linux" + is_clang = true + } + + target_triplet = "@SDK_SYS@" + toolchain_prefix = rebase_path("//oniro/sysroots/host@bindir_nativesdk@/", root_build_dir) + # Absolute path to sysroot + sysroot = rebase_path("//oniro/sysroots/host") + cc_args = " -target $target_triplet" + # Use relative path for --sysroot as it is normally shorter + cc_args += " --sysroot=" + rebase_path("//oniro/sysroots/host", root_build_dir) + # Build executables to use the dynamic linker from the SDK + ld_args = " -Wl,--dynamic-linker,$sysroot@base_libdir_nativesdk@/@SDK_DYNAMIC_LINKER@" + # Set RPATH so executables use libraries from the SDK + ld_args += " -Wl,-rpath=$sysroot@base_libdir_nativesdk@ -Wl,-rpath=$sysroot@libdir_nativesdk@" + + # Workaround for incomplete bitbake native sysroot + #cc_args += "-I/usr/include" + #ld_args += "-L/lib -L/usr/lib" + + cc = toolchain_prefix + "clang " + cc_args + cxx = toolchain_prefix + "clang++ " + cc_args + ar = toolchain_prefix + "llvm-ar" + ld = cxx + ld_args # GN expects a compiler, not a linker + nm = toolchain_prefix + "llvm-nm" + readelf = toolchain_prefix + "readelf" + strip = toolchain_prefix + "llvm-strip" + + # Make some warnings that was promoted to errors back into + # warnings. Current OpenHarmony codebase was written for older + # clang, which did not have these warnings. + # As OpenHarmony code is improved to work with newer clang, revisit + # all of these and remove them ASAP. + extra_cppflags = " -Wno-error=deprecated-declarations" + extra_cppflags += " -Wno-error=thread-safety-analysis" + extra_cppflags += " -Wno-error=unused-but-set-variable" + extra_cppflags += " -Wno-error=null-pointer-subtraction" + extra_cppflags += " -Wno-error=void-pointer-to-int-cast" +} diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/BUILD_target.gn b/recipes-openharmony/prebuilts/openharmony-3.1/BUILD_target.gn new file mode 100644 index 0000000000000000000000000000000000000000..561625afc57e08163dd44eb276677c0e416b5d1d --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/BUILD_target.gn @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# +# This file contains GN toolchain definition for SDK/host clang toolchain +# +# It uses a simple template format, where variables are substituted by +# bitbake during SDK build. Variables to be substituted must be +# written as @VARIABLE@, and the recipe must be extended for each +# variable to be substituted. + +import("//build/toolchain/gcc_toolchain.gni") +import("//oniro/toolchain.gni") + +gcc_toolchain("target_clang") { + toolchain_args = { + current_cpu = "@TARGET_GN_CPU@" + current_os = "ohos" + is_clang = true + } + + target_triplet = "@TARGET_SYS@" + toolchain_prefix = rebase_path("//oniro/sysroots/host@bindir@/", root_build_dir) + target_triplet + "/" + target_triplet + "-" + cc_args = " -target $target_triplet" + cc_args += " @TUNE_CCARGS@" + # Use relative path for --sysroot as it is normally shorter + cc_args += " --sysroot=" + rebase_path("//oniro/sysroots/host", root_build_dir) + + cc = toolchain_prefix + "clang " + cc_args + cxx = toolchain_prefix + "clang++ " + cc_args + ar = toolchain_prefix + "llvm-ar" + ld = cxx # GN expects a compiler, not a linker + nm = toolchain_prefix + "llvm-nm" + readelf = toolchain_prefix + "readelf" + strip = toolchain_prefix + "llvm-strip" + + # Output linker map files for binary size analysis. + enable_linker_map = true + + use_unstripped_as_runtime_outputs = ohos_unstripped_runtime_outputs + + # Don't use .cr.so for loadable_modules since they are always loaded via + # absolute path. + loadable_module_extension = ".so" + + # Make some warnings that was promoted to errors back into + # warnings. Current OpenHarmony codebase was written for older + # clang, which did not have these warnings. + # As OpenHarmony code is improved to work with newer clang, revisit + # all of these and remove them ASAP. + extra_cppflags = " -Wno-implicit-fallthrough" + extra_cppflags += " -Wno-error=bitwise-instead-of-logical" + extra_cppflags += " -Wno-error=deprecated-pragma" + extra_cppflags += " -Wno-error=free-nonheap-object" + extra_cppflags += " -Wno-error=gnu-folding-constant" + extra_cppflags += " -Wno-error=non-c-typedef-for-linkage" + extra_cppflags += " -Wno-error=null-pointer-subtraction" + extra_cppflags += " -Wno-error=pedantic" + extra_cppflags += " -Wno-error=pointer-to-int-cast" + extra_cppflags += " -Wno-error=null-conversion" + extra_cppflags += " -Wno-error=reserved-identifier" + extra_cppflags += " -Wno-error=string-concatenation" + extra_cppflags += " -Wno-error=suggest-destructor-override" + extra_cppflags += " -Wno-error=suggest-override" + extra_cppflags += " -Wno-error=tautological-value-range-compare" + extra_cppflags += " -Wno-error=thread-safety-analysis" + extra_cppflags += " -Wno-error=unused-but-set-parameter" + extra_cppflags += " -Wno-error=unused-but-set-variable" + extra_cppflags += " -Wno-error=shadow" + + # Using OpenSSL 3.0 with OpenSSL 1.1.1 API causes a lot of + # deprecation warnings, which we therefore does not want to error + # out on. Either downgrade to latest 1.1.1 LTS version, or upgrade + # the OpenHarmony code to use OpenSSL 3.0 API to be able to get rid + # of this. + extra_cppflags += " -Wno-error=deprecated-declarations" + extra_cppflags += " -Wno-error=incompatible-pointer-types-discards-qualifiers" +} diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/ace_ace_engine.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ace_ace_engine.patch new file mode 100644 index 0000000000000000000000000000000000000000..25a52266b31b016bc950a3c3447f129238b94e6a --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ace_ace_engine.patch @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //foundation/ace/ace_engine git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-toolchain being installed into +//oniro, configuring the codebase to use the toolchain in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/foundation/ace/ace_engine/ace_config.gni b/foundation/ace/ace_engine/ace_config.gni +index fb5324f1635e..cbf2ded3fa4c 100644 +--- a/foundation/ace/ace_engine/ace_config.gni ++++ b/foundation/ace/ace_engine/ace_config.gni +@@ -70,6 +70,9 @@ objcopy_clang = "$clang_base_path/bin/llvm-objcopy" + + if (is_standard_system) { + objcopy_default = "//prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-objcopy" ++ if (is_oniro_toolchain) { ++ objcopy_default = "//oniro/sysroots/host/usr/bin/llvm-objcopy" ++ } + node_js_path = + "//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/" + } else if (is_cross_platform_build && defined(aosp_objcopy)) { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/ace_napi.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ace_napi.patch new file mode 100644 index 0000000000000000000000000000000000000000..4da921cebb3ccb71411e9ff2746fe0d7f8681c91 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ace_napi.patch @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //foundation/ace/napi git repository of OpenHarmony 3.1 codebase. + +This adds new macros NAPI_CALL_BOOL() and NAPI_ASSERT_BOOL() returning +boolean false instead of nullptr as done by NAPI_CALL() and NAPI_ASSERT(), +as Clang 14 doesn't implicitly cast nullptr as boolean value. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/foundation/ace/napi/interfaces/innerkits/napi/native_common.h b/foundation/ace/napi/interfaces/innerkits/napi/native_common.h +index 673301787a08..79b0518c90aa 100644 +--- a/foundation/ace/napi/interfaces/innerkits/napi/native_common.h ++++ b/foundation/ace/napi/interfaces/innerkits/napi/native_common.h +@@ -41,6 +41,8 @@ + + #define NAPI_ASSERT(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, nullptr) + ++#define NAPI_ASSERT_BOOL(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, false) ++ + #define NAPI_ASSERT_RETURN_VOID(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, NAPI_RETVAL_NOTHING) + + #define NAPI_CALL_BASE(env, theCall, retVal) \ +@@ -53,6 +55,8 @@ + + #define NAPI_CALL(env, theCall) NAPI_CALL_BASE(env, theCall, nullptr) + ++#define NAPI_CALL_BOOL(env, theCall) NAPI_CALL_BASE(env, theCall, false) ++ + #define NAPI_CALL_RETURN_VOID(env, theCall) NAPI_CALL_BASE(env, theCall, NAPI_RETVAL_NOTHING) + + #define DECLARE_NAPI_PROPERTY(name, val) \ diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_js_runtime.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_js_runtime.patch new file mode 100644 index 0000000000000000000000000000000000000000..a3e645f78a0c10ffaee27b32e45c9bc53eccd9a9 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_js_runtime.patch @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //ark/js_runtime git repository of OpenHarmony 3.1 codebase. + +* Building with host gcc (at least version 9.3.0) and LTO does not work, so we + need to disable LTO for these cases. + +* The -Wno-gnu-statement-expression argument is not supported with gcc (9.3.0), + so we need to disable that. + +* Also, gcc fails out with attributes warning, so we disable that for now. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/ark/js_runtime/BUILD.gn b/ark/js_runtime/BUILD.gn +index af617fdbf966..21ade8911675 100644 +--- a/ark/js_runtime/BUILD.gn ++++ b/ark/js_runtime/BUILD.gn +@@ -134,7 +134,12 @@ source_set("libark_js_intl_static") { + } + + config("ark_jsruntime_common_config") { +- defines = [ "PANDA_ENABLE_LTO" ] ++ if (is_clang) { ++ defines = [ "PANDA_ENABLE_LTO" ] ++ } else { ++ defines = [] ++ } ++ + if (enable_stub_aot) { + defines += [ "ECMASCRIPT_ENABLE_STUB_AOT" ] + } +@@ -178,15 +183,24 @@ config("ark_jsruntime_common_config") { + cflags_cc = [ + "-pedantic", + "-Wno-invalid-offsetof", +- "-Wno-gnu-statement-expression", + "-pipe", + "-Wdate-time", + "-Wformat=2", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-gnu-statement-expression" ] ++ } else { ++ cflags_cc += [ "-Wno-error=attributes" ] ++ } + + if (!use_libfuzzer) { +- cflags_cc += [ "-flto" ] +- ldflags = [ "-flto" ] ++ if (is_clang) { ++ cflags_cc += [ "-flto" ] ++ ldflags = [ "-flto" ] ++ } else { ++ cflags_cc += [ "-fno-lto" ] ++ ldflags = [ "-fno-lto" ] ++ } + } + + if (is_debug) { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_runtime_core.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_runtime_core.patch new file mode 100644 index 0000000000000000000000000000000000000000..d96c8101137e37083f8873d5ef92352967f26e1b --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_runtime_core.patch @@ -0,0 +1,94 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //ark/runtime_core git repository of OpenHarmony 3.1 codebase. + +* The explicit inclusion of array header is needed when using + std::array with upstream libc++ from LLVM 14. + +* As of glibc 2.34, __malloc_hook and friends have been removed, and we are + currently using glibc 2.34 in the //oniro/sysroots/host toolchain, so we need + to compile this out. Going forward, the hooks should probably be removed + entirely, and if the functionality is needed, a different implementation is + needed, and preferably one that works with musl libc as well. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Pending + +diff --git a/ark/runtime_core/BUILD.gn b/ark/runtime_core/BUILD.gn +index f30ca7fdd967..e7b0d6a812d7 100644 +--- a/ark/runtime_core/BUILD.gn ++++ b/ark/runtime_core/BUILD.gn +@@ -105,10 +105,12 @@ config("ark_config") { + "-fno-exceptions", + "-Wno-invalid-offsetof", + +- "-Wno-gnu-statement-expression", + "-Wno-unused-parameter", + "-Wno-unused-result", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-gnu-statement-expression" ] ++ } + + if (!is_mac && use_pbqp) { + cflags_cc += [ +diff --git a/ark/runtime_core/libpandabase/os/unix/futex/mutex.h b/ark/runtime_core/libpandabase/os/unix/futex/mutex.h +index b2870ce87e5c..09359f362ed1 100644 +--- a/ark/runtime_core/libpandabase/os/unix/futex/mutex.h ++++ b/ark/runtime_core/libpandabase/os/unix/futex/mutex.h +@@ -23,6 +23,7 @@ + #include <atomic> + #include <limits> + #include <iostream> ++#include <array> + + #include <unistd.h> + #include <linux/futex.h> +diff --git a/ark/runtime_core/runtime/BUILD.gn b/ark/runtime_core/runtime/BUILD.gn +index 31165dddb995..9219ae1ace2d 100644 +--- a/ark/runtime_core/runtime/BUILD.gn ++++ b/ark/runtime_core/runtime/BUILD.gn +@@ -36,6 +36,10 @@ config("arkruntime_config") { + "$ark_root/dprof/libdprof", + ] + ++ if (is_oniro_toolchain) { ++ defines = [ "_LIBC_HAS_NO_MALLOC_HOOKS" ] ++ } ++ + cflags_cc = [ + "-Wno-invalid-offsetof", + "-Wno-unused-parameter", +diff --git a/ark/runtime_core/runtime/mem/mem_hooks.cpp b/ark/runtime_core/runtime/mem/mem_hooks.cpp +index 0a0700045a57..d4038e956f17 100644 +--- a/ark/runtime_core/runtime/mem/mem_hooks.cpp ++++ b/ark/runtime_core/runtime/mem/mem_hooks.cpp +@@ -29,7 +29,7 @@ void (*volatile PandaHooks::old_free_hook)(void *, const void *) = nullptr; + /* static */ + void PandaHooks::SaveMemHooks() + { +-#ifndef __MUSL__ ++#if ! (defined(__MUSL__) || defined(_LIBC_HAS_NO_MALLOC_HOOKS)) + old_malloc_hook = __malloc_hook; + old_memalign_hook = __memalign_hook; + old_free_hook = __free_hook; +@@ -39,7 +39,7 @@ void PandaHooks::SaveMemHooks() + /* static */ + void PandaHooks::SetMemHooks() + { +-#ifndef __MUSL__ ++#if ! (defined(__MUSL__) || defined(_LIBC_HAS_NO_MALLOC_HOOKS)) + __malloc_hook = MallocHook; + __memalign_hook = MemalignHook; + __free_hook = FreeHook; +@@ -107,7 +107,7 @@ void PandaHooks::Enable() + /* static */ + void PandaHooks::Disable() + { +-#ifndef __MUSL__ ++#if ! (defined(__MUSL__) || defined(_LIBC_HAS_NO_MALLOC_HOOKS)) + __malloc_hook = old_malloc_hook; + __memalign_hook = old_memalign_hook; + __free_hook = old_free_hook; diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_ts2abc.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_ts2abc.patch new file mode 100644 index 0000000000000000000000000000000000000000..5f63052778895e47db6c4bc927e766e8c2f92079 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/ark_ts2abc.patch @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //ark/ts2abc git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-ohos-bundle being installed into +//oniro, configuring the codebase to use the toolchain and third party +components provided in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/ark/ts2abc/ts2panda/ts2abc_config.gni b/ark/ts2abc/ts2panda/ts2abc_config.gni +index 9a1db6561630..896f9739503e 100755 +--- a/ark/ts2abc/ts2panda/ts2abc_config.gni ++++ b/ark/ts2abc/ts2panda/ts2abc_config.gni +@@ -15,7 +15,7 @@ import("//build/ohos.gni") + import("//build/test.gni") + + declare_args() { +- buildtool_linux = "//build/toolchain/linux:clang_x64" ++ buildtool_linux = "$host_toolchain" + buildtool_mac = "//build/toolchain/mac:clang_x64" + buildtool_win = "//build/toolchain/mingw:mingw_x86_64" + diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_notification_ans_standard.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_notification_ans_standard.patch new file mode 100644 index 0000000000000000000000000000000000000000..6dcf2c791f9b2c712bee1a498146c54567480b0c --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_notification_ans_standard.patch @@ -0,0 +1,75 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //base/notification/ans_standard git repository of OpenHarmony 3.1 codebase. + +Use NAPI_*_BOOL() macros to fix implicit cast of nullptr to boolean value +not supported by Clang 14. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp b/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp +index a3ebc189d762..490e8180ed06 100644 +--- a/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp ++++ b/base/notification/ans_standard/interfaces/kits/napi/ans/src/reminder/reminder_common.cpp +@@ -63,7 +63,7 @@ bool ReminderCommon::GenActionButtons( + for (size_t i = 0; i < length; i++) { + napi_value actionButton = nullptr; + napi_get_element(env, actionButtons, i, &actionButton); +- NAPI_CALL(env, napi_typeof(env, actionButton, &valuetype)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, actionButton, &valuetype)); + if (valuetype != napi_object) { + ANSR_LOGW("Wrong element type:%{public}s. object expected.", ACTION_BUTTON); + return false; +@@ -259,15 +259,15 @@ bool ReminderCommon::GetStringUtf8(const napi_env &env, const napi_value &value, + napi_valuetype valuetype = napi_undefined; + size_t strLen = 0; + +- NAPI_CALL(env, napi_has_named_property(env, value, propertyName, &hasProperty)); ++ NAPI_CALL_BOOL(env, napi_has_named_property(env, value, propertyName, &hasProperty)); + if (hasProperty) { + napi_get_named_property(env, value, propertyName, &result); +- NAPI_CALL(env, napi_typeof(env, result, &valuetype)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, result, &valuetype)); + if (valuetype != napi_string) { + ANSR_LOGW("Wrong argument type:%{public}s. string expected.", propertyName); + return false; + } +- NAPI_CALL(env, napi_get_value_string_utf8(env, result, propertyVal, size - 1, &strLen)); ++ NAPI_CALL_BOOL(env, napi_get_value_string_utf8(env, result, propertyVal, size - 1, &strLen)); + } + return hasProperty; + } +@@ -305,13 +305,13 @@ bool ReminderCommon::GetPropertyValIfExist(const napi_env &env, const napi_value + propertyVal = value; + } else { + bool hasProperty = false; +- NAPI_CALL(env, napi_has_named_property(env, value, propertyName, &hasProperty)); ++ NAPI_CALL_BOOL(env, napi_has_named_property(env, value, propertyName, &hasProperty)); + if (!hasProperty) { + return false; + } + napi_get_named_property(env, value, propertyName, &propertyVal); + } +- NAPI_CALL(env, napi_typeof(env, propertyVal, &valuetype)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, propertyVal, &valuetype)); + if (valuetype != napi_number) { + if (propertyName == nullptr) { + ANSR_LOGW("Wrong argument type. number expected."); +@@ -329,12 +329,12 @@ bool ReminderCommon::GetObject(const napi_env &env, const napi_value &value, + bool hasProperty = false; + napi_valuetype valuetype = napi_undefined; + +- NAPI_CALL(env, napi_has_named_property(env, value, propertyName, &hasProperty)); ++ NAPI_CALL_BOOL(env, napi_has_named_property(env, value, propertyName, &hasProperty)); + if (!hasProperty) { + return false; + } + napi_get_named_property(env, value, propertyName, &propertyVal); +- NAPI_CALL(env, napi_typeof(env, propertyVal, &valuetype)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, propertyVal, &valuetype)); + if (valuetype != napi_object) { + ANSR_LOGW("Wrong argument type:%{public}s. object expected.", propertyName); + return false; diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_update_updater.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_update_updater.patch new file mode 100644 index 0000000000000000000000000000000000000000..776a67e3bd6f0bc79f915b2a3e3f988e1920d19e --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_update_updater.patch @@ -0,0 +1,34 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //base/update/updater git repository of OpenHarmony 3.1 codebase. + +flashd: Build Linux target only using host toolchain. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/base/update/updater/services/flashd/BUILD.gn b/base/update/updater/services/flashd/BUILD.gn +index c505c593e365..53cb6ac66be4 100755 +--- a/base/update/updater/services/flashd/BUILD.gn ++++ b/base/update/updater/services/flashd/BUILD.gn +@@ -220,17 +220,12 @@ group("flashhost_target_standard") { + } + + group("flashhost_target_standard_linux") { +- deps = [ ":ohflash(//build/toolchain/linux:clang_x64)" ] +-} +- +-group("flashhost_target_standard_mingw") { +- deps = [ ":ohflash(//build/toolchain/mingw:mingw_x86_64)" ] ++ deps = [ ":ohflash($host_toolchain)" ] + } + + group("flashhost_target_standard_all") { + deps = [ + ":flashhost_target_standard_linux", +- ":flashhost_target_standard_mingw", + ] + } + diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_usb_usb_manager.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_usb_usb_manager.patch new file mode 100644 index 0000000000000000000000000000000000000000..26b34c1062d8335fa87bedde5c21dd87d724b9b5 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_usb_usb_manager.patch @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //base/usb/usb_manager git repository of OpenHarmony 3.1 codebase. + +Use NAPI_*_BOOL() macros to fix implicit cast of nullptr to boolean value +not supported by Clang 14. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp b/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp +index be7232239e3d..d303806fc7cd 100644 +--- a/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp ++++ b/base/usb/usb_manager/interfaces/kits/js/napi/src/usb_info.cpp +@@ -1178,17 +1178,17 @@ static bool GetBulkTransferParams(napi_env env, napi_callback_info info, USBBulk + napi_value argv[PARAM_COUNT_4] = {0}; + + napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); +- NAPI_ASSERT(env, (status == napi_ok) && (argc >= PARAM_COUNT_3), "BulkTransfer failed to get cb info"); ++ NAPI_ASSERT_BOOL(env, (status == napi_ok) && (argc >= PARAM_COUNT_3), "BulkTransfer failed to get cb info"); + + napi_valuetype type; + USBDevicePipe pipe; + napi_typeof(env, argv[INDEX_0], &type); +- NAPI_ASSERT(env, type == napi_object, "BulkTransfer wrong argument type index 0, object expected"); ++ NAPI_ASSERT_BOOL(env, type == napi_object, "BulkTransfer wrong argument type index 0, object expected"); + ParseUsbDevicePipe(env, argv[INDEX_0], pipe); + + USBEndpoint ep; + napi_typeof(env, argv[INDEX_1], &type); +- NAPI_ASSERT(env, type == napi_object, "BulkTransfer wrong argument type index 1. Object expected."); ++ NAPI_ASSERT_BOOL(env, type == napi_object, "BulkTransfer wrong argument type index 1. Object expected."); + ParseEndpointObj(env, argv[INDEX_1], ep); + + int32_t timeOut = 0; diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_user_iam_pin_auth.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_user_iam_pin_auth.patch new file mode 100644 index 0000000000000000000000000000000000000000..e5633743fd20c9d14c0bf60b60809a6059ea64af --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/base_user_iam_pin_auth.patch @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //base/user_iam/pin_auth git repository of OpenHarmony 3.1 codebase. + +This adds a missing type cast. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp b/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp +index 27e6bfd51ba8..9254f4ec7e29 100644 +--- a/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp ++++ b/base/user_iam/pin_auth/frameworks/src/inputer_data_impl.cpp +@@ -51,7 +51,7 @@ void InputerDataImpl::getScrypt(std::vector<uint8_t> data, std::vector<uint8_t> + PINAUTH_HILOGE(MODULE_FRAMEWORKS, "InputerDataImpl::getScrypt EVP_PKEY_derive_init error"); + return; + } +- if (EVP_PKEY_CTX_set1_pbe_pass(pctx, data.data(), data.size()) <= 0) { ++ if (EVP_PKEY_CTX_set1_pbe_pass(pctx, (const char *)data.data(), data.size()) <= 0) { + PINAUTH_HILOGE(MODULE_FRAMEWORKS, "InputerDataImpl::getScrypt EVP_PKEY_CTX_set1_pbe_pass error"); + EVP_PKEY_CTX_free(pctx); + return; diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/build.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/build.patch new file mode 100644 index 0000000000000000000000000000000000000000..5ce81000f98b2f672443ff49deb12ca782fd6c86 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/build.patch @@ -0,0 +1,244 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //build git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-toolchain or oniro-openharmony-bundle +being installed into //oniro, configuring the codebase to use the toolchain in +//oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn +index 9bef481bc4f1..b027f8aa1f70 100755 +--- a/build/config/BUILDCONFIG.gn ++++ b/build/config/BUILDCONFIG.gn +@@ -66,7 +66,7 @@ target_os = product_build_config.target_os + target_cpu = product_build_config.target_cpu + product_toolchain = product_build_config.product_toolchain_label + if (product_toolchain == "") { +- product_toolchain = "//build/toolchain/ohos:ohos_clang_$target_cpu" ++ product_toolchain = "//oniro/sysroots/target:target_clang" + } + if (defined(product_build_config.enable_ramdisk)) { + enable_ramdisk = product_build_config.enable_ramdisk +@@ -199,11 +199,13 @@ declare_args() { + + # Allows the path to a custom target toolchain to be injected as a single + # argument, and set as the default toolchain. +- custom_toolchain = "" ++ custom_toolchain = "//oniro/sysroots/target:target_clang" + + # This should not normally be set as a build argument. It's here so that + # every toolchain can pass through the "global" value via toolchain_args(). +- host_toolchain = "" ++ host_toolchain = "//oniro/sysroots/host:clang_x64" ++ ++ is_oniro_toolchain = true + + # target platform + target_platform = "phone" +diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni +index 5a124ffd3e9a..07680d98c2d5 100755 +--- a/build/config/clang/clang.gni ++++ b/build/config/clang/clang.gni +@@ -4,7 +4,7 @@ + + import("//build/toolchain/toolchain.gni") + +-default_clang_base_path = "//prebuilts/clang/ohos/${host_platform_dir}/llvm" ++default_clang_base_path = "//oniro/sysroots/host/usr" + + declare_args() { + # Indicates if the build should use the Chrome-specific plugins for enforcing +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index ec42ec55627f..523b08665f40 100755 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -515,6 +515,11 @@ config("compiler") { + # Gcc does not support ##__VA_ARGS__ when in standards-conforming mode, + # but we use this feature in several places in Chromium. + standard_prefix = "gnu" ++ ++ # For what it is worth, we end up building with -std=c* instead of ++ #-std=gnu* in some components relying on GNU extensions, we need to ++ # define _GNU_SOURCE manually here as well. ++ defines += [ "_GNU_SOURCE" ] + } + + # cflags_c += [ "-std=${standard_prefix}11" ] +@@ -682,7 +692,7 @@ config("compiler_cpu_abi") { + ldflags = [] + defines = [] + +- if (is_posix && !is_mac) { ++ if (is_posix && !(is_mac || !is_oniro_toolchain)) { + # CPU architecture. We may or may not be doing a cross compile now, so for + # simplicity we always explicitly set the architecture. + if (current_cpu == "x64") { +diff --git a/build/config/ohos/BUILD.gn b/build/config/ohos/BUILD.gn +index aa5ac7cc6629..3db8725133c7 100755 +--- a/build/config/ohos/BUILD.gn ++++ b/build/config/ohos/BUILD.gn +@@ -41,6 +41,7 @@ config("compiler") { + "-Wl,--exclude-libs=libvpx_assembly_arm.a", + ] + ++ if (!is_oniro_toolchain) { + cflags += [ "--target=$abi_target" ] + include_dirs = [ + "${musl_sysroot}/usr/include/${abi_target}", +@@ -52,6 +53,7 @@ config("compiler") { + # Assign any flags set for the C compiler to asmflags so that they are sent + # to the assembler. + asmflags = cflags ++ } + } + + # This is included by reference in the //build/config/compiler:runtime_library +@@ -71,7 +73,11 @@ config("runtime_library") { + "_LIBCPP_HAS_MUSL_LIBC", + "__BUILD_LINUX_WITH_CLANG", + ] +- ldflags = [ "-nostdlib" ] ++ if (!is_oniro_toolchain) { ++ ldflags = [ "-nostdlib" ] ++ } else { ++ ldflags = [] ++ } + + libs = [] + +@@ -80,6 +86,7 @@ config("runtime_library") { + libs += [ "unwind" ] + } + ++ if (!is_oniro_toolchain) { + ldflags += [ + "-L" + + rebase_path("${clang_base_path}/lib/${abi_target}/c++", root_build_dir), +@@ -87,9 +87,10 @@ config("runtime_library") { + "-L" + rebase_path("${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}", + root_build_dir), + ] ++ libs += [ rebase_path(libclang_rt_file) ] ++ } + + libs += [ +- rebase_path(libclang_rt_file), + "c", + "c++", + "c++abi", +diff --git a/build/config/ohos/config.gni b/build/config/ohos/config.gni +index 072bce1da9ff..924f034bbbf6 100644 +--- a/build/config/ohos/config.gni ++++ b/build/config/ohos/config.gni +@@ -37,5 +37,7 @@ if (is_ohos) { + assert(false, "Architecture not supported") + } + ++ if (!is_oniro_toolchain) { + libclang_rt_file = "${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}/libclang_rt.builtins.a" ++ } + } +diff --git a/build/config/ohos/musl.gni b/build/config/ohos/musl.gni +index 2468ca8d5cfe..337095d910f3 100644 +--- a/build/config/ohos/musl.gni ++++ b/build/config/ohos/musl.gni +@@ -13,7 +13,11 @@ + + if (use_musl){ + musl_target_abi_name = "soft" ++ if (!is_oniro_toolchain) { + musl_target = "//third_party/musl:musl_libs" + musl_sysroot = get_label_info(musl_target, "target_out_dir") ++ } else { ++ musl_sysroot = "//oniro/sysroots/target" ++ } + import("//third_party/musl/musl_config.gni") + } +\ No newline at end of file +diff --git a/build/ohos/ace/ace.gni b/build/ohos/ace/ace.gni +index 60b1082bac9e..b13a3d4561e2 100644 +--- a/build/ohos/ace/ace.gni ++++ b/build/ohos/ace/ace.gni +@@ -26,7 +26,7 @@ template("gen_js_obj") { + action("gen_js_obj_" + name) { + visibility = [ ":*" ] + +- objcopy_tool = "${clang_base_path}/bin/llvm-objcopy" ++ objcopy_tool = "//oniro/sysroots/host/usr/bin/llvm-objcopy" + platform = "${current_os}_${current_cpu}" + if (platform == "mingw_x86_64") { + script = +diff --git a/build/ohos/ndk/ndk.gni b/build/ohos/ndk/ndk.gni +index ce4d5564dd07..aa9d75badfb1 100755 +--- a/build/ohos/ndk/ndk.gni ++++ b/build/ohos/ndk/ndk.gni +@@ -128,7 +128,7 @@ template("ohos_ndk_library") { + # Don't enable cross compile if build_ohos_ndk is false. + # Cross compiling in this case may cause build failure in some scenario, + # such as build for ASAN. +- ndk_toolchains = [ "//build/toolchain/ohos:ohos_clang_${target_cpu}" ] ++ ndk_toolchains = [ "//oniro/sysroots/target:target_clang" ] + } + + _accumulated_deps = [] +@@ -140,6 +140,8 @@ template("ohos_ndk_library") { + _ndk_shlib_directory = "aarch64-linux-ohos" + } else if (_toolchain == "//build/toolchain/ohos:ohos_clang_x86_64") { + _ndk_shlib_directory = "x86_64-linux-ohos" ++ } else if (_toolchain == "//oniro/sysroots/target:target_clang") { ++ _ndk_shlib_directory = target_cpu + "-linux-ohos" + } + + assert(defined(_ndk_shlib_directory)) +diff --git a/build/templates/cxx/cxx.gni b/build/templates/cxx/cxx.gni +index db2a816e61fc..e43c699b0c52 100755 +--- a/build/templates/cxx/cxx.gni ++++ b/build/templates/cxx/cxx.gni +@@ -155,6 +155,11 @@ template("ohos_executable") { + } + if (!defined(libs)) { + libs = [] ++ if (is_oniro_toolchain && is_clang) { ++ libs += ["c++", "c++abi"] ++ } else if (is_oniro_toolchain && !is_clang) { ++ libs += ["stdc++"] ++ } + } + if (!defined(include_dirs)) { + include_dirs = [] +@@ -462,6 +462,11 @@ template("ohos_shared_library") { + } + if (!defined(libs)) { + libs = [] ++ if (is_oniro_toolchain && is_clang) { ++ libs += ["c++", "c++abi"] ++ } else if (is_oniro_toolchain && !is_clang) { ++ libs += ["stdc++"] ++ } + } + if (!defined(include_dirs)) { + include_dirs = [] +diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn +index bc30de9ce465..c9a1b152d02d 100755 +--- a/build/config/linux/BUILD.gn ++++ b/build/config/linux/BUILD.gn +@@ -37,6 +37,14 @@ config("runtime_library") { + libs += [ "${asdk_libs_dir}/ndk/libcxx/linux_x86_64/libc++.so" ] + } + } ++ ++ if (is_oniro_toolchain) { ++ if (is_clang) { ++ libs += [ "c++", "c++abi" ] ++ } else { ++ libs += [ "stdc++" ] ++ } ++ } + } + + config("executable_config") { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/build_lite.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/build_lite.patch new file mode 100644 index 0000000000000000000000000000000000000000..8dadac0dbb338844e542429f83bfdf35ba37917b --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/build_lite.patch @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //build/lite git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-toolchain or oniro-openharmony-bundle +being installed into //oniro, configuring the codebase to use the toolchain +provided in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/build/lite/hb_internal/preloader/preloader.py b/build/lite/hb_internal/preloader/preloader.py +index 42e7ec243114..34adeb1ebf6f 100755 +--- a/build/lite/hb_internal/preloader/preloader.py ++++ b/build/lite/hb_internal/preloader/preloader.py +@@ -487,8 +487,7 @@ class Preloader(): + if os_level == 'mini' or os_level == 'small': + toolchain_label = "" + else: +- toolchain_label = '//build/toolchain/{0}:{0}_clang_{1}'.format( +- target_os, target_cpu) ++ toolchain_label = '//oniro/sysroots/target:target_clang' + + # add toolchain label + build_vars['product_toolchain_label'] = toolchain_label diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/build_third_party.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/build_third_party.patch new file mode 100644 index 0000000000000000000000000000000000000000..9817f63f998c7e9164891837e845950a93be60cb --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/build_third_party.patch @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //build git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-bundle being installed into +//oniro, configuring the codebase to use third party +components provided in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/build/common/BUILD.gn b/build/common/BUILD.gn +index bf98fc448834..1f0810ddaf73 100755 +--- a/build/common/BUILD.gn ++++ b/build/common/BUILD.gn +@@ -40,6 +40,9 @@ group("common_packages") { + ] + } + ++ # Prebuilt third-party components from Oniro ++ deps += [ "//oniro:third_party" ] ++ + # global subsystem's configuration + deps += [ + "//third_party/icu/icu4c:ohos_icudat", diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_hdc_standard.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_hdc_standard.patch new file mode 100644 index 0000000000000000000000000000000000000000..08702f1ceec7dfed8c32d50c321446c76bccc1b2 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_hdc_standard.patch @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //developtools/hdc_standard git repository of OpenHarmony 3.1 codebase. + +Only build for linux host using host toolchain. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/developtools/hdc_standard/BUILD.gn b/developtools/hdc_standard/BUILD.gn +index b2c1cfbeea4a..8b4eeaa1fc1f 100644 +--- a/developtools/hdc_standard/BUILD.gn ++++ b/developtools/hdc_standard/BUILD.gn +@@ -194,25 +194,13 @@ group("hdc_target_standard") { + } + + group("hdc_target_standard_linux") { +- deps = [ ":hdc_std(//build/toolchain/linux:clang_x64)" ] +-} +- +-group("hdc_target_standard_mingw") { +- deps = [ ":hdc_std(//build/toolchain/mingw:mingw_x86_64)" ] ++ deps = [ ":hdc_std($host_toolchain)" ] + } + + group("hdc_target_standard_all") { + deps = [ + ":hdc_target_standard", + ":hdc_target_standard_linux", +- ":hdc_target_standard_mingw", +- ] +-} +- +-group("hdc_target_standard_windows") { +- deps = [ +- ":hdc_target_standard", +- ":hdc_target_standard_mingw", + ] + } + diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_hiperf.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_hiperf.patch new file mode 100644 index 0000000000000000000000000000000000000000..b72a1e758a6151c7836515e8934bef5eaf182fee --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_hiperf.patch @@ -0,0 +1,113 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //developtools/hiperf git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-toolchain being installed into +//oniro, configuring the codebase to use the toolchain in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/developtools/hiperf/BUILD.gn b/developtools/hiperf/BUILD.gn +index 3c2c1897dab6..1625f14eca5f 100644 +--- a/developtools/hiperf/BUILD.gn ++++ b/developtools/hiperf/BUILD.gn +@@ -292,7 +292,7 @@ host_protoc_path = + root_out_dir + host_out_path + "/" + protoc_subsystem_out_path + "/protoc" + + action("hiperf_host_build_proto") { +- deps = [ "//third_party/protobuf:protoc(//build/toolchain/linux:clang_x64)" ] ++ deps = [ "//third_party/protobuf:protoc($host_toolchain)" ] + args = [] + outputs = proto_file_codegen + sources = [] +@@ -357,7 +357,7 @@ ohos_executable("hiperf_host") { + deps = [ ":hiperf_platform_common" ] + + if (use_musl) { +- static_link = true ++ static_link = false + } + + subsystem_name = "developtools" +@@ -423,11 +423,9 @@ group("hiperf_target_all") { + deps = [ ":hiperf_target" ] + } else { + deps = [ +- ":hiperf_host(//build/toolchain/linux:clang_x64)", # host linux +- ":hiperf_host(//build/toolchain/mingw:mingw_x86_64)", # host mingw +- ":hiperf_host_lib(//build/toolchain/linux:clang_x64)", # host linux +- ":hiperf_host_lib(//build/toolchain/mingw:mingw_x86_64)", # host mingw +- ":hiperf_host_lib_demo(//build/toolchain/linux:clang_x64)", # host linux ++ ":hiperf_host($host_toolchain)", # host linux ++ ":hiperf_host_lib($host_toolchain)", # host linux ++ ":hiperf_host_lib_demo($host_toolchain)", # host linux + ":hiperf_host_python", + ":hiperf_target", + "interfaces/innerkits/native:hiperf_client", # c++ api +diff --git a/proto/build_proto.sh b/proto/build_proto.sh +index 407b54a226b6..776971048498 100755 +--- a/developtools/hiperf/proto/build_proto.sh ++++ b/developtools/hiperf/proto/build_proto.sh +@@ -23,6 +23,9 @@ BUILD_TOP=$MYDIR/../../../ + echo MYDIR $MYDIR + echo BUILD_TOP $BUILD_TOP + ++# Set path to libprotobuf.z.so library ++export LD_LIBRARY_PATH=$(dirname $1) ++ + protoc_cmdline=$* + echo protoc_cmdline $protoc_cmdline + +diff --git a/developtools/hiperf/include/elf_parser.h b/developtools/hiperf/include/elf_parser.h +index a63b1248f34d..50c389583b94 100755 +--- a/developtools/hiperf/include/elf_parser.h ++++ b/developtools/hiperf/include/elf_parser.h +@@ -25,12 +25,7 @@ + #include <unordered_map> + #include <vector> + +-#if !is_ohos +-// this is not good enough +-#include <../musl/include/elf.h> +-#else + #include <elf.h> +-#endif + + #include <fcntl.h> + #include <stdint.h> +diff --git a/developtools/hiperf/src/hiperf_libreport.cpp b/developtools/hiperf/src/hiperf_libreport.cpp +index 6236d70dd4c6..2feee7796f14 100644 +--- a/developtools/hiperf/src/hiperf_libreport.cpp ++++ b/developtools/hiperf/src/hiperf_libreport.cpp +@@ -14,11 +14,6 @@ + */ + #include "hiperf_libreport.h" + +-#if !is_ohos +-// this is not good enough +-#include <../musl/include/elf.h> +-#endif +- + #include "debug_logger.h" + #include "elf_parser.h" + #include "perf_file_reader.h" +diff --git a/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h b/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h +index 4ea121bc1018..32493f2ed4bb 100755 +--- a/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h ++++ b/developtools/hiperf/test/unittest/common/native/include/elf_parser_test.h +@@ -16,12 +16,7 @@ + #ifndef HIPERF_ELF_PARSER_TEST_H + #define HIPERF_ELF_PARSER_TEST_H + +-#if !is_ohos +-// this is not good enough +-#include <../musl/include/elf.h> +-#else + #include <elf.h> +-#endif + #include <gmock/gmock.h> + #include <gtest/gtest.h> + #include <hilog/log.h> diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_profiler.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_profiler.patch new file mode 100644 index 0000000000000000000000000000000000000000..2bb33af78ae3345052136b7b4bc5b6a7eb21c1a2 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/developtools_profiler.patch @@ -0,0 +1,94 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //developtools/profiler git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-toolchain being installed into +//oniro, configuring the codebase to use the toolchain in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/developtools/profiler/build/gcov.sh b/developtools/profiler/build/gcov.sh +index 5ad6b336cd78..f2c45d2ec1cf 100755 +--- a/developtools/profiler/build/gcov.sh ++++ b/developtools/profiler/build/gcov.sh +@@ -14,8 +14,4 @@ + set -e + DIR=$(dirname $(realpath ${BASH_SOURCE[0]})) + TOP=$(realpath $DIR/../../..) +-CLANG_DIR=$TOP/prebuilts/clang/host/linux-x86/clang-r353983c +-if [ ! -e "$CLANG_DIR" ]; then +- CLANG_DIR=$TOP/prebuilts/clang/ohos/linux-x86_64/llvm +-fi +-$CLANG_DIR/bin/llvm-cov gcov $@ ++$TOP/oniro/sysroots/host/usr/bin/llvm-cov gcov $@ +diff --git a/developtools/profiler/device/format-code.sh b/developtools/profiler/device/format-code.sh +index 5296125d98fb..cd4981a2e07c 100755 +--- a/developtools/profiler/device/format-code.sh ++++ b/developtools/profiler/device/format-code.sh +@@ -18,7 +18,7 @@ set -e + + DIR=$(dirname $(realpath ${BASH_SOURCE[0]})) + TOP=$(realpath $DIR/../../..) +-CLANG_DIR=$TOP/prebuilts/clang/ohos/linux-x86_64/llvm/bin ++CLANG_DIR=$TOP/oniro/sysroots/host/usr/bin + GN_DIR=$TOP/prebuilts/build-tools/linux-x86/bin + + export PATH=$CLANG_DIR:$GN_DIR:$PATH +diff --git a/developtools/profiler/device/plugins/ftrace_plugin/src/flow_controller.cpp b/developtools/profiler/device/plugins/ftrace_plugin/src/flow_controller.cpp +index 077078228317..4e7600ace0ee 100755 +--- a/developtools/profiler/device/plugins/ftrace_plugin/src/flow_controller.cpp ++++ b/developtools/profiler/device/plugins/ftrace_plugin/src/flow_controller.cpp +@@ -325,7 +325,7 @@ int FlowController::StopCapture(void) + bool FlowController::ParsePerCpuStatus(int stage) + { + auto tracePacket = std::make_unique<TracePluginResult>(); +- CHECK_NOTNULL(tracePacket, nullptr, "create TracePluginResult FAILED!"); ++ CHECK_NOTNULL(tracePacket, false, "create TracePluginResult FAILED!"); + + auto cpuStatsMsg = tracePacket->add_ftrace_cpu_stats(); + if (stage == TRACE_START) { +@@ -362,7 +362,7 @@ bool FlowController::ParsePerCpuStatus(int stage) + bool FlowController::ReportClockTimes() + { + auto traceResult = std::make_unique<TracePluginResult>(); +- CHECK_NOTNULL(traceResult, nullptr, "create TracePluginResult FAILED!"); ++ CHECK_NOTNULL(traceResult, false, "create TracePluginResult FAILED!"); + + std::map<clockid_t, ClockDetailMsg::ClockId> clocksMap = { + {CLOCK_REALTIME, ClockDetailMsg::REALTIME}, +@@ -376,7 +376,7 @@ bool FlowController::ReportClockTimes() + struct timespec ts = {}; + clock_gettime(entry.first, &ts); + auto clockMsg = traceResult->add_clocks_detail(); +- CHECK_NOTNULL(clockMsg, nullptr, "add clock_detail failed for %d!", entry.first); ++ CHECK_NOTNULL(clockMsg, false, "add clock_detail failed for %d!", entry.first); + clockMsg->set_id(entry.second); + auto timeMsg = clockMsg->mutable_time(); + timeMsg->set_tv_sec(ts.tv_sec); +@@ -394,7 +394,7 @@ bool FlowController::ReportClockTimes() + bool FlowController::ParseKernelSymbols() + { + auto traceResult = std::make_unique<TracePluginResult>(); +- CHECK_NOTNULL(traceResult, nullptr, "create TracePluginResult FAILED!"); ++ CHECK_NOTNULL(traceResult, false, "create TracePluginResult FAILED!"); + + ksymsParser_->Accept([&traceResult](const KernelSymbol& symbol) { + auto symbolDetail = traceResult->add_symbols_detail(); +@@ -408,12 +408,12 @@ bool FlowController::ParseKernelSymbols() + bool FlowController::ParseFtraceEvent(int cpuid, uint8_t page[]) + { + auto tracePacket = std::make_unique<TracePluginResult>(); +- CHECK_NOTNULL(tracePacket, nullptr, "create TracePluginResult FAILED!"); ++ CHECK_NOTNULL(tracePacket, false, "create TracePluginResult FAILED!"); + + auto cpudetail = tracePacket->add_ftrace_cpu_detail(); + cpudetail->set_cpu(static_cast<uint32_t>(cpuid)); + +- CHECK_TRUE(ftraceParser_->ParsePage(*cpudetail, page, PAGE_SIZE), nullptr, "parse page failed!"); ++ CHECK_TRUE(ftraceParser_->ParsePage(*cpudetail, page, PAGE_SIZE), false, "parse page failed!"); + + return tansporter_->Submit(std::move(tracePacket)); + } diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_adapter_khdf_linux.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_adapter_khdf_linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..0e52d7db98b950d4d678d9bc9683f789852e8ef3 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_adapter_khdf_linux.patch @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //drivers/adapter/khdf/linux git repository of OpenHarmony 3.1 codebase. + +Clang 14 brings in a lot of new checks/warnings, and the current +codebase violates the declaration-after-statement check, so we need to +reduce that from an error to a warning in order to be able to compile +the code. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [code should be fixed instead] + +diff --git a/drivers/adapter/khdf/linux/model/audio/Makefile b/drivers/adapter/khdf/linux/model/audio/Makefile +index cac77f148329..9a3045955065 100644 +--- a/drivers/adapter/khdf/linux/model/audio/Makefile ++++ b/drivers/adapter/khdf/linux/model/audio/Makefile +@@ -20,6 +20,8 @@ KHDF_AUDIO_HI3516DV300_INC_DIR = drivers/hdf/framework/../peripheral/audio/chips + KHDF_AUDIO_RK3568_DIR = $(KHDF_AUDIO_BASE_ROOT_DIR)/device/hihope/rk3568/audio_drivers + KHDF_AUDIO_RK3568_INC_DIR = drivers/hdf/framework/../../device/hihope/rk3568/audio_drivers + ++ccflags-y += "-Wno-error=declaration-after-statement" ++ + obj-$(CONFIG_DRIVERS_HDF_AUDIO) += \ + $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_core.o \ + $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_host.o \ diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch new file mode 100644 index 0000000000000000000000000000000000000000..ddf7e486d792c141ffd79a8cfc9ad22e0359c15b --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch @@ -0,0 +1,78 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //drivers/framework git repository of OpenHarmony 3.1 codebase. + +Using //oniro/sysroots/target:target_clang toolchain, we now get a +working input-event-codes.h from the kernel headers, so we can drop +the dependency on the out-of-tree (FreeBSD!) header version. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Pending + +diff --git a/drivers/framework/model/input/driver/event_hub.h b/drivers/framework/model/input/driver/event_hub.h +index 97dec781d33f..bd7a0f20a559 100644 +--- a/drivers/framework/model/input/driver/event_hub.h ++++ b/drivers/framework/model/input/driver/event_hub.h +@@ -9,7 +9,7 @@ + #ifndef EVENT_HUB_H + #define EVENT_HUB_H + +-#include "input-event-codes.h" ++#include <uapi/linux/input-event-codes.h> + #include "hdf_input_device_manager.h" + #include "osal_time.h" + +diff --git a/drivers/framework/model/input/driver/hdf_input_device_manager.h b/drivers/framework/model/input/driver/hdf_input_device_manager.h +index 98d247d88b91..f3d520755aa9 100644 +--- a/drivers/framework/model/input/driver/hdf_input_device_manager.h ++++ b/drivers/framework/model/input/driver/hdf_input_device_manager.h +@@ -9,7 +9,7 @@ + #ifndef HDF_INPUT_DEVICE_MANAGER_H + #define HDF_INPUT_DEVICE_MANAGER_H + +-#include "input-event-codes.h" ++#include <uapi/linux/input-event-codes.h> + #include "osal_mutex.h" + #include "hdf_types.h" + #include "hdf_device_desc.h" +diff --git a/drivers/framework/test/unittest/pm/hdf_pm_driver_test.c b/drivers/framework/test/unittest/pm/hdf_pm_driver_test.c +index 3f5dcf0034fb..41f84aa02869 100644 +--- a/drivers/framework/test/unittest/pm/hdf_pm_driver_test.c ++++ b/drivers/framework/test/unittest/pm/hdf_pm_driver_test.c +@@ -221,7 +221,7 @@ void HdfPmSetListeners(void) + pmTestType[PM_TEST_DRIVER].listener.powerListener.Suspend = HdfPmTestSuspend; + } + +-void HdfPmClearTestCnt() ++void HdfPmClearTestCnt(void) + { + uint32_t index; + +diff --git a/drivers/framework/core/host/src/hdf_driver_loader.c b/drivers/framework/core/host/src/hdf_driver_loader.c +index 6497fab81da3..66495ef184e0 100644 +--- a/drivers/framework/core/host/src/hdf_driver_loader.c ++++ b/drivers/framework/core/host/src/hdf_driver_loader.c +@@ -13,7 +13,7 @@ + + #define HDF_LOG_TAG driver_loader + +-int32_t HdfDriverEntryConstruct() ++int32_t HdfDriverEntryConstruct(void) + { + int i; + struct HdfDriverEntry *driverEntry = NULL; +diff --git a/drivers/framework/tools/hdi-gen/Makefile b/drivers/framework/tools/hdi-gen/Makefile +index 033c257575dc..99e0d0ca7a0a 100644 +--- a/drivers/framework/tools/hdi-gen/Makefile ++++ b/drivers/framework/tools/hdi-gen/Makefile +@@ -27,9 +28,9 @@ endif + + all: + $(Q) echo start build $(TARGET) ... +- $(Q) $(MAKE) -f $(MAKE_FILE_NAME) ++ $(Q) $(MAKE) CXX=${BUILD_CXX} -f $(MAKE_FILE_NAME) + + clean: + $(Q) $(MAKE) -f $(MAKE_FILE_NAME) clean diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_peripheral.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_peripheral.patch new file mode 100644 index 0000000000000000000000000000000000000000..502132b1aa37e4d2ce35090b173a75b8c330b04a --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_peripheral.patch @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //drivers/peripheral git repository of OpenHarmony 3.1 codebase. + +Using //oniro/sysroots/target:target_clang toolchain, we now get a +working input-event-codes.h from the kernel headers, so we can drop +the dependency on the out-of-tree (FreeBSD!) header version. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Pending + +diff --git a/drivers/peripheral/input/interfaces/include/input_type.h b/drivers/peripheral/input/interfaces/include/input_type.h +index 137e89d5c7a8..acfceab73c5a 100644 +--- a/drivers/peripheral/input/interfaces/include/input_type.h ++++ b/drivers/peripheral/input/interfaces/include/input_type.h +@@ -42,9 +42,7 @@ + #include <stdbool.h> + #include <sys/time.h> + +-#ifndef _UAPI_INPUT_H +-#include <input-event-codes.h> +-#endif ++#include <linux/input-event-codes.h> + + #ifdef __cplusplus + extern "C" { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_aafwk_standard.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_aafwk_standard.patch new file mode 100644 index 0000000000000000000000000000000000000000..3857c9cadad1b55adc265a36b8682c4c719bdb8a --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_aafwk_standard.patch @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //foundation/aafwk/standard git repository of OpenHarmony 3.1 codebase. + +Fix implicit cast of nullptr to boolean value not supported by Clang 14. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/foundation/aafwk/standard/services/abilitymgr/src/call_container.cpp b/foundation/aafwk/standard/services/abilitymgr/src/call_container.cpp +index 4657a6051f27..91d295f28857 100644 +--- a/foundation/aafwk/standard/services/abilitymgr/src/call_container.cpp ++++ b/foundation/aafwk/standard/services/abilitymgr/src/call_container.cpp +@@ -76,8 +76,8 @@ std::shared_ptr<CallRecord> CallContainer::GetCallRecord(const sptr<IAbilityConn + bool CallContainer::RemoveCallRecord(const sptr<IAbilityConnection> & connect) + { + HILOG_DEBUG("call container release call record by callback."); +- CHECK_POINTER_AND_RETURN(connect, nullptr); +- CHECK_POINTER_AND_RETURN(connect->AsObject(), nullptr); ++ CHECK_POINTER_AND_RETURN(connect, false); ++ CHECK_POINTER_AND_RETURN(connect->AsObject(), false); + + auto iter = callRecordMap_.find(connect->AsObject()); + if (iter != callRecordMap_.end()) { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_appexecfwk_standard.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_appexecfwk_standard.patch new file mode 100644 index 0000000000000000000000000000000000000000..514b3555f6c5e0f9890b092e64e0c2299f6b1470 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_appexecfwk_standard.patch @@ -0,0 +1,178 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //foundation/appexecfwk/standard git repository of OpenHarmony 3.1 codebase. + +Use NAPI_*_BOOL() macros to fix implicit cast of nullptr to boolean value +not supported by Clang 14. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/foundation/appexecfwk/standard/interfaces/innerkits/napi/eventhandler/src/events_emitter.cpp b/foundation/appexecfwk/standard/interfaces/innerkits/napi/eventhandler/src/events_emitter.cpp +index 8cfa01831657..59268b1ca5c1 100644 +--- a/foundation/appexecfwk/standard/interfaces/innerkits/napi/eventhandler/src/events_emitter.cpp ++++ b/foundation/appexecfwk/standard/interfaces/innerkits/napi/eventhandler/src/events_emitter.cpp +@@ -311,7 +311,7 @@ namespace AppExecFwk { + { + napi_valuetype dataType; + napi_typeof(env, argv, &dataType); +- NAPI_ASSERT(env, dataType == napi_object, "type mismatch for parameter 2"); ++ NAPI_ASSERT_BOOL(env, dataType == napi_object, "type mismatch for parameter 2"); + + bool hasData = false; + napi_has_named_property(env, argv, "data", &hasData); +diff --git a/foundation/appexecfwk/standard/kits/appkit/napi/distributebundlemgr/distributed_bundle_mgr.cpp b/foundation/appexecfwk/standard/kits/appkit/napi/distributebundlemgr/distributed_bundle_mgr.cpp +index 36294afbb5f9..4417555703e3 100644 +--- a/foundation/appexecfwk/standard/kits/appkit/napi/distributebundlemgr/distributed_bundle_mgr.cpp ++++ b/foundation/appexecfwk/standard/kits/appkit/napi/distributebundlemgr/distributed_bundle_mgr.cpp +@@ -154,7 +154,7 @@ static bool ParseElementName(napi_env env, OHOS::AppExecFwk::ElementName &elemen + APP_LOGD("begin to parse ElementName"); + napi_status status; + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, args, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, args, &valueType)); + if (valueType != napi_object) { + APP_LOGE("args not object type"); + return false; +@@ -194,19 +194,19 @@ static bool ParseElementNames(napi_env env, std::vector<ElementName> &elementNam + { + APP_LOGD("begin to parse ElementNames"); + bool isArray = false; +- NAPI_CALL(env, napi_is_array(env, args, &isArray)); ++ NAPI_CALL_BOOL(env, napi_is_array(env, args, &isArray)); + if (!isArray) { + APP_LOGE("parseElementNames args not array"); + return false; + } + uint32_t arrayLength = 0; +- NAPI_CALL(env, napi_get_array_length(env, args, &arrayLength)); ++ NAPI_CALL_BOOL(env, napi_get_array_length(env, args, &arrayLength)); + APP_LOGD("arrayLength:%{public}d", arrayLength); + for (uint32_t i = 0; i < arrayLength; i++) { + napi_value value = nullptr; +- NAPI_CALL(env, napi_get_element(env, args, i, &value)); ++ NAPI_CALL_BOOL(env, napi_get_element(env, args, i, &value)); + napi_valuetype valueType = napi_undefined; +- NAPI_CALL(env, napi_typeof(env, value, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, value, &valueType)); + if (valueType != napi_object) { + APP_LOGE("array inside not object type"); + elementNames.clear(); +diff --git a/foundation/appexecfwk/standard/kits/appkit/napi/launchermgr/js_launcher.cpp b/foundation/appexecfwk/standard/kits/appkit/napi/launchermgr/js_launcher.cpp +index 1ba6ec00e561..5d57fcb50cfd 100644 +--- a/foundation/appexecfwk/standard/kits/appkit/napi/launchermgr/js_launcher.cpp ++++ b/foundation/appexecfwk/standard/kits/appkit/napi/launchermgr/js_launcher.cpp +@@ -84,7 +84,7 @@ static bool ParseBundleStatusCallback(napi_env env, + APP_LOGD("parse bundleStatusCallback begin"); + napi_status status; + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, args, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, args, &valueType)); + if (valueType != napi_object) { + APP_LOGE("param type mismatch!"); + return false; +@@ -94,7 +94,7 @@ static bool ParseBundleStatusCallback(napi_env env, + napi_ref addCallback = nullptr; + napi_value addValue = nullptr; + status = napi_get_named_property(env, args, "add", &addValue); +- NAPI_ASSERT(env, status == napi_ok, "property name incorrect!"); ++ NAPI_ASSERT_BOOL(env, status == napi_ok, "property name incorrect!"); + napi_typeof(env, addValue, &valueType); + if (valueType != napi_function) { + APP_LOGE("add param type mismatch!"); +@@ -106,7 +106,7 @@ static bool ParseBundleStatusCallback(napi_env env, + napi_ref updateCallback = nullptr; + napi_value updateValue = nullptr; + status = napi_get_named_property(env, args, "update", &updateValue); +- NAPI_ASSERT(env, status == napi_ok, "property name incorrect!"); ++ NAPI_ASSERT_BOOL(env, status == napi_ok, "property name incorrect!"); + napi_typeof(env, updateValue, &valueType); + if (valueType != napi_function) { + APP_LOGE("update param type mismatch!"); +@@ -118,7 +118,7 @@ static bool ParseBundleStatusCallback(napi_env env, + napi_ref removeCallback = nullptr; + napi_value removeValue = nullptr; + status = napi_get_named_property(env, args, "remove", &removeValue); +- NAPI_ASSERT(env, status == napi_ok, "property name incorrect!"); ++ NAPI_ASSERT_BOOL(env, status == napi_ok, "property name incorrect!"); + napi_typeof(env, removeValue, &valueType); + if (valueType != napi_function) { + APP_LOGE("remove param type mismatch!"); +diff --git a/foundation/appexecfwk/standard/kits/appkit/napi/bundlemgr/bundle_mgr.cpp b/foundation/appexecfwk/standard/kits/appkit/napi/bundlemgr/bundle_mgr.cpp +index 119fe1d1b704..3b3983140eac 100644 +--- a/foundation/appexecfwk/standard/kits/appkit/napi/bundlemgr/bundle_mgr.cpp ++++ b/foundation/appexecfwk/standard/kits/appkit/napi/bundlemgr/bundle_mgr.cpp +@@ -1393,7 +1393,7 @@ static bool ParseBundleOptions(napi_env env, BundleOptions &bundleOptions, napi_ + APP_LOGD("begin to parse bundleOptions"); + napi_status status; + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, args, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, args, &valueType)); + if (valueType != napi_object) { + APP_LOGE("args not object type"); + return false; +@@ -1413,7 +1413,7 @@ static bool ParseWant(napi_env env, Want &want, napi_value args) + APP_LOGD("begin to parse want"); + napi_status status; + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, args, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, args, &valueType)); + if (valueType != napi_object) { + APP_LOGE("args not object type"); + return false; +@@ -2611,7 +2611,7 @@ static bool ParseInstallParam(napi_env env, InstallParam &installParam, napi_val + { + napi_status status; + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, args, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, args, &valueType)); + if (valueType != napi_object) { + APP_LOGE("args type incorrect!"); + return false; +@@ -2634,7 +2634,7 @@ static bool ParseInstallParam(napi_env env, InstallParam &installParam, napi_val + } + + int userId = Constants::UNSPECIFIED_USERID; +- NAPI_CALL(env, napi_get_value_int32(env, property, &userId)); ++ NAPI_CALL_BOOL(env, napi_get_value_int32(env, property, &userId)); + if (userId < Constants::DEFAULT_USERID) { + APP_LOGE("param userId(%{public}d) is invalid.", userId); + return false; +@@ -2660,7 +2660,7 @@ static bool ParseInstallParam(napi_env env, InstallParam &installParam, napi_val + } + + int installFlag = 0; +- NAPI_CALL(env, napi_get_value_int32(env, property, &installFlag)); ++ NAPI_CALL_BOOL(env, napi_get_value_int32(env, property, &installFlag)); + installParam.installFlag = static_cast<OHOS::AppExecFwk::InstallFlag>(installFlag); + } + APP_LOGI("ParseInstallParam installFlag=%{public}d.", installParam.installFlag); +@@ -2682,7 +2682,7 @@ static bool ParseInstallParam(napi_env env, InstallParam &installParam, napi_val + } + + bool isKeepData = false; +- NAPI_CALL(env, napi_get_value_bool(env, property, &isKeepData)); ++ NAPI_CALL_BOOL(env, napi_get_value_bool(env, property, &isKeepData)); + installParam.isKeepData = isKeepData; + } + APP_LOGI("ParseInstallParam isKeepData=%{public}d.", installParam.isKeepData); +@@ -5441,7 +5441,7 @@ bool UnwrapAbilityInfo(napi_env env, napi_value param, OHOS::AppExecFwk::Ability + { + napi_status status; + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, param, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, param, &valueType)); + if (valueType != napi_object) { + APP_LOGE("param type mismatch!"); + return false; +@@ -6158,7 +6158,7 @@ void CreateInstallErrorCodeObject(napi_env env, napi_value value) + static bool ParseWant(napi_env env, AsyncExtensionInfoCallbackInfo &info, napi_value args) + { + napi_valuetype valueType; +- NAPI_CALL(env, napi_typeof(env, args, &valueType)); ++ NAPI_CALL_BOOL(env, napi_typeof(env, args, &valueType)); + if (valueType != napi_object) { + APP_LOGE("args not object type"); + return false; diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_graphic_standard.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_graphic_standard.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0f002586f228fd7ba57bccc9b9ec156609285a4 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/foundation_graphic_standard.patch @@ -0,0 +1,41 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //foundation/graphic/standard git repository of OpenHarmony 3.1 codebase. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/foundation/graphic/standard/rosen/modules/render_service_base/include/pipeline/rs_base_render_node.h b/foundation/graphic/standard/rosen/modules/render_service_base/include/pipeline/rs_base_render_node.h +index 7f162b922ecf..d795a3ce2fd8 100644 +--- a/foundation/graphic/standard/rosen/modules/render_service_base/include/pipeline/rs_base_render_node.h ++++ b/foundation/graphic/standard/rosen/modules/render_service_base/include/pipeline/rs_base_render_node.h +@@ -20,6 +20,27 @@ + + #include "common/rs_common_def.h" + ++/* Dirty workaround for the use of libcxx internal __libcpp_erase_if_container ++ * function, which is hidden newer LLVM versions. This is a copy-paste of the ++ * inline function in LLVM 10.0.0. ++ * ++ * If code is upgraded to c++20 or newer, use of __libcpp_erase_if_container ++ * should be replaced with std::erase_if() ++*/ ++namespace std { ++ template <class _Container, class _Predicate> ++ inline void __libcpp_erase_if_container(_Container& __c, _Predicate __pred) ++ { ++ for (typename _Container::iterator __iter = __c.begin(), __last = __c.end(); __iter != __last;) ++ { ++ if (__pred(*__iter)) ++ __iter = __c.erase(__iter); ++ else ++ ++__iter; ++ } ++ } ++} ++ + namespace OHOS { + namespace Rosen { + class RSContext; diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/kernel_linux_build.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/kernel_linux_build.patch new file mode 100644 index 0000000000000000000000000000000000000000..8cbfc49fc3d12d394ea72ac7e220e163e4fee564 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/kernel_linux_build.patch @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //kernel/linux/build git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-openharmony-toolchain being installed into +//oniro, configuring the codebase to use the toolchain in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/kernel/linux/build/kernel.mk b/kernel/linux/build/kernel.mk +index 56fcde79ef55..84789e66b759 100644 +--- a/kernel/linux/build/kernel.mk ++++ b/kernel/linux/build/kernel.mk +@@ -27,7 +27,7 @@ KERNEL_SRC_PATH := $(OHOS_BUILD_HOME)/kernel/linux/${KERNEL_VERSION} + KERNEL_PATCH_PATH := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION} + KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION} + PREBUILTS_GCC_DIR := $(OHOS_BUILD_HOME)/prebuilts/gcc +-CLANG_HOST_TOOLCHAIN := $(OHOS_BUILD_HOME)/prebuilts/clang/ohos/linux-x86_64/llvm/bin ++CLANG_HOST_TOOLCHAIN := $(OHOS_BUILD_HOME)/oniro/sysroots/host/usr/bin + KERNEL_HOSTCC := $(CLANG_HOST_TOOLCHAIN)/clang + KERNEL_PREBUILT_MAKE := make + diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/productdefine_common.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/productdefine_common.patch new file mode 100644 index 0000000000000000000000000000000000000000..31084b90210bc9248bf5eb4543c9174538f4da49 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/productdefine_common.patch @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //productdefine/common git repository of OpenHarmony 3.1 codebase. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/productdefine/common/products/Hi3516DV300.json b/productdefine/common/products/Hi3516DV300.json +index 5467f61ead47..44b5944ceaa5 100755 +--- a/productdefine/common/products/Hi3516DV300.json ++++ b/productdefine/common/products/Hi3516DV300.json +@@ -87,7 +87,6 @@ + "updater:update_service":{}, + "developtools:bytrace_standard":{}, + "developtools:hdc_standard":{}, +- "developtools:profiler":{}, + "developtools:hiperf":{}, + "sensors:miscdevice":{}, + "graphic:graphic_standard":{}, diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_e2fsprogs.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_e2fsprogs.patch new file mode 100644 index 0000000000000000000000000000000000000000..a8a32644da36537bb04565cb8b09201865ada80f --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_e2fsprogs.patch @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //third_party/e2fsprogs git repository of OpenHarmony 3.1 codebase. + +This integrates with the oniro-ohos-bundle being installed into +//oniro, configuring the codebase to use the toolchain in //oniro. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/third_party/e2fsprogs/resize/BUILD.gn b/third_party/e2fsprogs/resize/BUILD.gn +index 5bc9dc359310..d1323562fcd8 100755 +--- a/third_party/e2fsprogs/resize/BUILD.gn ++++ b/third_party/e2fsprogs/resize/BUILD.gn +@@ -50,7 +50,9 @@ ohos_executable("resize2fs") { + "//third_party/e2fsprogs/misc:libext2_misc", + ] + ++ if (!is_oniro_toolchain) { + ldflags = [ "-stdlib=libc++_static" ] ++ } + install_enable = true + part_name = "e2fsprogs" + install_images = [ diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_flutter.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_flutter.patch new file mode 100644 index 0000000000000000000000000000000000000000..887b287e20bb13221d56e408a34f9af79e7547a0 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_flutter.patch @@ -0,0 +1,61 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //third_party/flutter git repository of OpenHarmony 3.1 codebase. + +With Clang 14, it is not allowed to use reinterpret_cast on NULL +pointers. The simplest workaround is to use old-style cast instead. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Pending + +diff --git a/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc b/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc +index 1f1668e91751..f9afe0c6e6a7 100644 +--- a/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc ++++ b/third_party/flutter/skia/third_party/externals/sfntly/cpp/src/sfntly/table/core/cmap_table.cc +@@ -439,7 +439,7 @@ CMapTable::CMapFormat0::Builder::Builder( + } + + CMapTable::CMapFormat0::Builder::Builder(const CMapId& cmap_id) +- : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL), ++ : CMap::Builder((ReadableFontData*)(NULL), + CMapFormat::kFormat0, + cmap_id) { + } +@@ -563,7 +563,7 @@ CMapTable::CMapFormat2::Builder::Builder(WritableFontData* data, + : CMapTable::CMap::Builder(data ? down_cast<WritableFontData*>( + data->Slice(offset, data->ReadUShort( + offset + Offset::kFormat0Length))) +- : reinterpret_cast<WritableFontData*>(NULL), ++ : (WritableFontData*)(NULL), + CMapFormat::kFormat2, cmap_id) { + // TODO(arthurhsu): FIXIT: heavy lifting and leak, need fix. + } +@@ -574,7 +574,7 @@ CMapTable::CMapFormat2::Builder::Builder(ReadableFontData* data, + : CMapTable::CMap::Builder(data ? down_cast<ReadableFontData*>( + data->Slice(offset, data->ReadUShort( + offset + Offset::kFormat0Length))) +- : reinterpret_cast<ReadableFontData*>(NULL), ++ : (ReadableFontData*)(NULL), + CMapFormat::kFormat2, cmap_id) { + // TODO(arthurhsu): FIXIT: heavy lifting and leak, need fix. + } +@@ -958,7 +958,7 @@ CMapTable::CMapFormat4::Builder::Builder(WritableFontData* data, int32_t offset, + CMapTable::CMapFormat4::Builder::Builder(SegmentList* segments, + std::vector<int32_t>* glyph_id_array, + const CMapId& cmap_id) +- : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL), ++ : CMap::Builder((ReadableFontData*)(NULL), + CMapFormat::kFormat4, cmap_id), + segments_(segments->begin(), segments->end()), + glyph_id_array_(glyph_id_array->begin(), glyph_id_array->end()) { +@@ -966,7 +966,7 @@ CMapTable::CMapFormat4::Builder::Builder(SegmentList* segments, + } + + CMapTable::CMapFormat4::Builder::Builder(const CMapId& cmap_id) +- : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL), ++ : CMap::Builder((ReadableFontData*)(NULL), + CMapFormat::kFormat4, cmap_id) { + } + diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_grpc.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_grpc.patch new file mode 100644 index 0000000000000000000000000000000000000000..b52588e520da8ae03293a0817d3e29723b1346cd --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_grpc.patch @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //third_party/grpc git repository of OpenHarmony 3.1 codebase. + +Building with -Werror with both clang and gcc requires some differences in which +warnings are disabled. Some warnings in clang is not known by gcc, so we are not +allowed to disable them, and the missing-prototypes warning ins only supported +for C++ by gcc. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/third_party/grpc/BUILD.gn b/third_party/grpc/BUILD.gn +index 488986bcab42..e580e97bcac3 100755 +--- a/third_party/grpc/BUILD.gn ++++ b/third_party/grpc/BUILD.gn +@@ -43,13 +43,17 @@ config("private_grpc_config") { + "-Wno-implicit-fallthrough", + "-Wno-unused-variable", + "-Wno-ignored-qualifiers", +- "-Wno-atomic-implicit-seq-cst", + "-Wno-undef", +- "-Wno-missing-prototypes", +- "-Wno-missing-variable-declarations", + "-Wno-sign-compare", +- "-Wno-shadow-uncaptured-local", + ] ++ cflags_c = [ "-Wno-missing-prototypes" ] ++ if (is_clang) { ++ cflags += [ ++ "-Wno-shadow-uncaptured-local", ++ "-Wno-missing-variable-declarations", ++ "-Wno-atomic-implicit-seq-cst", ++ ] ++ } + } + + ohos_shared_library("gpr") { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_icu.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_icu.patch new file mode 100644 index 0000000000000000000000000000000000000000..66c735cd9641439466ddc9f9899d64f999907b3f --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_icu.patch @@ -0,0 +1,115 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //third_party/icu git repository of OpenHarmony 3.1 codebase. + +Building with -Werror with both clang and gcc requires some differences in which +warnings are disabled. Some warnings in clang is not known by gcc, and some +additional warnings are triggered by gcc, which we then need to disable as well. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/third_party/icu/icu4c/BUILD.gn b/third_party/icu/icu4c/BUILD.gn +diff --git a/icu4c/BUILD.gn b/icu4c/BUILD.gn +index e7cc92886d9e..b86358c38818 100755 +--- a/third_party/icu/icu4c/BUILD.gn ++++ b/third_party/icu/icu4c/BUILD.gn +@@ -509,10 +509,12 @@ ohos_shared_library("shared_icuuc") { + "-Wwrite-strings", + "-Wno-error=unused-parameter", + "-Wno-error=unused-const-variable", +- "-Wno-error=unneeded-internal-declaration", + "-std=c++11", + "-Wno-ignored-attributes", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-error=unneeded-internal-declaration" ] ++ } + ldflags = [ + "-shared", + "-lm", +@@ -553,11 +555,13 @@ ohos_shared_library("shared_icui18n") { + "-Wno-error=unused-parameter", + "-Wno-error=unused-const-variable", + "-Wno-error=implicit-float-conversion", +- "-Wno-error=unneeded-internal-declaration", + "-Wwrite-strings", + "-std=c++11", + "-Wno-ignored-attributes", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-error=unneeded-internal-declaration" ] ++ } + ldflags = [ + "-shared", + "-ldl", +@@ -600,11 +604,13 @@ ohos_static_library("static_icuuc") { + "-std=c++11", + "-Wno-error=unused-parameter", + "-Wno-error=unused-const-variable", +- "-Wno-error=unneeded-internal-declaration", + "-fvisibility-inlines-hidden", + "-Wno-unused-function", + "-Wno-ignored-attributes", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-error=unneeded-internal-declaration" ] ++ } + + cflags = [ + "-fvisibility=hidden", +@@ -650,12 +656,14 @@ ohos_static_library("static_icui18n") { + "-Wno-error=unused-parameter", + "-Wno-error=unused-const-variable", + "-Wno-error=implicit-float-conversion", +- "-Wno-error=unneeded-internal-declaration", + "-std=c++11", + "-fvisibility-inlines-hidden", + "-fno-exceptions", + "-Wno-ignored-attributes", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-error=unneeded-internal-declaration" ] ++ } + + if (is_mingw) { + cflags_cc += [ "-DWINVER=0x0601" ] +diff --git a/third_party/icu/icu4c/source/BUILD.gn b/third_party/icu/icu4c/source/BUILD.gn +index c93a43ef248e..de8af91f4a75 100644 +--- a/third_party/icu/icu4c/source/BUILD.gn ++++ b/third_party/icu/icu4c/source/BUILD.gn +@@ -247,11 +247,15 @@ ohos_shared_library("shared_icuuc_host") { + "-Wwrite-strings", + "-Wno-error=unused-parameter", + "-Wno-error=unused-const-variable", +- "-Wno-error=unneeded-internal-declaration", ++ "-Wno-error=stringop-overflow", ++ "-Wno-error=stringop-truncation", + "-Wignored-attributes", + "-std=c++11", + "-Wno-ignored-attributes", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-error=unneeded-internal-declaration" ] ++ } + ldflags = [ + "-shared", + "-lm", +@@ -384,10 +386,14 @@ ohos_shared_library("shared_icuio") { + "-Wwrite-strings", + "-Wno-error=unused-parameter", + "-Wno-error=unused-const-variable", +- "-Wno-error=unneeded-internal-declaration", ++ "-Wno-error=stringop-overflow", ++ "-Wno-error=stringop-truncation", + "-std=c++11", + "-Wno-ignored-attributes", + ] ++ if (is_clang) { ++ cflags_cc += [ "-Wno-error=unneeded-internal-declaration" ] ++ } + ldflags = [ + "-shared", + "-lm", diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_libevdev.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_libevdev.patch new file mode 100644 index 0000000000000000000000000000000000000000..c5dc4f0f76a0515711e50057e656fb60d6849c69 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_libevdev.patch @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //third_party/libevdev git repository of OpenHarmony 3.1 codebase. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate [configuration/integration] + +diff --git a/include/linux/linux/input.h b/include/linux/linux/input.h +index 537d23e..e58f84c 100644 +--- a/third_party/libevdev/include/linux/linux/input.h ++++ b/third_party/libevdev/include/linux/linux/input.h +@@ -15,7 +15,7 @@ + #include <sys/types.h> + #include <linux/types.h> + +-#include "input-event-codes.h" ++#include <linux/input-event-codes.h> + + /* + * The event structure itself diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_libusb.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_libusb.patch new file mode 100644 index 0000000000000000000000000000000000000000..aec8fa139c9edc138b7a6f949ab7e4b55941f8e0 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_libusb.patch @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //third_party/libusb git repository of OpenHarmony 3.1 codebase. + +Building with -Werror with both clang and gcc requires some differences in which +warnings are disabled. The pragma-pack warning in clang is not known by gcc, so we are not +allowed to disable them. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Pending + +diff --git a/third_party/libusb/BUILD.gn b/third_party/libusb/BUILD.gn +index 4a4e01bbfc55..0b0d44ff7135 100644 +--- a/third_party/libusb/BUILD.gn ++++ b/third_party/libusb/BUILD.gn +@@ -42,8 +42,10 @@ config("libusb_config") { + "-Wno-#warnings", + "-Wno-error=sign-compare", + "-Wno-error=switch", +- "-Wno-error=pragma-pack", + ] ++ if (is_clang) { ++ cflags += [ "-Wno-error=pragma-pack" ] ++ } + if (is_linux || is_ohos) { + include_dirs += [ "linux" ] + } else if (is_mingw || is_win) { diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/third_party/openssl/BUILD.gn b/recipes-openharmony/prebuilts/openharmony-3.1/third_party/openssl/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..95c806b9aa7eaef42fe4346f003a34357041ecab --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/third_party/openssl/BUILD.gn @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import("//build/ohos.gni") +import("//oniro/third_party.gni") + +ohos_prebuilt_shared_library("libcrypto") { + if (current_toolchain == host_toolchain) { + source = "//oniro/sysroots/host/usr/lib/libcrypto.so.3" + } else { + source = "//oniro/sysroots/target/usr/lib/libcrypto.so.3" + } + subsystem_name = "common" + part_name = "common" + install_enable = install_oniro_third_party + install_images = [ "system", "updater" ] +} + +ohos_prebuilt_shared_library("libssl") { + source = "//oniro/sysroots/target/usr/lib/libssl.so.3" + subsystem_name = "common" + part_name = "common" + install_enable = install_oniro_third_party + install_images = [ "system", "updater" ] +} + +# The following targets and configs wraps existing targets and configs +# to the above, so we don't need to modify other BUILD.gn files. +group("crypto_source") { + deps = [ ":libcrypto" ] +} + +group("libcrypto_static") { + deps = [ ":libcrypto" ] +} + +group("ssl_source") { + deps = [ ":libssl" ] +} + +config("ssl_config_public") { +}