diff options
Diffstat (limited to 'build-0001-add-dsoftbus-build-support-for-embedded-env.patch')
-rw-r--r-- | build-0001-add-dsoftbus-build-support-for-embedded-env.patch | 390 |
1 files changed, 390 insertions, 0 deletions
diff --git a/build-0001-add-dsoftbus-build-support-for-embedded-env.patch b/build-0001-add-dsoftbus-build-support-for-embedded-env.patch new file mode 100644 index 0000000..6eccb07 --- /dev/null +++ b/build-0001-add-dsoftbus-build-support-for-embedded-env.patch @@ -0,0 +1,390 @@ +From a7244bd742f999e7ec8462797c7e7a393a844a7b Mon Sep 17 00:00:00 2001 +From: hmilylmk <liumingkai@huawei.com> +Date: Sat, 13 Aug 2022 08:21:36 +0800 +Subject: [PATCH] add dsoftbus build support for embedded env + +Signed-off-by: hmilylmk <liumingkai@huawei.com> +--- + build_scripts/build.sh | 9 ++++---- + config/BUILDCONFIG.gn | 11 ++++----- + config/compiler/compiler.gni | 6 +---- + config/ohos/BUILD.gn | 32 +------------------------- + config/ohos/abi.gni | 5 ----- + config/ohos/config.gni | 4 ++-- + config/ohos/musl.gni | 4 +++- + core/gn/BUILD.gn | 35 ++--------------------------- + loader/preloader/platforms.template | 4 ++-- + ohos.gni | 7 ------ + subsystem_config.json | 6 +++++ + toolchain/linux/BUILD.gn | 8 +++++-- + 12 files changed, 31 insertions(+), 100 deletions(-) + +diff --git a/build_scripts/build.sh b/build_scripts/build.sh +index 3514b36..e2404ca 100755 +--- a/build_scripts/build.sh ++++ b/build_scripts/build.sh +@@ -70,22 +70,22 @@ do + shift + done + +- + if [[ "${source_root_dir}x" == "x" ]]; then + echo "Error: source_root_dir cannot be empty." + exit 1 + fi ++ + if [[ ! -d "${source_root_dir}" ]]; then + echo "Error: source_root_dir is incorrect." + exit 1 + fi ++ + if [[ "${product_name}x" == "x" ]]; then + echo -e "\033[31mError: the product name should be specified!\033[0m" + help + exit 1 + fi + +- + case $(uname -s) in + Darwin) + HOST_DIR="darwin-x86" +@@ -102,10 +102,9 @@ case $(uname -s) in + esac + + # set python3 +-PYTHON3=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.8.5/bin/python3 +- ++PYTHON3=`which python` + if [[ ! -f "${PYTHON3}" ]]; then +- echo -e "\033[33m Please execute the build/prebuilts_download.sh \033[0m" ++ echo -e "\033[33m python3 not found, please check\033[0m" + exit 1 + fi + +diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn +index 98bb98b..9e016df 100755 +--- a/config/BUILDCONFIG.gn ++++ b/config/BUILDCONFIG.gn +@@ -130,10 +130,7 @@ declare_args() { + is_desktop_linux = current_os == "linux" + + # Set to true when compiling with the Clang compiler. +- is_clang = current_os != "linux" || +- (current_cpu != "s390x" && current_cpu != "s390" && +- current_cpu != "ppc64" && current_cpu != "ppc" && +- current_cpu != "mips" && current_cpu != "mips64") ++ is_clang = false + + # Allows the path to a custom target toolchain to be injected as a single + # argument, and set as the default toolchain. +@@ -154,7 +151,7 @@ declare_args() { + } + + declare_args() { +- use_musl = true ++ use_musl = false + } + + asdk_libs_dir = "//prebuilts/asdk_libs" +@@ -220,7 +217,7 @@ if (host_toolchain == "") { + + if (host_os == "linux") { + if (target_os != "linux") { +- host_toolchain = "//build/toolchain/linux:clang_$host_cpu" ++ host_toolchain = "//build/toolchain/linux:$host_cpu" + } else if (is_clang) { + host_toolchain = "//build/toolchain/linux:clang_$host_cpu" + } else { +@@ -250,7 +247,7 @@ _default_toolchain = "" + if (target_os == "ohos") { + assert(host_os == "linux" || host_os == "mac", + "ohos builds are only supported on Linux and Mac hosts.") +- _default_toolchain = "//build/toolchain/ohos:ohos_clang_$target_cpu" ++ _default_toolchain = "//build/toolchain/linux:$target_cpu" + } else if (target_os == "linux") { + if (is_clang) { + _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" +diff --git a/config/compiler/compiler.gni b/config/compiler/compiler.gni +index b77100a..ae45cc8 100755 +--- a/config/compiler/compiler.gni ++++ b/config/compiler/compiler.gni +@@ -152,11 +152,7 @@ declare_args() { + + declare_args() { + # Whether to use the gold linker from binutils instead of lld or bfd. +- use_gold = !use_lld && +- ((is_linux && (current_cpu == "x64" || current_cpu == "x86" || +- current_cpu == "arm")) || +- (is_ohos && (current_cpu == "x86" || current_cpu == "x64" || +- current_cpu == "arm" || current_cpu == "arm64"))) ++ use_gold = false + } + + # If it wasn't manually set, set to an appropriate default. +diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn +index aa5ac7c..941cc2e 100755 +--- a/config/ohos/BUILD.gn ++++ b/config/ohos/BUILD.gn +@@ -24,31 +24,17 @@ config("compiler") { + "HAVE_SYS_UIO_H", + ] + +- defines += [ +- "__MUSL__", +- "_LIBCPP_HAS_MUSL_LIBC", +- "__BUILD_LINUX_WITH_CLANG", +- ] +- + ldflags = [ + "-Wl,--no-undefined", +- "-Wl,--exclude-libs=libunwind_llvm.a", +- "-Wl,--exclude-libs=libc++_static.a", + + # Don't allow visible symbols from libraries that contain + # assembly code with symbols that aren't hidden properly. + # http://crbug.com/448386 +- "-Wl,--exclude-libs=libvpx_assembly_arm.a", + ] + +- cflags += [ "--target=$abi_target" ] + include_dirs = [ +- "${musl_sysroot}/usr/include/${abi_target}", +- "${clang_base_path}/include/c++/v1", + ] + +- ldflags += [ "--target=$abi_target" ] +- + # Assign any flags set for the C compiler to asmflags so that they are sent + # to the assembler. + asmflags = cflags +@@ -66,13 +52,6 @@ config("runtime_library") { + "CHROMIUM_CXX_TWEAK_INLINES", # Saves binary size. + ] + +- defines += [ +- "__MUSL__", +- "_LIBCPP_HAS_MUSL_LIBC", +- "__BUILD_LINUX_WITH_CLANG", +- ] +- ldflags = [ "-nostdlib" ] +- + libs = [] + + # arm builds of libc++ starting in NDK r12 depend on unwind. +@@ -80,20 +59,11 @@ config("runtime_library") { + libs += [ "unwind" ] + } + +- ldflags += [ +- "-L" + +- rebase_path("${clang_base_path}/lib/${abi_target}/c++", root_build_dir), +- "-L" + rebase_path("${musl_sysroot}/usr/lib/${abi_target}", root_build_dir), +- "-L" + rebase_path("${clang_base_path}/lib/clang/10.0.1/lib/${abi_target}", +- root_build_dir), ++ ldflags = [ + ] +- ldflags += [ "-Wl,--dynamic-linker,/system/bin/ld-musl-${musl_arch}.so.1" ] + + libs += [ +- rebase_path(libclang_rt_file), + "c", +- "c++", +- "c++abi", + ] + + if (current_cpu == "arm" && arm_version == 6) { +diff --git a/config/ohos/abi.gni b/config/ohos/abi.gni +index 57d1dca..600bc3e 100755 +--- a/config/ohos/abi.gni ++++ b/config/ohos/abi.gni +@@ -61,8 +61,3 @@ if (target_cpu == "arm64") { + ohos_secondary_abi_cpu = "x86" + ohos_app_secondary_abi = "x86" + } +- +-if (defined(ohos_secondary_abi_cpu)) { +- ohos_secondary_abi_toolchain = +- "//build/toolchain/ohos:ohos_clang_${ohos_secondary_abi_cpu}" +-} +diff --git a/config/ohos/config.gni b/config/ohos/config.gni +index 072bce1..00c7311 100644 +--- a/config/ohos/config.gni ++++ b/config/ohos/config.gni +@@ -26,11 +26,11 @@ if (is_ohos) { + } + + if (current_cpu == "arm") { +- abi_target = "arm-linux-ohosmusl" ++ abi_target = "" + } else if (current_cpu == "x86") { + abi_target = "" + } else if (current_cpu == "arm64") { +- abi_target = "aarch64-linux-ohosmusl" ++ abi_target = "" + } else if (current_cpu == "x86_64") { + abi_target = "" + } else { +diff --git a/config/ohos/musl.gni b/config/ohos/musl.gni +index 2468ca8..f9cead9 100644 +--- a/config/ohos/musl.gni ++++ b/config/ohos/musl.gni +@@ -16,4 +16,6 @@ if (use_musl){ + musl_target = "//third_party/musl:musl_libs" + musl_sysroot = get_label_info(musl_target, "target_out_dir") + import("//third_party/musl/musl_config.gni") +-} +\ No newline at end of file ++} else { ++ musl_sysroot = "" ++} +diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn +index 38d3cc9..cde44b1 100755 +--- a/core/gn/BUILD.gn ++++ b/core/gn/BUILD.gn +@@ -86,41 +86,10 @@ if (product_name == "ohos-sdk") { + deps = [ "//build/ohos/sdk:ohos_sdk" ] + } + } else { +- group("make_all") { +- deps = [ +- ":images", +- ":make_inner_kits", +- ":packages", +- ] +- } +- + group("images") { +- deps = [ "//build/ohos/images:make_images" ] +- } +- +- group("packages") { +- deps = [ "//build/ohos/packages:make_packages" ] +- } +- +- group("make_inner_kits") { +- deps = [ "$root_build_dir/build_configs:inner_kits" ] +- } +- +- group("build_all_test_pkg") { +- testonly = true + deps = [ +- "$root_build_dir/build_configs:parts_test", +- "//test/developertest:make_temp_test", ++ "//foundation/communication/dsoftbus/core/frame:softbus_server_main", ++ "//foundation/communication/dsoftbus/sdk:softbus_client", + ] + } +- +- group("make_test") { +- testonly = true +- deps = [ ":build_all_test_pkg" ] +- deps += [ "//build/ohos/packages:package_testcase_mlf" ] +- deps += [ "//build/ohos/packages:package_testcase" ] +- if (archive_component) { +- deps += [ "//build/ohos/testfwk:archive_testcase" ] +- } +- } + } +diff --git a/loader/preloader/platforms.template b/loader/preloader/platforms.template +index 5cad64d..7577fd6 100644 +--- a/loader/preloader/platforms.template ++++ b/loader/preloader/platforms.template +@@ -4,13 +4,13 @@ + { + "target_os": "ohos", + "target_cpu": "arm64", +- "toolchain": "//build/toolchain/ohos:ohos_clang_arm64", ++ "toolchain": "//build/toolchain/linux:arm64", + "parts_config": "./parts.json" + }, + { + "target_os": "ohos", + "target_cpu": "arm", +- "toolchain": "//build/toolchain/ohos:ohos_clang_arm", ++ "toolchain": "//build/toolchain/linux:arm", + "parts_config": "./parts.json" + } + ] +diff --git a/ohos.gni b/ohos.gni +index 77be836..a34baa3 100755 +--- a/ohos.gni ++++ b/ohos.gni +@@ -11,19 +11,12 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-import("//build/config/sanitizers/sanitizers.gni") +-import("//build/ohos/ndk/ndk.gni") +-import("//build/ohos/notice/notice.gni") +-import("//build/ohos/sa_profile/sa_profile.gni") + import("//build/ohos_var.gni") + import("//build/toolchain/toolchain.gni") + + # import cxx base templates + import("//build/templates/cxx/cxx.gni") + +-import("//build/ohos/ace/ace.gni") +-import("//build/ohos/app/app.gni") +- + import("//build/templates/common/ohos_templates.gni") + + # import prebuilt templates +diff --git a/subsystem_config.json b/subsystem_config.json +index f04f29e..ebc0869 100644 +--- a/subsystem_config.json ++++ b/subsystem_config.json +@@ -178,5 +178,11 @@ + "path": "kernel/linux/build", + "name": "kernel", + "dir": "kernel/linux" ++ }, ++ "depend": { ++ "project":"openEuler/depend", ++ "path": "depend", ++ "name": "depend", ++ "dir": "depend" + } + } +diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn +index 1a4c4e9..c811cf9 100755 +--- a/toolchain/linux/BUILD.gn ++++ b/toolchain/linux/BUILD.gn +@@ -22,7 +22,8 @@ clang_toolchain("clang_arm64") { + } + + gcc_toolchain("arm64") { +- toolprefix = "aarch64-linux-gnu-" ++ tool_path = rebase_path("//toolchain/bin", root_build_dir) ++ toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-" + + cc = "${toolprefix}gcc" + cxx = "${toolprefix}g++" +@@ -31,6 +32,7 @@ gcc_toolchain("arm64") { + ld = cxx + readelf = "${toolprefix}readelf" + nm = "${toolprefix}nm" ++ strip = "${toolprefix}strip" + + toolchain_args = { + current_cpu = "arm64" +@@ -40,7 +42,8 @@ gcc_toolchain("arm64") { + } + + gcc_toolchain("arm") { +- toolprefix = "arm-linux-gnueabihf-" ++ tool_path = rebase_path("//toolchain/bin", root_build_dir) ++ toolprefix = "${tool_path}/arm-openeuler-linux-gnu-" + + cc = "${toolprefix}gcc" + cxx = "${toolprefix}g++" +@@ -49,6 +52,7 @@ gcc_toolchain("arm") { + ld = cxx + readelf = "${toolprefix}readelf" + nm = "${toolprefix}nm" ++ strip = "${toolprefix}strip" + + toolchain_args = { + current_cpu = "arm" +-- +2.34.1 + |