From 02a3c422ca85b9f9afa77cb76c90c75fc384964e Mon Sep 17 00:00:00 2001 From: Thierry Escande <thierry.escande@huawei.com> Date: Fri, 22 Apr 2022 15:32:01 +0200 Subject: [PATCH] standard-system-coponents: Use HDC from OpenHarmony 3.1 This updates the git revision for the HDC daemon tool to the latest 3.1 release version. The hdc client tool doesn't compile on the OpenHarmony 3.0 LTS revision so we use the 3.1 for both client and daemon parts. This can be seen as the first step towards the 3.1 sources upgrade. This comes with a modified BUILD.gn (mainly the one from the 3.0 source tree with a few fixes) and the ohos.build file that is no more used in the 3.1 tree. Signed-off-by: Thierry Escande <thierry.escande@huawei.com> --- .../hdc-build-system-files.patch | 238 ++++++++++++++++++ .../openharmony-standard-sources-3.0.inc | 2 +- .../openharmony/openharmony-standard_3.0.bb | 2 + 3 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 recipes-openharmony/openharmony/openharmony-standard-3.0/hdc-build-system-files.patch diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/hdc-build-system-files.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/hdc-build-system-files.patch new file mode 100644 index 00000000..2c763510 --- /dev/null +++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/hdc-build-system-files.patch @@ -0,0 +1,238 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +This change fixes the BUILD.gn file in order to build the v3.1 hdcd +revision in the OpenHarmony v3.0 LTS source tree. This also adds the +ohos.build file that is no more used in 3.1. + +Apply to developtools/hdc_standard + +Signed-off-by: Thierry Escande <thierry.escande@huawei.com> +Upstream-Status: Inappropriate + +diff --git a/BUILD.gn b/BUILD.gn +index b2c1cfb..8f2da62 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -13,7 +13,6 @@ + + import("//build/ohos.gni") + HDC_PATH = "//developtools/hdc_standard" +-import("//developtools/hdc_standard/hdc.gni") + + hdc_common_sources = [ + "${HDC_PATH}/src/common/async_cmd.cpp", +@@ -30,20 +29,13 @@ hdc_common_sources = [ + "${HDC_PATH}/src/common/transfer.cpp", + "${HDC_PATH}/src/common/usb.cpp", + ] +-if (hdc_support_uart) { +- hdc_common_sources += [ "${HDC_PATH}/src/common/uart.cpp" ] +-} ++ + config("hdc_config") { + include_dirs = [ "${HDC_PATH}/src/common" ] +- cflags_cc = [ "-std=c++17" ] +- if (is_mingw) { +- cflags_cc += [ "-Wno-inconsistent-dllimport" ] # in mingw some sec api will +- # overwrite by utilsecurec +- } ++ cflags_cc = [ "-std=c++17", "-Wno-deprecated-declarations" ] + } + + ohos_executable("hdcd") { +- use_exceptions = true + sources = [ + "src/daemon/daemon.cpp", + "src/daemon/daemon_app.cpp", +@@ -60,16 +52,6 @@ ohos_executable("hdcd") { + + defines = [ "HARMONY_PROJECT" ] + +- if (hdc_debug) { +- defines += [ "HDC_DEBUG" ] +- } +- if (hdc_support_uart) { +- defines += [ "HDC_SUPPORT_UART" ] +- sources += [ "src/daemon/daemon_uart.cpp" ] +- } +- if (js_jdwp_connect) { +- defines += [ "JS_JDWP_CONNECT" ] +- } + configs = [ ":hdc_config" ] + + deps = [ +@@ -78,17 +60,12 @@ ohos_executable("hdcd") { + "//third_party/openssl:libcrypto_static", + "//utils/native/base:utils", + ] +- +- if (hdc_jdwp_test) { +- defines += [ "SIMULATE_JDWP" ] +- deps += [ "${HDC_PATH}/src/test/jdwp:jdwp_test" ] ++ if (use_musl) { ++ deps += [ ++ "//base/startup/init_lite/interfaces/innerkits/reboot:libreboot", ++ "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara", ++ ] + } +- +- external_deps = [ +- "init:libbegetutil", +- "startup_l2:syspara", +- ] +- + include_dirs = [ + "${HDC_PATH}/daemon", + "//utils/native/base/include", +@@ -96,51 +73,36 @@ ohos_executable("hdcd") { + "//third_party/openssl/include", + "//third_party/libuv", + ] +- install_images = [ +- "system", +- "updater", +- ] +- ++ if (use_musl) { ++ include_dirs += [ ++ "//base/startup/init_lite/interfaces/innerkits/include", ++ "//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include", ++ ] ++ } + install_enable = true + subsystem_name = "developtools" + part_name = "hdc_standard" + } + + ohos_executable("hdc_std") { +- use_exceptions = true +- ldflags = [] +- libs = [] + configs = [ ":hdc_config" ] + defines = [ +- "HDC_HOST", + "HARMONY_PROJECT", + ] + if (is_mac) { + defines += [ "HOST_MAC" ] + } +- if (hdc_debug) { +- defines += [ "HDC_DEBUG" ] +- } ++ cflags_cc = [ ++ "-Wno-error", ++ "-Wno-error=unused-variable", ++ "-Wno-unused-variable", ++ ] + sources = [ +- "src/host/client.cpp", +- "src/host/host_app.cpp", +- "src/host/host_forward.cpp", +- "src/host/host_tcp.cpp", +- "src/host/host_unity.cpp", +- "src/host/host_usb.cpp", + "src/host/main.cpp", +- "src/host/server.cpp", +- "src/host/server_for_client.cpp", +- "src/host/translate.cpp", + ] + sources += hdc_common_sources +- if (hdc_support_uart) { +- defines += [ "HDC_SUPPORT_UART" ] +- sources += [ "src/host/host_uart.cpp" ] +- } + + deps = [ +- "//third_party/libusb:libusb", + "//third_party/libuv:uv_static", + "//third_party/lz4:liblz4_static", + "//third_party/openssl:libcrypto_static", +@@ -154,34 +116,6 @@ ohos_executable("hdc_std") { + "//third_party/openssl/include", + "//third_party/libuv", + ] +- +- if (is_mingw) { +- static_link = false +- +- # we should use something we define , not just _WIN32 (this will defined in some windows header) +- defines += [ "HOST_MINGW" ] # we define this for mingw +- defines += [ "WIN32_LEAN_AND_MEAN" ] +- libs += [ "setupapi" ] +- ldflags += [ +- "-Wl,--whole-archive", +- "-lpthread", +- "-Wl,--no-whole-archive", +- ] +- } +- +- if (is_linux) { +- static_link = false +- defines += [ "HOST_LINUX" ] +- ldflags += [ +- "-Wl,--whole-archive", +- "-lpthread", +- "-latomic", +- "-ldl", +- "-lrt", +- "-Wl,--no-whole-archive", +- ] +- } +- + subsystem_name = "developtools" + part_name = "hdc_standard" + } +@@ -192,35 +126,3 @@ group("hdc_target_standard") { + ":hdcd", + ] + } +- +-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)" ] +-} +- +-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", +- ] +-} +- +-group("hdc_all") { +- testonly = true +- deps = [ +- ":hdc_target_standard_all", +- "test:HdcJdwpTest", +- "test:hdc_unittest", +- ] +-} +diff --git a/ohos.build b/ohos.build +new file mode 100644 +index 0000000..7d99b6f +--- /dev/null ++++ b/ohos.build +@@ -0,0 +1,10 @@ ++{ ++ "subsystem": "developtools", ++ "parts": { ++ "hdc_standard": { ++ "module_list": [ ++ "//developtools/hdc_standard:hdcd" ++ ] ++ } ++ } ++} diff --git a/recipes-openharmony/openharmony/openharmony-standard-sources-3.0.inc b/recipes-openharmony/openharmony/openharmony-standard-sources-3.0.inc index e15875d0..9ab223a8 100644 --- a/recipes-openharmony/openharmony/openharmony-standard-sources-3.0.inc +++ b/recipes-openharmony/openharmony/openharmony-standard-sources-3.0.inc @@ -60,7 +60,7 @@ SRC_URI += "${GITEE_URL}/update_updater.git;protocol=https;branch=OpenHarmony-3. SRC_URI += "${GITEE_URL}/update_updateservice.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=593ca7b5e2b1288b808ef49790214c393a330f41;destsuffix=${OH_SRCDIR}/base/update/updateservice" SRC_URI += "${GITEE_URL}/build.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=fae45dcbe24118d596578fd1936007b9d299a443;destsuffix=${OH_SRCDIR}/build" SRC_URI += "${GITEE_URL}/developtools_bytrace_standard.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=b83852080c7d68e13b013deda64b3dab69554080;destsuffix=${OH_SRCDIR}/developtools/bytrace_standard" -SRC_URI += "${GITEE_URL}/developtools_hdc_standard.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=8a154c52d793790c19260c38acb87124684141f3;destsuffix=${OH_SRCDIR}/developtools/hdc_standard" +SRC_URI += "${GITEE_URL}/developtools_hdc_standard.git;protocol=https;branch=OpenHarmony-3.1-Release;rev=5304e6ff48d783362d577b8cf1fb1b34e3e451d4;destsuffix=${OH_SRCDIR}/developtools/hdc_standard" SRC_URI += "${GITEE_URL}/developtools_profiler.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=2d75f87399240e900bdfc5b57f7abe6a72c4f6d1;destsuffix=${OH_SRCDIR}/developtools/profiler;lfs=0" SRC_URI += "${GITEE_URL}/device_qemu.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=00bf590c9d04ee5af641ccff7e8a02eb6ff727e0;destsuffix=${OH_SRCDIR}/device/qemu" SRC_URI += "${GITEE_URL}/drivers_adapter.git;protocol=https;branch=OpenHarmony-3.0-LTS;rev=9f6cd92cfa61cae193328e53577899f51d5b5fca;destsuffix=${OH_SRCDIR}/drivers/adapter" diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb index 21c63b8b..45d88fcf 100644 --- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb +++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb @@ -47,6 +47,8 @@ SRC_URI += "file://ts2abc-don-t-set-node_path-for-Linux-host-toolchain.patch;pat #SRC_URI += "file://ts2abc_host-toolchain.patch;patchdir=${S}/ark/ts2abc" #SRC_URI += "file://hc-gen-compiler.patch;patchdir=${S}/drivers/framework" +SRC_URI += "file://hdc-build-system-files.patch;patchdir=${S}/developtools/hdc_standard" + SRC_URI += "file://vendor-qemu-uhdf-files.patch;patchdir=${S}/drivers/peripheral" # TODO: Get this merged into OpenHarmony upstream or split into separate git # repository -- GitLab