diff --git a/0001-feat-Adapt-to-Openeuler-python-export-lld.patch b/0001-feat-Adapt-to-Openeuler-python-export-lld.patch new file mode 100644 index 0000000000000000000000000000000000000000..eadd3b2cf593d6835edcb074ffa98100accab017 --- /dev/null +++ b/0001-feat-Adapt-to-Openeuler-python-export-lld.patch @@ -0,0 +1,64 @@ +From e7e22adf4bc5b176e68a42298e478a353e664812 Mon Sep 17 00:00:00 2001 +From: peng_langyuan +Date: Thu, 18 May 2023 16:10:29 +0800 +Subject: [PATCH 01/11] =?UTF-8?q?feat(Adapt=20to=20Openeuler):=E6=9B=BF?= + =?UTF-8?q?=E6=8D=A2python=E8=B7=AF=E5=BE=84=20&&=20export=20lld=E8=B7=AF?= + =?UTF-8?q?=E5=BE=84?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + build_scripts/build.sh | 25 ++++++++++++++++++++++--- + 1 file changed, 22 insertions(+), 3 deletions(-) + +diff --git a/build_scripts/build.sh b/build_scripts/build.sh +index cd2ab20..51f2e5e 100755 +--- a/build_scripts/build.sh ++++ b/build_scripts/build.sh +@@ -109,8 +109,27 @@ case $(uname -s) in + exit $RET + esac + ++args=$@ ++while test $# -gt 0 ++do ++ case "$1" in --product-name) ++ shift ++ product_name=$1 ++ ;; ++ *) ++ shift ++ ;; ++ esac ++done ++ + # set python3 +-PYTHON3_DIR=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.9.2/ ++if [ "$product_name" == "openeuler" ]; then ++ PYTHON3_DIR=/usr ++ LLD_PATH=/usr/lib64/llvm15/bin ++else ++ PYTHON3_DIR=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.9.2/ ++ LLD_PATH="" ++fi + PYTHON3=${PYTHON3_DIR}/bin/python3 + PYTHON=${PYTHON3_DIR}/bin/python + if [[ ! -f "${PYTHON3}" ]]; then +@@ -122,11 +141,11 @@ else + fi + fi + +-export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:$PATH ++export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:${LLD_PATH}:$PATH + + ${PYTHON3} ${source_root_dir}/build/scripts/tools_checker.py + +-${PYTHON3} ${source_root_dir}/build/scripts/entry.py --source-root-dir ${source_root_dir} $@ ++${PYTHON3} ${source_root_dir}/build/scripts/entry.py --source-root-dir ${source_root_dir} $args + + if [[ "$?" -ne 0 ]]; then + echo -e "\033[31m=====build ${product_name} error=====\033[0m" +-- +2.33.0 + diff --git a/0002-feat-Adapt-to-Openeuler-for-compilation.patch b/0002-feat-Adapt-to-Openeuler-for-compilation.patch new file mode 100644 index 0000000000000000000000000000000000000000..76779df03a0a2ac6965652c37c15592673367d84 --- /dev/null +++ b/0002-feat-Adapt-to-Openeuler-for-compilation.patch @@ -0,0 +1,681 @@ +From 01b899f9d73acccd7c44d1c2e049ad63a0a312d6 Mon Sep 17 00:00:00 2001 +From: peng_langyuan +Date: Thu, 18 May 2023 16:11:43 +0800 +Subject: [PATCH 02/11] =?UTF-8?q?feat(Adapt=20to=20Openeuler):=E7=BC=96?= + =?UTF-8?q?=E8=AF=91=E7=9B=B8=E5=85=B3?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + config/BUILDCONFIG.gn | 45 ++++- + config/compiler/compiler.gni | 3 +- + config/ohos/BUILD.gn | 3 + + core/gn/BUILD.gn | 14 +- + ohos/images/BUILD.gn | 325 ++++++++++++++++++----------------- + ohos/packages/BUILD.gn | 12 +- + ohos_var.gni | 14 ++ + templates/cxx/cxx.gni | 48 ++++-- + 8 files changed, 275 insertions(+), 189 deletions(-) + +diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn +index ff1319b..ffff773 100755 +--- a/config/BUILDCONFIG.gn ++++ b/config/BUILDCONFIG.gn +@@ -64,6 +64,20 @@ declare_args() { + device_name = "" + } + ++declare_args() { ++ if (product_name == "openeuler") { ++ build_openeuler = true ++ } else { ++ build_openeuler = false ++ } ++} ++ ++declare_args() { ++ if (defined(build_openeuler) && build_openeuler && !defined(product_path)) { ++ product_path = "" ++ } ++} ++ + declare_args() { + preloader_output_dir = "//out/preloader/${product_name}" + } +@@ -232,10 +246,14 @@ 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") ++ if (defined(build_openeuler) && build_openeuler) { ++ is_clang = true ++ } else { ++ is_clang = current_os != "linux" || ++ (current_cpu != "s390x" && current_cpu != "s390" && ++ current_cpu != "ppc64" && current_cpu != "ppc" && ++ current_cpu != "mips" && current_cpu != "mips64") ++ } + + # Allows the path to a custom target toolchain to be injected as a single + # argument, and set as the default toolchain. +@@ -256,7 +274,11 @@ declare_args() { + } + + declare_args() { +- use_musl = true ++ if (defined(build_openeuler) && build_openeuler) { ++ use_musl = false ++ } else { ++ use_musl = true ++ } + } + + declare_args() { +@@ -309,6 +331,9 @@ declare_args() { + } else { + full_mini_debug = true + } ++ if (build_openeuler) { ++ full_mini_debug = false ++ } + } + + declare_args() { +@@ -604,6 +629,11 @@ if (is_standard_system) { + "//build/config/clang:extra_warnings", + ] + } ++ if (build_openeuler) { ++ default_compiler_configs += [ ++ "//build/openeuler:openeuler_include_dirs", ++ ] ++ } + + # Debug/release-related defines. + if (is_debug) { +@@ -612,6 +642,11 @@ if (is_standard_system) { + default_compiler_configs += [ "//build/config:release" ] + } + ++ if (build_openeuler) { ++ default_compiler_configs += [ ++ "//build/openeuler:openeuler_config", ++ ] ++ } + # Static libraries and source sets use only the compiler ones. + default_static_library_configs = default_compiler_configs + default_source_set_configs = default_compiler_configs +diff --git a/config/compiler/compiler.gni b/config/compiler/compiler.gni +index 254e744..d3e4a3f 100755 +--- a/config/compiler/compiler.gni ++++ b/config/compiler/compiler.gni +@@ -147,7 +147,8 @@ declare_args() { + use_lld = is_clang && + (is_win || (use_thin_lto && target_os != "chromeos") || + (is_linux && current_cpu == "x64" && target_os != "chromeos") || +- (is_ohos && (current_cpu != "arm" || arm_version >= 7))) ++ (is_ohos && (current_cpu != "arm" || arm_version >= 7)) || ++ (is_linux && current_cpu == "arm64")) + } + + declare_args() { +diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn +index f177a03..a41763d 100755 +--- a/config/ohos/BUILD.gn ++++ b/config/ohos/BUILD.gn +@@ -43,6 +43,9 @@ config("compiler") { + + cflags += [ "--target=$abi_target" ] + include_dirs = [ "${musl_sysroot}/usr/include/${abi_target}" ] ++ if (build_openeuler) { ++ include_dirs += [ "//build/openeuler/compiler_include" ] ++ } + + ldflags += [ "--target=$abi_target" ] + +diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn +index abec57e..e87d50d 100755 +--- a/core/gn/BUILD.gn ++++ b/core/gn/BUILD.gn +@@ -56,10 +56,16 @@ if (product_name == "ohos-sdk") { + + group("build_all_test_pkg") { + testonly = true +- deps = [ +- "$root_build_dir/build_configs:parts_test", +- "//test/testfwk/developer_test:make_temp_test", +- ] ++ if (build_openeuler) { ++ deps = [ ++ "$root_build_dir/build_configs:parts_test", ++ ] ++ } else { ++ deps = [ ++ "$root_build_dir/build_configs:parts_test", ++ "//test/testfwk/developer_test:make_temp_test", ++ ] ++ } + } + + group("make_test") { +diff --git a/ohos/images/BUILD.gn b/ohos/images/BUILD.gn +index 7b0d11f..ae509ea 100644 +--- a/ohos/images/BUILD.gn ++++ b/ohos/images/BUILD.gn +@@ -17,188 +17,195 @@ import("//build/ohos/build_var.gni") + + # import target_platform_list + import("${build_configs_path}/platforms_list.gni") +-group("make_images") { +- deps = [] +- if (is_standard_system) { +- deps = [ +- "//third_party/e2fsprogs:e2fsprogs_host_toolchain", +- "//third_party/f2fs-tools:f2fs-tools_host_toolchain", +- ] +- foreach(_platform, target_platform_list) { +- deps += [ +- ":${_platform}_sys_prod_image", +- ":${_platform}_system_image", +- ":${_platform}_userdata_image", +- ":${_platform}_vendor_image", ++ ++if (build_openeuler) { ++ group("make_images") { ++ deps = [] ++ if (is_standard_system) { ++ foreach(_platform, target_platform_list) { ++ deps += [ ++ "//build/ohos/packages:${_platform}_install_modules" ++ ] ++ } ++ } ++ } ++} else { ++ group("make_images") { ++ deps = [] ++ if (is_standard_system) { ++ deps = [ ++ "//third_party/e2fsprogs:e2fsprogs_host_toolchain", ++ "//third_party/f2fs-tools:f2fs-tools_host_toolchain", + ] +- if (enable_ramdisk) { ++ foreach(_platform, target_platform_list) { + deps += [ +- ":${_platform}_ramdisk_image", +- ":${_platform}_updater_ramdisk_image", ++ ":${_platform}_sys_prod_image", ++ ":${_platform}_system_image", ++ ":${_platform}_userdata_image", ++ ":${_platform}_vendor_image", + ] +- } else { +- deps += [ ":${_platform}_updater_image" ] ++ if (enable_ramdisk) { ++ deps += [ ++ ":${_platform}_ramdisk_image", ++ ":${_platform}_updater_ramdisk_image", ++ ] ++ } else { ++ deps += [ ":${_platform}_updater_image" ] ++ } + } ++ deps += [ ":chip_prod_image" ] ++ } else { ++ deps += [ "//build/ohos/packages:packer" ] + } +- deps += [ ":chip_prod_image" ] +- } else { +- deps += [ "//build/ohos/packages:packer" ] + } +-} + +-group("chip_prod_image") { +- deps = [] +- if (is_standard_system) { +- deps += [ +- "//third_party/e2fsprogs:e2fsprogs_host_toolchain", +- "//third_party/f2fs-tools:f2fs-tools_host_toolchain", +- ] +- } +- foreach(_platform, target_platform_list) { +- if (chip_product_list == []) { +- deps += [ ":${_platform}_chip_prod_image" ] +- } else { +- foreach(_product, chip_product_list) { +- deps += [ ":${_platform}_${_product}_chip_prod_image" ] ++ group("chip_prod_image") { ++ deps = [] ++ if (is_standard_system) { ++ deps += [ ++ "//third_party/e2fsprogs:e2fsprogs_host_toolchain", ++ "//third_party/f2fs-tools:f2fs-tools_host_toolchain", ++ ] ++ } ++ foreach(_platform, target_platform_list) { ++ if (chip_product_list == []) { ++ deps += [ ":${_platform}_chip_prod_image" ] ++ } else { ++ foreach(_product, chip_product_list) { ++ deps += [ ":${_platform}_${_product}_chip_prod_image" ] ++ } + } + } + } +-} +- +-build_image_tools_path = [ +- "//out/${device_name}/clang_x64/thirdparty/e2fsprogs", +- "//out/${device_name}/clang_x64/thirdparty/f2fs_tools", +- "//third_party/e2fsprogs/prebuilt/host/bin", +- "//build/ohos/images/mkimage", +-] + +-foreach(_platform, target_platform_list) { +- current_platform = _platform +- current_platform_dir = "${product_output_dir}/$current_platform" ++ foreach(_platform, target_platform_list) { ++ current_platform = _platform ++ current_platform_dir = "${product_output_dir}/$current_platform" + +- system_module_info_list = "${current_platform_dir}/system_module_info.json" +- system_modules_list = "${current_platform_dir}/system_modules_list.txt" ++ system_module_info_list = "${current_platform_dir}/system_module_info.json" ++ system_modules_list = "${current_platform_dir}/system_modules_list.txt" + +- image_list = [ +- "system", +- "vendor", +- "userdata", +- "sys_prod", +- "chip_prod", +- ] +- if (enable_ramdisk) { +- image_list += [ +- "ramdisk", +- "updater_ramdisk", ++ image_list = [ ++ "system", ++ "vendor", ++ "userdata", ++ "sys_prod", ++ "chip_prod", + ] +- } else { +- image_list += [ "updater" ] +- } +- foreach(_image_name, image_list) { +- action_with_pydeps("${_platform}_${_image_name}_image") { +- script = "//build/ohos/images/build_image.py" +- depfile = "$target_gen_dir/$target_name.d" +- deps = [ "//build/ohos/packages:${_platform}_install_modules" ] +- if (!asan_detector) { +- deps += [ "//build/ohos/packages:high_privilege_process_validate" ] +- } ++ if (enable_ramdisk) { ++ image_list += [ ++ "ramdisk", ++ "updater_ramdisk", ++ ] ++ } else { ++ image_list += [ "updater" ] ++ } ++ foreach(_image_name, image_list) { ++ action_with_pydeps("${_platform}_${_image_name}_image") { ++ script = "//build/ohos/images/build_image.py" ++ depfile = "$target_gen_dir/$target_name.d" ++ deps = [ "//build/ohos/packages:${_platform}_install_modules" ] ++ if (!asan_detector) { ++ deps += [ "//build/ohos/packages:high_privilege_process_validate" ] ++ } + +- image_config_file = +- "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" +- if (is_debug) { + image_config_file = +- "//build/ohos/images/mkimage/debug/${_image_name}_image_conf.txt" +- } +- device_image_config_file = +- "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" +- if (_image_name == "ramdisk" || _image_name == "updater_ramdisk") { +- output_image_file = "$root_build_dir/${_image_name}.img" +- } else { +- output_image_file = "$current_platform_dir/images/${_image_name}.img" +- } +- if (_image_name == "updater_ramdisk") { +- image_input_path = "$current_platform_dir/updater" +- } else { +- image_input_path = "$current_platform_dir/${_image_name}" +- } +- if (_image_name == "userdata") { +- image_input_path = "$current_platform_dir/data" +- } ++ "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" ++ if (is_debug) { ++ image_config_file = ++ "//build/ohos/images/mkimage/debug/${_image_name}_image_conf.txt" ++ } ++ device_image_config_file = ++ "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" ++ if (_image_name == "ramdisk" || _image_name == "updater_ramdisk") { ++ output_image_file = "$root_build_dir/${_image_name}.img" ++ } else { ++ output_image_file = "$current_platform_dir/images/${_image_name}.img" ++ } ++ if (_image_name == "updater_ramdisk") { ++ image_input_path = "$current_platform_dir/updater" ++ } else { ++ image_input_path = "$current_platform_dir/${_image_name}" ++ } ++ if (_image_name == "userdata") { ++ image_input_path = "$current_platform_dir/data" ++ } + +- sources = [ +- image_config_file, +- system_module_info_list, +- system_modules_list, +- ] +- outputs = [ output_image_file ] +- args = [ +- "--depfile", +- rebase_path(depfile, root_build_dir), +- "--image-name", +- _image_name, +- "--input-path", +- rebase_path(image_input_path, root_build_dir), +- "--image-config-file", +- rebase_path(image_config_file, root_build_dir), +- "--device-image-config-file", +- rebase_path(device_image_config_file, root_build_dir), +- "--output-image", +- rebase_path(output_image_file, root_build_dir), +- "--target-cpu", +- target_cpu, +- "--build-image-tools-path", +- ] +- args += rebase_path(build_image_tools_path, root_build_dir) +- if (sparse_image) { +- args += [ "--sparse-image" ] ++ sources = [ ++ image_config_file, ++ system_module_info_list, ++ system_modules_list, ++ ] ++ outputs = [ output_image_file ] ++ args = [ ++ "--depfile", ++ rebase_path(depfile, root_build_dir), ++ "--image-name", ++ _image_name, ++ "--input-path", ++ rebase_path(image_input_path, root_build_dir), ++ "--image-config-file", ++ rebase_path(image_config_file, root_build_dir), ++ "--device-image-config-file", ++ rebase_path(device_image_config_file, root_build_dir), ++ "--output-image", ++ rebase_path(output_image_file, root_build_dir), ++ "--target-cpu", ++ target_cpu, ++ "--build-image-tools-path", ++ ] ++ args += rebase_path(build_image_tools_path, root_build_dir) ++ if (sparse_image) { ++ args += [ "--sparse-image" ] ++ } + } + } +- } + +- # Used to generate chip_prod images of different products +- foreach(_product, chip_product_list) { +- _image_name = "chip_prod" +- action_with_pydeps("${_platform}_${_product}_chip_prod_image") { +- script = "//build/ohos/images/build_image.py" +- depfile = "$target_gen_dir/$target_name.d" +- deps = [ "//build/ohos/packages:${_platform}_install_modules" ] ++ # Used to generate chip_prod images of different products ++ foreach(_product, chip_product_list) { ++ _image_name = "chip_prod" ++ action_with_pydeps("${_platform}_${_product}_chip_prod_image") { ++ script = "//build/ohos/images/build_image.py" ++ depfile = "$target_gen_dir/$target_name.d" ++ deps = [ "//build/ohos/packages:${_platform}_install_modules" ] + +- image_config_file = +- "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" +- device_image_config_file = +- "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" +- image_input_path = "${current_platform_dir}/${_image_name}/${_product}" +- output_image_file = +- "${current_platform_dir}/images/${_product}/${_image_name}.img" ++ image_config_file = ++ "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" ++ device_image_config_file = ++ "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" ++ image_input_path = "${current_platform_dir}/${_image_name}/${_product}" ++ output_image_file = ++ "${current_platform_dir}/images/${_product}/${_image_name}.img" + +- sources = [ +- image_config_file, +- system_module_info_list, +- system_modules_list, +- ] +- outputs = [ output_image_file ] ++ sources = [ ++ image_config_file, ++ system_module_info_list, ++ system_modules_list, ++ ] ++ outputs = [ output_image_file ] + +- args = [ +- "--depfile", +- rebase_path(depfile, root_build_dir), +- "--image-name", +- _image_name, +- "--input-path", +- rebase_path(image_input_path, root_build_dir), +- "--image-config-file", +- rebase_path(image_config_file, root_build_dir), +- "--device-image-config-file", +- rebase_path(device_image_config_file, root_build_dir), +- "--output-image", +- rebase_path(output_image_file, root_build_dir), +- "--target-cpu", +- target_cpu, +- "--build-image-tools-path", +- ] +- args += rebase_path(build_image_tools_path, root_build_dir) +- if (sparse_image) { +- args += [ "--sparse-image" ] ++ args = [ ++ "--depfile", ++ rebase_path(depfile, root_build_dir), ++ "--image-name", ++ _image_name, ++ "--input-path", ++ rebase_path(image_input_path, root_build_dir), ++ "--image-config-file", ++ rebase_path(image_config_file, root_build_dir), ++ "--device-image-config-file", ++ rebase_path(device_image_config_file, root_build_dir), ++ "--output-image", ++ rebase_path(output_image_file, root_build_dir), ++ "--target-cpu", ++ target_cpu, ++ "--build-image-tools-path", ++ ] ++ args += rebase_path(build_image_tools_path, root_build_dir) ++ if (sparse_image) { ++ args += [ "--sparse-image" ] ++ } + } + } + } +-} +\ No newline at end of file ++} +diff --git a/ohos/packages/BUILD.gn b/ohos/packages/BUILD.gn +index 4915b62..847d2e8 100755 +--- a/ohos/packages/BUILD.gn ++++ b/ohos/packages/BUILD.gn +@@ -591,8 +591,12 @@ group("package_testcase") { + + group("build_all_test_pkg") { + testonly = true +- deps = [ +- "$root_build_dir/build_configs:parts_test", +- "//test/testfwk/developer_test:make_temp_test", +- ] ++ if (build_openeuler) { ++ deps = [] ++ } else { ++ deps = [ ++ "$root_build_dir/build_configs:parts_test", ++ "//test/testfwk/developer_test:make_temp_test", ++ ] ++ } + } +diff --git a/ohos_var.gni b/ohos_var.gni +index b49d97e..0ba4b70 100755 +--- a/ohos_var.gni ++++ b/ohos_var.gni +@@ -151,6 +151,20 @@ declare_args() { + load_test_config = true + } + ++if (build_openeuler) { ++ load_test_config = false ++} ++ ++declare_args() { ++ # hiviewdfx ++ enable_hiviewdfx_hisysevent = false ++ enable_hiviewdfx_hitrace = false ++ enable_hiviewdfx_hidumper = false ++ ++ # security ++ enable_security_accesstoken = false ++} ++ + declare_args() { + # Skip module_info generation when the packaging image is not needed + skip_gen_module_info = false +diff --git a/templates/cxx/cxx.gni b/templates/cxx/cxx.gni +index b2e4554..1c82f82 100755 +--- a/templates/cxx/cxx.gni ++++ b/templates/cxx/cxx.gni +@@ -105,9 +105,11 @@ template("ohos_executable") { + ]) + } + +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) ++ if (defined(build_openeuler) && !build_openeuler) { ++ _sanitize_config_target = "${target_name}__sanitizer_config" ++ ohos_sanitizer_config(_sanitize_config_target) { ++ forward_variables_from(invoker, [ "sanitize" ]) ++ } + } + + _test_target = defined(invoker.testonly) && invoker.testonly +@@ -159,7 +161,9 @@ template("ohos_executable") { + if (defined(invoker.remove_configs)) { + configs -= invoker.remove_configs + } +- configs += [ ":$_sanitize_config_target" ] ++ if (defined(build_openeuler) && !build_openeuler) { ++ configs += [ ":$_sanitize_config_target" ] ++ } + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +@@ -423,9 +427,11 @@ template("ohos_shared_library") { + ]) + } + +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) ++ if (defined(build_openeuler) && !build_openeuler) { ++ _sanitize_config_target = "${target_name}__sanitizer_config" ++ ohos_sanitizer_config(_sanitize_config_target) { ++ forward_variables_from(invoker, [ "sanitize" ]) ++ } + } + + _test_target = defined(invoker.testonly) && invoker.testonly +@@ -488,7 +494,9 @@ template("ohos_shared_library") { + configs -= invoker.remove_configs + } + +- configs += [ ":$_sanitize_config_target" ] ++ if (defined(build_openeuler) && !build_openeuler) { ++ configs += [ ":$_sanitize_config_target" ] ++ } + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +@@ -763,9 +771,11 @@ template("ohos_static_library") { + ]) + } + +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) ++ if (defined(build_openeuler) && !build_openeuler) { ++ _sanitize_config_target = "${target_name}__sanitizer_config" ++ ohos_sanitizer_config(_sanitize_config_target) { ++ forward_variables_from(invoker, [ "sanitize" ]) ++ } + } + + _test_target = defined(invoker.testonly) && invoker.testonly +@@ -811,7 +821,9 @@ template("ohos_static_library") { + if (is_standard_system) { + configs -= [ "//build/config/compiler:thin_archive" ] + } +- configs += [ ":$_sanitize_config_target" ] ++ if (defined(build_openeuler) && !build_openeuler) { ++ configs += [ ":$_sanitize_config_target" ] ++ } + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +@@ -935,9 +947,11 @@ template("ohos_source_set") { + ]) + } + +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) ++ if (defined(build_openeuler) && !build_openeuler) { ++ _sanitize_config_target = "${target_name}__sanitizer_config" ++ ohos_sanitizer_config(_sanitize_config_target) { ++ forward_variables_from(invoker, [ "sanitize" ]) ++ } + } + + _test_target = defined(invoker.testonly) && invoker.testonly +@@ -982,7 +996,9 @@ template("ohos_source_set") { + configs -= invoker.remove_configs + } + +- configs += [ ":$_sanitize_config_target" ] ++ if (defined(build_openeuler) && !build_openeuler) { ++ configs += [ ":$_sanitize_config_target" ] ++ } + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +-- +2.33.0 + diff --git a/0003-feat-Adapt-to-Openeuler-add-clang.patch b/0003-feat-Adapt-to-Openeuler-add-clang.patch new file mode 100644 index 0000000000000000000000000000000000000000..0efb8f4600c16dd963676d2a64f3446527cfd720 --- /dev/null +++ b/0003-feat-Adapt-to-Openeuler-add-clang.patch @@ -0,0 +1,74 @@ +From 8cfe4ff5d9910524223706b37dacdea1ff2e2aea Mon Sep 17 00:00:00 2001 +From: peng_langyuan +Date: Thu, 18 May 2023 16:12:08 +0800 +Subject: [PATCH 03/11] =?UTF-8?q?feat(Adapt=20to=20Openeuler):=E6=96=B0?= + =?UTF-8?q?=E5=A2=9E=E5=B9=B3=E5=8F=B0=E7=BC=96=E8=AF=91=E9=93=BE=20&&=20?= + =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=B7=A5=E5=85=B7=E8=B7=AF=E5=BE=84?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + toolchain/gcc_toolchain.gni | 7 ++++++- + toolchain/linux/BUILD.gn | 30 ++++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 1 deletion(-) + +diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni +index 271d556..f521d7c 100755 +--- a/toolchain/gcc_toolchain.gni ++++ b/toolchain/gcc_toolchain.gni +@@ -584,7 +584,12 @@ template("clang_toolchain") { + } + + gcc_toolchain(target_name) { +- prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ if (build_openeuler) { ++ prefix = "/usr/bin" ++ toolprefix = "/usr/bin/" ++ } else { ++ prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ } + cc = "$prefix/clang" + cxx = "$prefix/clang++" + ld = cxx +diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn +index 6b2d618..59449f6 100755 +--- a/toolchain/linux/BUILD.gn ++++ b/toolchain/linux/BUILD.gn +@@ -116,3 +116,33 @@ gcc_toolchain("x64") { + is_clang = false + } + } ++ ++clang_toolchain("linux_clang_x86_64") { ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ strip = "/usr/bin/llvm-strip" ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "linux" ++ } ++ shlib_extension = ".so" ++} ++clang_toolchain("clang_x86_64") { ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ strip = "/usr/bin/llvm-strip" ++ toolchain_args = { ++ current_cpu = "x64" ++ current_os = "linux" ++ } ++ shlib_extension = ".so" ++} ++ ++clang_toolchain("linux_clang_arm64") { ++ toolchain_args = { ++ current_cpu = "arm64" ++ current_os = "linux" ++ } ++} +-- +2.33.0 + diff --git a/0004-feat-Adapt-to-Openeuler-add-include-file.patch b/0004-feat-Adapt-to-Openeuler-add-include-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..8d74d9ef7f1c68c93f8be3f7a088d36cc6797671 --- /dev/null +++ b/0004-feat-Adapt-to-Openeuler-add-include-file.patch @@ -0,0 +1,97 @@ +From dd39926f233ced1acad598f0fe8baef591f839f6 Mon Sep 17 00:00:00 2001 +From: peng_langyuan +Date: Thu, 18 May 2023 16:12:28 +0800 +Subject: [PATCH 04/11] =?UTF-8?q?feat(Adapt=20to=20Openeuler):=E6=96=B0?= + =?UTF-8?q?=E5=A2=9E=E7=9B=AE=E5=BD=95=E7=94=A8=E4=BA=8E=E5=B9=B3=E5=8F=B0?= + =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=80=A7?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + openeuler/BUILD.gn | 13 ++++++ + openeuler/compiler_include/linux/ashmem.h | 50 +++++++++++++++++++++++ + 2 files changed, 63 insertions(+) + create mode 100644 openeuler/BUILD.gn + create mode 100644 openeuler/compiler_include/linux/ashmem.h + +diff --git a/openeuler/BUILD.gn b/openeuler/BUILD.gn +new file mode 100644 +index 0000000..9c175aa +--- /dev/null ++++ b/openeuler/BUILD.gn +@@ -0,0 +1,13 @@ ++config("openeuler_config") { ++ cflags = [ ++ "-Wno-error", ++ "-Wno-error=implicit-fallthrough", ++ "-Wno-error=unused-command-line-argument", ++ ] ++} ++ ++config("openeuler_include_dirs") { ++ include_dirs = [ ++ "//build/openeuler/compiler_include", ++ ] ++} +\ No newline at end of file +diff --git a/openeuler/compiler_include/linux/ashmem.h b/openeuler/compiler_include/linux/ashmem.h +new file mode 100644 +index 0000000..5e56454 +--- /dev/null ++++ b/openeuler/compiler_include/linux/ashmem.h +@@ -0,0 +1,50 @@ ++/* ++ * drivers/staging/android/uapi/ashmem.h ++ * ++ * Copyright 2008 Google Inc. ++ * Author: Robert Love ++ * ++ * This file is dual licensed. It may be redistributed and/or modified ++ * under the terms of the Apache 2.0 License OR version 2 of the GNU ++ * General Public License. ++ */ ++ ++#ifndef _UAPI_LINUX_ASHMEM_H ++#define _UAPI_LINUX_ASHMEM_H ++ ++#include ++#include ++ ++#define ASHMEM_NAME_LEN 256 ++ ++#define ASHMEM_NAME_DEF "dev/ashmem" ++ ++/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ ++#define ASHMEM_NOT_PURGED 0 ++#define ASHMEM_WAS_PURGED 1 ++ ++/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */ ++#define ASHMEM_IS_UNPINNED 0 ++#define ASHMEM_IS_PINNED 1 ++ ++typedef uint32_t __u32, __le32; ++ ++struct ashmem_pin { ++ __u32 offset; /* offset into region, in bytes, page-aligned */ ++ __u32 len; /* length forward from offset, in bytes, page-aligned */ ++}; ++ ++#define __ASHMEMIOC 0x77 ++ ++#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) ++#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) ++#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) ++#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) ++#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) ++#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) ++#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) ++#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) ++#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9) ++#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) ++ ++#endif /* _UAPI_LINUX_ASHMEM_H */ +\ No newline at end of file +-- +2.33.0 + diff --git a/0005-feat-use-pyyaml-on-openeuler.patch b/0005-feat-use-pyyaml-on-openeuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..bf959447a4b715ff7e8371f7ac421d9e2dbac2c3 --- /dev/null +++ b/0005-feat-use-pyyaml-on-openeuler.patch @@ -0,0 +1,25 @@ +From 76fa62cebb91efc4e41e50b024fc226d4ae34c1d Mon Sep 17 00:00:00 2001 +From: tian hang +Date: Thu, 18 May 2023 08:43:41 +0000 +Subject: [PATCH 05/11] feat:use pyyaml on openeuler + +--- + ohos/hisysevent/gen_def_from_all_yaml.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ohos/hisysevent/gen_def_from_all_yaml.py b/ohos/hisysevent/gen_def_from_all_yaml.py +index 058ec0c..a2d4c92 100755 +--- a/ohos/hisysevent/gen_def_from_all_yaml.py ++++ b/ohos/hisysevent/gen_def_from_all_yaml.py +@@ -24,7 +24,7 @@ sys.path.append( + os.path.dirname( + os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) + +-from third_party.PyYAML.lib import yaml # noqa: E402 ++import yaml # noqa: E402 + + + def format_validation(pattern, content): +-- +2.33.0 + diff --git a/0006-feat-add-base-config.json-for-openeuler.patch b/0006-feat-add-base-config.json-for-openeuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..8bffc8fdf15191d7891e48ec8df6fce5350e170f --- /dev/null +++ b/0006-feat-add-base-config.json-for-openeuler.patch @@ -0,0 +1,127 @@ +From d4188c449e08fe30a7859fa23378b1f25c2f69cb Mon Sep 17 00:00:00 2001 +From: tian hang +Date: Thu, 18 May 2023 09:36:07 +0000 +Subject: [PATCH 06/11] feat:add base config.json for openeuler + +--- + .../vendor/openeuler/openeuler/config.json | 108 ++++++++++++++++++ + 1 file changed, 108 insertions(+) + create mode 100644 openeuler/vendor/openeuler/openeuler/config.json + +diff --git a/openeuler/vendor/openeuler/openeuler/config.json b/openeuler/vendor/openeuler/openeuler/config.json +new file mode 100644 +index 0000000..f20f9c3 +--- /dev/null ++++ b/openeuler/vendor/openeuler/openeuler/config.json +@@ -0,0 +1,108 @@ ++{ ++ "product_name": "openeuler", ++ "device_company": "openeuler", ++ "device_build_path": "device/board/openeuler/openeuler", ++ "target_os": "linux", ++ "type": "standard", ++ "version": "3.0", ++ "board": "openeuler", ++ "api_version": 8, ++ "enable_ramdisk": false, ++ "build_selinux": false, ++ "build_seccomp": false, ++ "support_jsapi": false, ++ "inherit": [], ++ "subsystems": [ ++ { ++ "subsystem": "commonlibrary", ++ "components": [ ++ { ++ "component": "c_utils", ++ "features": [] ++ } ++ ] ++ }, ++ { ++ "subsystem": "hiviewdfx", ++ "components": [ ++ { ++ "component": "hilog_native", ++ "features": [] ++ }, ++ { ++ "component": "hiviewdfx_hilog_native", ++ "features": [] ++ } ++ ] ++ }, ++ { ++ "subsystem": "notification", ++ "components": [ ++ { ++ "component": "eventhandler", ++ "features": [] ++ } ++ ] ++ }, ++ { ++ "subsystem": "startup", ++ "components": [ ++ { ++ "component": "init", ++ "features": [ ++ "enable_ohos_startup_init_feature_ab_partition = false", ++ "enable_ohos_startup_init_feature_loader = false" ++ ] ++ } ++ ] ++ }, ++ { ++ "subsystem": "security", ++ "components": [ ++ { ++ "component": "huks", ++ "features": [] ++ }, ++ { ++ "component": "device_auth", ++ "features": [] ++ } ++ ] ++ }, ++ { ++ "subsystem": "communication", ++ "components": [ ++ { ++ "component": "ipc", ++ "features": [] ++ }, ++ { ++ "component": "dsoftbus", ++ "features": [] ++ } ++ ] ++ }, ++ { ++ "subsystem": "systemabilitymgr", ++ "components": [ ++ { ++ "component": "safwk", ++ "features": [] ++ }, ++ { ++ "component": "samgr", ++ "features": [] ++ } ++ ] ++ }, ++ { ++ "subsystem": "distributedhardware", ++ "components": [ ++ { ++ "component": "device_manager", ++ "features": [] ++ } ++ ] ++ } ++ ] ++} +-- +2.33.0 + diff --git a/0007-feat-add-gn-files-to-use-packages-on-openeuler.patch b/0007-feat-add-gn-files-to-use-packages-on-openeuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..4818410cb6037b6fb81dde002e05483808c33b37 --- /dev/null +++ b/0007-feat-add-gn-files-to-use-packages-on-openeuler.patch @@ -0,0 +1,379 @@ +From a2c22a0926e430d4021422fd43da59a95abeba67 Mon Sep 17 00:00:00 2001 +From: tian hang +Date: Thu, 18 May 2023 09:36:59 +0000 +Subject: [PATCH 07/11] feat: add gn files to use packages on openeuler + +--- + .../systemabilitymgr/samgr/bundle.json | 78 +++++++++++++++++++ + .../interfaces/innerkits/common/BUILD.gn | 38 +++++++++ + .../samgr/interfaces/innerkits/common/include | 1 + + .../interfaces/innerkits/samgr_proxy/BUILD.gn | 43 ++++++++++ + .../interfaces/innerkits/samgr_proxy/include | 1 + + .../samgr/services/lsamgr/include | 1 + + .../bounds_checking_function/BUILD.gn | 28 +++++++ + .../bounds_checking_function/include | 1 + + .../compiler_gn/third_party/cJSON/BUILD.gn | 25 ++++++ + .../compiler_gn/third_party/cJSON/cJSON.h | 1 + + .../compiler_gn/third_party/libxml2/BUILD.gn | 11 +++ + .../third_party/libxml2/include/libxml | 1 + + .../compiler_gn/third_party/mbedtls/BUILD.gn | 19 +++++ + .../compiler_gn/third_party/mbedtls/include | 1 + + 14 files changed, 249 insertions(+) + create mode 100644 openeuler/compiler_gn/foundation/systemabilitymgr/samgr/bundle.json + create mode 100644 openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn + create mode 120000 openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include + create mode 100644 openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn + create mode 120000 openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include + create mode 120000 openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include + create mode 100644 openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn + create mode 120000 openeuler/compiler_gn/third_party/bounds_checking_function/include + create mode 100644 openeuler/compiler_gn/third_party/cJSON/BUILD.gn + create mode 120000 openeuler/compiler_gn/third_party/cJSON/cJSON.h + create mode 100644 openeuler/compiler_gn/third_party/libxml2/BUILD.gn + create mode 120000 openeuler/compiler_gn/third_party/libxml2/include/libxml + create mode 100644 openeuler/compiler_gn/third_party/mbedtls/BUILD.gn + create mode 120000 openeuler/compiler_gn/third_party/mbedtls/include + +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/bundle.json b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/bundle.json +new file mode 100644 +index 0000000..25dc757 +--- /dev/null ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/bundle.json +@@ -0,0 +1,78 @@ ++{ ++ "name": "@ohos/systemabilitymgr_samgr", ++ "description": "system ability manager", ++ "homePage": "https://gitee.com/openharmony", ++ "version": "3.1", ++ "license": "Apache License 2.0", ++ "repository": "https://gitee.com/openharmony/systemabilitymgr_samgr", ++ "publishAs": "code-segment", ++ "segment": { ++ "destPath": "foundation/systemabilitymgr/samgr" ++ }, ++ "dirs": {}, ++ "scripts": {}, ++ "component": { ++ "name": "samgr", ++ "subsystem": "systemabilitymgr", ++ "features": [ "samgr_feature_coverage = false" ], ++ "adapted_system_type": [ ++ "standard" ++ ], ++ "rom": "300KB", ++ "ram": "7130KB", ++ "deps": { ++ "components": [ ++ "access_token", ++ "c_utils", ++ "eventhandler", ++ "hisysevent_native", ++ "hitrace_native", ++ "hiviewdfx_hilog_native", ++ "init", ++ "ipc", ++ "samgr", ++ "selinux", ++ "startup_l2" ++ ], ++ "third_party": [ "libxml2" ] ++ }, ++ "build": { ++ "group_type": { ++ "base_group": [], ++ "fwk_group": [ ++ "//foundation/systemabilitymgr/samgr/interfaces/innerkits/common:samgr_common", ++ "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ++ ] ++ }, ++ "inner_kits": [ ++ { ++ "header": { ++ "header_base": "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include/", ++ "header_files": [ ++ "if_system_ability_manager.h", ++ "iservice_registry.h", ++ "isystem_ability_load_callback.h", ++ "isystem_ability_status_change.h", ++ "system_ability_definition.h", ++ "system_ability_manager_proxy.h", ++ "system_ability_load_callback_stub.h", ++ "system_ability_status_change_stub.h", ++ "sam_log.h" ++ ] ++ }, ++ "name": "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy" ++ }, ++ { ++ "header": { ++ "header_base": "//foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include/", ++ "header_files": [ ++ "sa_profiles.h", ++ "parse_util.h" ++ ] ++ }, ++ "name": "//foundation/systemabilitymgr/samgr/interfaces/innerkits/common:samgr_common" ++ } ++ ] ++ } ++ } ++} +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn +new file mode 100644 +index 0000000..a129d8b +--- /dev/null ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn +@@ -0,0 +1,38 @@ ++# Copyright (c) 2022 Huawei Device Co., Ltd. ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ ++import("//build/ohos.gni") ++ ++config("all_config_samgr_common") { ++ include_dirs = [ ++ "include", ++ ] ++ libs = ["samgr_common",] ++} ++ ++config("config_samgr_common") { ++ include_dirs = [ ++ "include", ++ ] ++ libs = ["samgr_common",] ++} ++ ++################################################################################ ++group("samgr_common") { ++ ++ public_configs = [ ":config_samgr_common" ] ++ ++ all_dependent_configs = [ ":all_config_samgr_common" ] ++ ++} ++################################################################################ +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include +new file mode 120000 +index 0000000..bc414ef +--- /dev/null ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include +@@ -0,0 +1 @@ ++/usr/include/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn +new file mode 100644 +index 0000000..44b42ad +--- /dev/null ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn +@@ -0,0 +1,43 @@ ++# Copyright (c) 2021-2022 Huawei Device Co., Ltd. ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ ++import("//build/ohos.gni") ++import("//build/ohos_var.gni") ++ ++config("samgr_proxy_config") { ++ include_dirs = [ ++ "include", ++ "//third_party/libxml2/include", ++ ] ++ ++ libs = ["samgr_proxy",] ++} ++ ++#config("samgr_proxy_private_config") { ++# include_dirs = [ ++# "include", ++ #"//foundation/systemabilitymgr/samgr/interfaces/innerkits/lsamgr", ++ #"//foundation/systemabilitymgr/samgr/services/lsamgr/include", ++ #"//foundation/systemabilitymgr/samgr/services/samgr/native/include", ++ #"//foundation/systemabilitymgr/samgr/utils/native/include", ++# ] ++# libs = ["samgr_proxy",] ++#} ++ ++group("samgr_proxy"){ ++#ohos_shared_library("samgr_proxy") { ++ public_configs = [ ":samgr_proxy_config" ] ++ ++ all_dependent_configs = [ ":samgr_proxy_config" ] ++ ++} +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include +new file mode 120000 +index 0000000..bc414ef +--- /dev/null ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include +@@ -0,0 +1 @@ ++/usr/include/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include +new file mode 120000 +index 0000000..bc414ef +--- /dev/null ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include +@@ -0,0 +1 @@ ++/usr/include/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn b/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn +new file mode 100644 +index 0000000..ae44b79 +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn +@@ -0,0 +1,28 @@ ++# Copyright (c) 2021 Huawei Device Co., Ltd. ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++import("//build/ohos.gni") ++ ++config("libsec_public_config") { ++ include_dirs = [ "include" ] ++ libs = [ "boundscheck" ] ++} ++ ++ohos_static_library("libsec_static") { ++ #libs = [ "boundscheck" ] ++ all_dependent_configs = [ ":libsec_public_config" ] ++} ++ ++ohos_shared_library("libsec_shared") { ++ #libs = [ "boundscheck" ] ++ all_dependent_configs = [ ":libsec_public_config" ] ++} +diff --git a/openeuler/compiler_gn/third_party/bounds_checking_function/include b/openeuler/compiler_gn/third_party/bounds_checking_function/include +new file mode 120000 +index 0000000..bc414ef +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/bounds_checking_function/include +@@ -0,0 +1 @@ ++/usr/include/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/third_party/cJSON/BUILD.gn b/openeuler/compiler_gn/third_party/cJSON/BUILD.gn +new file mode 100644 +index 0000000..48864a4 +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/cJSON/BUILD.gn +@@ -0,0 +1,25 @@ ++#Copyright (c) 2019-2021 Huawei Device Co., Ltd. ++#Licensed under the Apache License, Version 2.0 (the "License"); ++#you may not use this file except in compliance with the License. ++#You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++#Unless required by applicable law or agreed to in writing, software ++#distributed under the License is distributed on an "AS IS" BASIS, ++#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++#See the License for the specific language governing permissions and ++#limitations under the License. ++ ++import("//build/ohos.gni") ++import("//build/config/sysroot.gni") ++config("cJSON_config") { ++ include_dirs = [ "${sysroot}/usr/include/cjson" ] ++ libs = [ "cjson" ] ++} ++ohos_static_library("cjson_static") { ++ public_configs = [ ":cJSON_config" ] ++} ++ohos_shared_library("cjson") { ++ public_configs = [ ":cJSON_config" ] ++} +diff --git a/openeuler/compiler_gn/third_party/cJSON/cJSON.h b/openeuler/compiler_gn/third_party/cJSON/cJSON.h +new file mode 120000 +index 0000000..a75d9ff +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/cJSON/cJSON.h +@@ -0,0 +1 @@ ++/usr/include/cjson/cJSON.h +\ No newline at end of file +diff --git a/openeuler/compiler_gn/third_party/libxml2/BUILD.gn b/openeuler/compiler_gn/third_party/libxml2/BUILD.gn +new file mode 100644 +index 0000000..f097e1d +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/libxml2/BUILD.gn +@@ -0,0 +1,11 @@ ++import("//build/ohos.gni") ++import("//build/config/sysroot.gni") ++config("libxml2_private_config") { ++ include_dirs = [ "${sysroot}/usr/include/libxml2" ] ++ libs = [ "xml2" ] ++} ++ ++ohos_shared_library("libxml2") { ++ public_configs = [ ":libxml2_private_config" ] ++} ++ +diff --git a/openeuler/compiler_gn/third_party/libxml2/include/libxml b/openeuler/compiler_gn/third_party/libxml2/include/libxml +new file mode 120000 +index 0000000..8eb8d2d +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/libxml2/include/libxml +@@ -0,0 +1 @@ ++/usr/include/libxml2/libxml/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/third_party/mbedtls/BUILD.gn b/openeuler/compiler_gn/third_party/mbedtls/BUILD.gn +new file mode 100644 +index 0000000..dd5723b +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/mbedtls/BUILD.gn +@@ -0,0 +1,19 @@ ++import("//build/ohos.gni") ++config("mbedtls_config") { ++ include_dirs = [ ++ "include", ++ ] ++ libs = [ ++ "mbedtls", ++ "mbedcrypto", ++ ] ++} ++ ++ohos_shared_library("mbedtls_shared") { ++ public_configs = [ ":mbedtls_config" ] ++} ++ ++group("mbedtls") { ++ public_deps = [ ":mbedtls_shared" ] ++} ++ +diff --git a/openeuler/compiler_gn/third_party/mbedtls/include b/openeuler/compiler_gn/third_party/mbedtls/include +new file mode 120000 +index 0000000..bc414ef +--- /dev/null ++++ b/openeuler/compiler_gn/third_party/mbedtls/include +@@ -0,0 +1 @@ ++/usr/include/ +\ No newline at end of file +-- +2.33.0 + diff --git a/0008-feat-Adapt-to-openeuler.patch b/0008-feat-Adapt-to-openeuler.patch new file mode 100644 index 0000000000000000000000000000000000000000..6561c495b3ecfd6693807236ff17bb4927f79275 --- /dev/null +++ b/0008-feat-Adapt-to-openeuler.patch @@ -0,0 +1,895 @@ +From ab7d96e80f3828a05b8fd8ea923d38b3d67500f4 Mon Sep 17 00:00:00 2001 +From: peng_langyuan +Date: Fri, 19 May 2023 17:17:15 +0800 +Subject: [PATCH 08/11] feat : Adapt to openeuler + +--- + build_scripts/build.sh | 27 +-- + common/BUILD.gn | 10 +- + common/bundle.json | 3 +- + config/BUILDCONFIG.gn | 54 ++---- + config/compiler/compiler.gni | 2 +- + config/ohos/BUILD.gn | 3 - + core/gn/BUILD.gn | 14 +- + ohos/images/BUILD.gn | 354 +++++++++++++++++------------------ + ohos/packages/BUILD.gn | 12 +- + ohos_var.gni | 15 +- + templates/cxx/cxx.gni | 58 ++---- + toolchain/gcc_toolchain.gni | 8 +- + toolchain/linux/BUILD.gn | 10 +- + toolchain/toolchain.gni | 3 +- + 14 files changed, 244 insertions(+), 329 deletions(-) + +diff --git a/build_scripts/build.sh b/build_scripts/build.sh +index 51f2e5e..dea04e9 100755 +--- a/build_scripts/build.sh ++++ b/build_scripts/build.sh +@@ -109,29 +109,12 @@ case $(uname -s) in + exit $RET + esac + +-args=$@ +-while test $# -gt 0 +-do +- case "$1" in --product-name) +- shift +- product_name=$1 +- ;; +- *) +- shift +- ;; +- esac +-done +- + # set python3 +-if [ "$product_name" == "openeuler" ]; then +- PYTHON3_DIR=/usr +- LLD_PATH=/usr/lib64/llvm15/bin +-else +- PYTHON3_DIR=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.9.2/ +- LLD_PATH="" +-fi ++# PYTHON3_DIR=${source_root_dir}/prebuilts/python/${HOST_DIR}/3.9.2/ ++PYTHON3_DIR=/usr + PYTHON3=${PYTHON3_DIR}/bin/python3 + PYTHON=${PYTHON3_DIR}/bin/python ++LLVM=/usr/lib64/llvm15/bin + if [[ ! -f "${PYTHON3}" ]]; then + echo -e "\033[33m Please execute the build/prebuilts_download.sh \033[0m" + exit 1 +@@ -141,11 +124,11 @@ else + fi + fi + +-export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:${LLD_PATH}:$PATH ++export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:${LLVM}:$PATH + + ${PYTHON3} ${source_root_dir}/build/scripts/tools_checker.py + +-${PYTHON3} ${source_root_dir}/build/scripts/entry.py --source-root-dir ${source_root_dir} $args ++${PYTHON3} ${source_root_dir}/build/scripts/entry.py --source-root-dir ${source_root_dir} $@ + + if [[ "$?" -ne 0 ]]; then + echo -e "\033[31m=====build ${product_name} error=====\033[0m" +diff --git a/common/BUILD.gn b/common/BUILD.gn +index 1a0ac2f..4daf6bd 100755 +--- a/common/BUILD.gn ++++ b/common/BUILD.gn +@@ -25,9 +25,9 @@ group("common_packages") { + } + deps = [ "//third_party/sqlite:sqlite" ] + +- deps += [ "musl:musl_install" ] ++ # deps += [ "musl:musl_install" ] + +- deps += [ "asan:libclang_rt.asan.so" ] ++ # deps += [ "asan:libclang_rt.asan.so" ] + + if (is_asan) { + deps += [ +@@ -38,9 +38,9 @@ group("common_packages") { + } else { + # ubsan.cfg defines the log_path, different with asan.cfg + deps += [ +- "ubsan:libclang_rt.ubsan_minimal.so", +- "ubsan:libclang_rt.ubsan_standalone.so", +- "ubsan:ubsan.cfg", ++ # "ubsan:libclang_rt.ubsan_minimal.so", ++ # "ubsan:libclang_rt.ubsan_standalone.so", ++ # "ubsan:ubsan.cfg", + ] + } + } +diff --git a/common/bundle.json b/common/bundle.json +index c329e14..6104fcf 100644 +--- a/common/bundle.json ++++ b/common/bundle.json +@@ -11,8 +11,7 @@ + "deps": {}, + "build": { + "sub_component": [ +- "//build/common:common_packages", +- "//third_party/f2fs-tools:f2fs-tools_host_toolchain" ++ "//build/common:common_packages" + ] + } + } +diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn +index ffff773..280894e 100755 +--- a/config/BUILDCONFIG.gn ++++ b/config/BUILDCONFIG.gn +@@ -65,25 +65,22 @@ declare_args() { + } + + declare_args() { +- if (product_name == "openeuler") { +- build_openeuler = true +- } else { +- build_openeuler = false +- } ++ preloader_output_dir = "//out/preloader/${product_name}" + } + + declare_args() { +- if (defined(build_openeuler) && build_openeuler && !defined(product_path)) { +- product_path = "" +- } ++ enable_lto_O0 = false + } + + declare_args() { +- preloader_output_dir = "//out/preloader/${product_name}" +-} ++ if (!defined(product_path)) { ++ product_path = "" ++ } ++ enable_hiviewdfx_hisysevent = false ++ enable_hiviewdfx_hitrace = false ++ enable_hiviewdfx_hidumper = false + +-declare_args() { +- enable_lto_O0 = false ++ enable_security_accesstoken = false + } + + product_build_config = +@@ -246,14 +243,10 @@ declare_args() { + is_desktop_linux = current_os == "linux" + + # Set to true when compiling with the Clang compiler. +- if (defined(build_openeuler) && build_openeuler) { +- is_clang = true +- } else { +- 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 = current_os != "linux" || ++ (current_cpu != "s390x" && current_cpu != "s390" && ++ current_cpu != "ppc64" && current_cpu != "ppc" && ++ current_cpu != "mips" && current_cpu != "mips64") + + # Allows the path to a custom target toolchain to be injected as a single + # argument, and set as the default toolchain. +@@ -274,11 +267,8 @@ declare_args() { + } + + declare_args() { +- if (defined(build_openeuler) && build_openeuler) { +- use_musl = false +- } else { +- use_musl = true +- } ++ # use_musl = true ++ use_musl = false + } + + declare_args() { +@@ -329,9 +319,7 @@ declare_args() { + if (host_os == "mac" && host_cpu == "arm64") { + full_mini_debug = false + } else { +- full_mini_debug = true +- } +- if (build_openeuler) { ++ # full_mini_debug = true + full_mini_debug = false + } + } +@@ -627,11 +615,8 @@ if (is_standard_system) { + default_compiler_configs += [ + "//build/config/clang:find_bad_constructs", + "//build/config/clang:extra_warnings", +- ] +- } +- if (build_openeuler) { +- default_compiler_configs += [ + "//build/openeuler:openeuler_include_dirs", ++ "//build/openeuler:openeuler_config", + ] + } + +@@ -642,11 +627,6 @@ if (is_standard_system) { + default_compiler_configs += [ "//build/config:release" ] + } + +- if (build_openeuler) { +- default_compiler_configs += [ +- "//build/openeuler:openeuler_config", +- ] +- } + # Static libraries and source sets use only the compiler ones. + default_static_library_configs = default_compiler_configs + default_source_set_configs = default_compiler_configs +diff --git a/config/compiler/compiler.gni b/config/compiler/compiler.gni +index d3e4a3f..766a9d8 100755 +--- a/config/compiler/compiler.gni ++++ b/config/compiler/compiler.gni +@@ -146,7 +146,7 @@ declare_args() { + # Linux. + use_lld = is_clang && + (is_win || (use_thin_lto && target_os != "chromeos") || +- (is_linux && current_cpu == "x64" && target_os != "chromeos") || ++ (is_linux && (current_cpu == "x64" || current_cpu == "arm64") && target_os != "chromeos") || + (is_ohos && (current_cpu != "arm" || arm_version >= 7)) || + (is_linux && current_cpu == "arm64")) + } +diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn +index a41763d..f177a03 100755 +--- a/config/ohos/BUILD.gn ++++ b/config/ohos/BUILD.gn +@@ -43,9 +43,6 @@ config("compiler") { + + cflags += [ "--target=$abi_target" ] + include_dirs = [ "${musl_sysroot}/usr/include/${abi_target}" ] +- if (build_openeuler) { +- include_dirs += [ "//build/openeuler/compiler_include" ] +- } + + ldflags += [ "--target=$abi_target" ] + +diff --git a/core/gn/BUILD.gn b/core/gn/BUILD.gn +index e87d50d..8344335 100755 +--- a/core/gn/BUILD.gn ++++ b/core/gn/BUILD.gn +@@ -56,16 +56,10 @@ if (product_name == "ohos-sdk") { + + group("build_all_test_pkg") { + testonly = true +- if (build_openeuler) { +- deps = [ +- "$root_build_dir/build_configs:parts_test", +- ] +- } else { +- deps = [ +- "$root_build_dir/build_configs:parts_test", +- "//test/testfwk/developer_test:make_temp_test", +- ] +- } ++ deps = [ ++ "$root_build_dir/build_configs:parts_test", ++ # "//test/testfwk/developer_test:make_temp_test", ++ ] + } + + group("make_test") { +diff --git a/ohos/images/BUILD.gn b/ohos/images/BUILD.gn +index ae509ea..813c89a 100644 +--- a/ohos/images/BUILD.gn ++++ b/ohos/images/BUILD.gn +@@ -18,194 +18,192 @@ import("//build/ohos/build_var.gni") + # import target_platform_list + import("${build_configs_path}/platforms_list.gni") + +-if (build_openeuler) { +- group("make_images") { +- deps = [] +- if (is_standard_system) { +- foreach(_platform, target_platform_list) { +- deps += [ +- "//build/ohos/packages:${_platform}_install_modules" +- ] +- } +- } +- } +-} else { +- group("make_images") { +- deps = [] +- if (is_standard_system) { +- deps = [ +- "//third_party/e2fsprogs:e2fsprogs_host_toolchain", +- "//third_party/f2fs-tools:f2fs-tools_host_toolchain", +- ] +- foreach(_platform, target_platform_list) { +- deps += [ +- ":${_platform}_sys_prod_image", +- ":${_platform}_system_image", +- ":${_platform}_userdata_image", +- ":${_platform}_vendor_image", +- ] +- if (enable_ramdisk) { +- deps += [ +- ":${_platform}_ramdisk_image", +- ":${_platform}_updater_ramdisk_image", +- ] +- } else { +- deps += [ ":${_platform}_updater_image" ] +- } +- } +- deps += [ ":chip_prod_image" ] +- } else { +- deps += [ "//build/ohos/packages:packer" ] +- } +- } ++# group("make_images") { ++# deps = [] ++# if (is_standard_system) { ++# deps = [ ++# "//third_party/e2fsprogs:e2fsprogs_host_toolchain", ++# "//third_party/f2fs-tools:f2fs-tools_host_toolchain", ++# ] ++# foreach(_platform, target_platform_list) { ++# deps += [ ++# ":${_platform}_sys_prod_image", ++# ":${_platform}_system_image", ++# ":${_platform}_userdata_image", ++# ":${_platform}_vendor_image", ++# ] ++# if (enable_ramdisk) { ++# deps += [ ++# ":${_platform}_ramdisk_image", ++# ":${_platform}_updater_ramdisk_image", ++# ] ++# } else { ++# deps += [ ":${_platform}_updater_image" ] ++# } ++# } ++# deps += [ ":chip_prod_image" ] ++# } else { ++# deps += [ "//build/ohos/packages:packer" ] ++# } ++# } + +- group("chip_prod_image") { +- deps = [] +- if (is_standard_system) { +- deps += [ +- "//third_party/e2fsprogs:e2fsprogs_host_toolchain", +- "//third_party/f2fs-tools:f2fs-tools_host_toolchain", +- ] +- } +- foreach(_platform, target_platform_list) { +- if (chip_product_list == []) { +- deps += [ ":${_platform}_chip_prod_image" ] +- } else { +- foreach(_product, chip_product_list) { +- deps += [ ":${_platform}_${_product}_chip_prod_image" ] +- } +- } +- } +- } ++# group("chip_prod_image") { ++# deps = [] ++# if (is_standard_system) { ++# deps += [ ++# "//third_party/e2fsprogs:e2fsprogs_host_toolchain", ++# "//third_party/f2fs-tools:f2fs-tools_host_toolchain", ++# ] ++# } ++# foreach(_platform, target_platform_list) { ++# if (chip_product_list == []) { ++# deps += [ ":${_platform}_chip_prod_image" ] ++# } else { ++# foreach(_product, chip_product_list) { ++# deps += [ ":${_platform}_${_product}_chip_prod_image" ] ++# } ++# } ++# } ++# } + +- foreach(_platform, target_platform_list) { +- current_platform = _platform +- current_platform_dir = "${product_output_dir}/$current_platform" ++# foreach(_platform, target_platform_list) { ++# current_platform = _platform ++# current_platform_dir = "${product_output_dir}/$current_platform" + +- system_module_info_list = "${current_platform_dir}/system_module_info.json" +- system_modules_list = "${current_platform_dir}/system_modules_list.txt" ++# system_module_info_list = "${current_platform_dir}/system_module_info.json" ++# system_modules_list = "${current_platform_dir}/system_modules_list.txt" + +- image_list = [ +- "system", +- "vendor", +- "userdata", +- "sys_prod", +- "chip_prod", +- ] +- if (enable_ramdisk) { +- image_list += [ +- "ramdisk", +- "updater_ramdisk", +- ] +- } else { +- image_list += [ "updater" ] +- } +- foreach(_image_name, image_list) { +- action_with_pydeps("${_platform}_${_image_name}_image") { +- script = "//build/ohos/images/build_image.py" +- depfile = "$target_gen_dir/$target_name.d" +- deps = [ "//build/ohos/packages:${_platform}_install_modules" ] +- if (!asan_detector) { +- deps += [ "//build/ohos/packages:high_privilege_process_validate" ] +- } ++# image_list = [ ++# "system", ++# "vendor", ++# "userdata", ++# "sys_prod", ++# "chip_prod", ++# ] ++# if (enable_ramdisk) { ++# image_list += [ ++# "ramdisk", ++# "updater_ramdisk", ++# ] ++# } else { ++# image_list += [ "updater" ] ++# } ++# foreach(_image_name, image_list) { ++# action_with_pydeps("${_platform}_${_image_name}_image") { ++# script = "//build/ohos/images/build_image.py" ++# depfile = "$target_gen_dir/$target_name.d" ++# deps = [ "//build/ohos/packages:${_platform}_install_modules" ] ++# if (!asan_detector) { ++# deps += [ "//build/ohos/packages:high_privilege_process_validate" ] ++# } + +- image_config_file = +- "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" +- if (is_debug) { +- image_config_file = +- "//build/ohos/images/mkimage/debug/${_image_name}_image_conf.txt" +- } +- device_image_config_file = +- "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" +- if (_image_name == "ramdisk" || _image_name == "updater_ramdisk") { +- output_image_file = "$root_build_dir/${_image_name}.img" +- } else { +- output_image_file = "$current_platform_dir/images/${_image_name}.img" +- } +- if (_image_name == "updater_ramdisk") { +- image_input_path = "$current_platform_dir/updater" +- } else { +- image_input_path = "$current_platform_dir/${_image_name}" +- } +- if (_image_name == "userdata") { +- image_input_path = "$current_platform_dir/data" +- } ++# image_config_file = ++# "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" ++# if (is_debug) { ++# image_config_file = ++# "//build/ohos/images/mkimage/debug/${_image_name}_image_conf.txt" ++# } ++# device_image_config_file = ++# "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" ++# if (_image_name == "ramdisk" || _image_name == "updater_ramdisk") { ++# output_image_file = "$root_build_dir/${_image_name}.img" ++# } else { ++# output_image_file = "$current_platform_dir/images/${_image_name}.img" ++# } ++# if (_image_name == "updater_ramdisk") { ++# image_input_path = "$current_platform_dir/updater" ++# } else { ++# image_input_path = "$current_platform_dir/${_image_name}" ++# } ++# if (_image_name == "userdata") { ++# image_input_path = "$current_platform_dir/data" ++# } + +- sources = [ +- image_config_file, +- system_module_info_list, +- system_modules_list, +- ] +- outputs = [ output_image_file ] +- args = [ +- "--depfile", +- rebase_path(depfile, root_build_dir), +- "--image-name", +- _image_name, +- "--input-path", +- rebase_path(image_input_path, root_build_dir), +- "--image-config-file", +- rebase_path(image_config_file, root_build_dir), +- "--device-image-config-file", +- rebase_path(device_image_config_file, root_build_dir), +- "--output-image", +- rebase_path(output_image_file, root_build_dir), +- "--target-cpu", +- target_cpu, +- "--build-image-tools-path", +- ] +- args += rebase_path(build_image_tools_path, root_build_dir) +- if (sparse_image) { +- args += [ "--sparse-image" ] +- } +- } +- } ++# sources = [ ++# image_config_file, ++# system_module_info_list, ++# system_modules_list, ++# ] ++# outputs = [ output_image_file ] ++# args = [ ++# "--depfile", ++# rebase_path(depfile, root_build_dir), ++# "--image-name", ++# _image_name, ++# "--input-path", ++# rebase_path(image_input_path, root_build_dir), ++# "--image-config-file", ++# rebase_path(image_config_file, root_build_dir), ++# "--device-image-config-file", ++# rebase_path(device_image_config_file, root_build_dir), ++# "--output-image", ++# rebase_path(output_image_file, root_build_dir), ++# "--target-cpu", ++# target_cpu, ++# "--build-image-tools-path", ++# ] ++# args += rebase_path(build_image_tools_path, root_build_dir) ++# if (sparse_image) { ++# args += [ "--sparse-image" ] ++# } ++# } ++# } + +- # Used to generate chip_prod images of different products +- foreach(_product, chip_product_list) { +- _image_name = "chip_prod" +- action_with_pydeps("${_platform}_${_product}_chip_prod_image") { +- script = "//build/ohos/images/build_image.py" +- depfile = "$target_gen_dir/$target_name.d" +- deps = [ "//build/ohos/packages:${_platform}_install_modules" ] ++# # Used to generate chip_prod images of different products ++# foreach(_product, chip_product_list) { ++# _image_name = "chip_prod" ++# action_with_pydeps("${_platform}_${_product}_chip_prod_image") { ++# script = "//build/ohos/images/build_image.py" ++# depfile = "$target_gen_dir/$target_name.d" ++# deps = [ "//build/ohos/packages:${_platform}_install_modules" ] + +- image_config_file = +- "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" +- device_image_config_file = +- "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" +- image_input_path = "${current_platform_dir}/${_image_name}/${_product}" +- output_image_file = +- "${current_platform_dir}/images/${_product}/${_image_name}.img" ++# image_config_file = ++# "//build/ohos/images/mkimage/${_image_name}_image_conf.txt" ++# device_image_config_file = ++# "${product_output_dir}/imagesconf/${_image_name}_image_conf.txt" ++# image_input_path = "${current_platform_dir}/${_image_name}/${_product}" ++# output_image_file = ++# "${current_platform_dir}/images/${_product}/${_image_name}.img" + +- sources = [ +- image_config_file, +- system_module_info_list, +- system_modules_list, +- ] +- outputs = [ output_image_file ] ++# sources = [ ++# image_config_file, ++# system_module_info_list, ++# system_modules_list, ++# ] ++# outputs = [ output_image_file ] + +- args = [ +- "--depfile", +- rebase_path(depfile, root_build_dir), +- "--image-name", +- _image_name, +- "--input-path", +- rebase_path(image_input_path, root_build_dir), +- "--image-config-file", +- rebase_path(image_config_file, root_build_dir), +- "--device-image-config-file", +- rebase_path(device_image_config_file, root_build_dir), +- "--output-image", +- rebase_path(output_image_file, root_build_dir), +- "--target-cpu", +- target_cpu, +- "--build-image-tools-path", +- ] +- args += rebase_path(build_image_tools_path, root_build_dir) +- if (sparse_image) { +- args += [ "--sparse-image" ] +- } +- } ++# args = [ ++# "--depfile", ++# rebase_path(depfile, root_build_dir), ++# "--image-name", ++# _image_name, ++# "--input-path", ++# rebase_path(image_input_path, root_build_dir), ++# "--image-config-file", ++# rebase_path(image_config_file, root_build_dir), ++# "--device-image-config-file", ++# rebase_path(device_image_config_file, root_build_dir), ++# "--output-image", ++# rebase_path(output_image_file, root_build_dir), ++# "--target-cpu", ++# target_cpu, ++# "--build-image-tools-path", ++# ] ++# args += rebase_path(build_image_tools_path, root_build_dir) ++# if (sparse_image) { ++# args += [ "--sparse-image" ] ++# } ++# } ++# } ++# } ++ ++group("make_images") { ++ deps = [] ++ if (is_standard_system) { ++ foreach(_platform, target_platform_list) { ++ deps += [ ++ "//build/ohos/packages:${_platform}_install_modules" ++ ] + } + } + } +diff --git a/ohos/packages/BUILD.gn b/ohos/packages/BUILD.gn +index 847d2e8..18a5ee3 100755 +--- a/ohos/packages/BUILD.gn ++++ b/ohos/packages/BUILD.gn +@@ -591,12 +591,8 @@ group("package_testcase") { + + group("build_all_test_pkg") { + testonly = true +- if (build_openeuler) { +- deps = [] +- } else { +- deps = [ +- "$root_build_dir/build_configs:parts_test", +- "//test/testfwk/developer_test:make_temp_test", +- ] +- } ++ deps = [ ++ "$root_build_dir/build_configs:parts_test", ++ # "//test/testfwk/developer_test:make_temp_test", ++ ] + } +diff --git a/ohos_var.gni b/ohos_var.gni +index 0ba4b70..1e94387 100755 +--- a/ohos_var.gni ++++ b/ohos_var.gni +@@ -148,23 +148,10 @@ declare_args() { + } + + declare_args() { +- load_test_config = true +-} +- +-if (build_openeuler) { ++ # load_test_config = true + load_test_config = false + } + +-declare_args() { +- # hiviewdfx +- enable_hiviewdfx_hisysevent = false +- enable_hiviewdfx_hitrace = false +- enable_hiviewdfx_hidumper = false +- +- # security +- enable_security_accesstoken = false +-} +- + declare_args() { + # Skip module_info generation when the packaging image is not needed + skip_gen_module_info = false +diff --git a/templates/cxx/cxx.gni b/templates/cxx/cxx.gni +index 1c82f82..a937643 100755 +--- a/templates/cxx/cxx.gni ++++ b/templates/cxx/cxx.gni +@@ -105,12 +105,10 @@ template("ohos_executable") { + ]) + } + +- if (defined(build_openeuler) && !build_openeuler) { +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) +- } +- } ++ # _sanitize_config_target = "${target_name}__sanitizer_config" ++ # ohos_sanitizer_config(_sanitize_config_target) { ++ # forward_variables_from(invoker, [ "sanitize" ]) ++ # } + + _test_target = defined(invoker.testonly) && invoker.testonly + if (!_test_target) { +@@ -161,9 +159,7 @@ template("ohos_executable") { + if (defined(invoker.remove_configs)) { + configs -= invoker.remove_configs + } +- if (defined(build_openeuler) && !build_openeuler) { +- configs += [ ":$_sanitize_config_target" ] +- } ++ # configs += [ ":$_sanitize_config_target" ] + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +@@ -427,12 +423,10 @@ template("ohos_shared_library") { + ]) + } + +- if (defined(build_openeuler) && !build_openeuler) { +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) +- } +- } ++ # _sanitize_config_target = "${target_name}__sanitizer_config" ++ # ohos_sanitizer_config(_sanitize_config_target) { ++ # forward_variables_from(invoker, [ "sanitize" ]) ++ # } + + _test_target = defined(invoker.testonly) && invoker.testonly + if (!_test_target) { +@@ -493,10 +487,7 @@ template("ohos_shared_library") { + if (defined(invoker.remove_configs)) { + configs -= invoker.remove_configs + } +- +- if (defined(build_openeuler) && !build_openeuler) { +- configs += [ ":$_sanitize_config_target" ] +- } ++ # configs += [ ":$_sanitize_config_target" ] + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +@@ -771,12 +762,10 @@ template("ohos_static_library") { + ]) + } + +- if (defined(build_openeuler) && !build_openeuler) { +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) +- } +- } ++ # _sanitize_config_target = "${target_name}__sanitizer_config" ++ # ohos_sanitizer_config(_sanitize_config_target) { ++ # forward_variables_from(invoker, [ "sanitize" ]) ++ # } + + _test_target = defined(invoker.testonly) && invoker.testonly + if (!_test_target) { +@@ -821,9 +810,7 @@ template("ohos_static_library") { + if (is_standard_system) { + configs -= [ "//build/config/compiler:thin_archive" ] + } +- if (defined(build_openeuler) && !build_openeuler) { +- configs += [ ":$_sanitize_config_target" ] +- } ++ # configs += [ ":$_sanitize_config_target" ] + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +@@ -947,12 +934,10 @@ template("ohos_source_set") { + ]) + } + +- if (defined(build_openeuler) && !build_openeuler) { +- _sanitize_config_target = "${target_name}__sanitizer_config" +- ohos_sanitizer_config(_sanitize_config_target) { +- forward_variables_from(invoker, [ "sanitize" ]) +- } +- } ++ # _sanitize_config_target = "${target_name}__sanitizer_config" ++ # ohos_sanitizer_config(_sanitize_config_target) { ++ # forward_variables_from(invoker, [ "sanitize" ]) ++ # } + + _test_target = defined(invoker.testonly) && invoker.testonly + if (!_test_target) { +@@ -995,10 +980,7 @@ template("ohos_source_set") { + if (defined(invoker.remove_configs)) { + configs -= invoker.remove_configs + } +- +- if (defined(build_openeuler) && !build_openeuler) { +- configs += [ ":$_sanitize_config_target" ] +- } ++ # configs += [ ":$_sanitize_config_target" ] + configs += [ ":$_security_config_target" ] + + if (defined(invoker.use_exceptions) && invoker.use_exceptions) { +diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni +index f521d7c..0c91ccf 100755 +--- a/toolchain/gcc_toolchain.gni ++++ b/toolchain/gcc_toolchain.gni +@@ -584,12 +584,8 @@ template("clang_toolchain") { + } + + gcc_toolchain(target_name) { +- if (build_openeuler) { +- prefix = "/usr/bin" +- toolprefix = "/usr/bin/" +- } else { +- prefix = rebase_path("$clang_base_path/bin", root_build_dir) +- } ++ # prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ prefix = "/usr/bin" + cc = "$prefix/clang" + cxx = "$prefix/clang++" + ld = cxx +diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn +index 59449f6..353b13d 100755 +--- a/toolchain/linux/BUILD.gn ++++ b/toolchain/linux/BUILD.gn +@@ -120,29 +120,31 @@ gcc_toolchain("x64") { + clang_toolchain("linux_clang_x86_64") { + # Output linker map files for binary size analysis. + enable_linker_map = true +- ++ toolprefix = "/usr/bin/" + strip = "/usr/bin/llvm-strip" + toolchain_args = { + current_cpu = "x64" + current_os = "linux" + } +- shlib_extension = ".so" ++ shlib_extension = ".z.so" + } + clang_toolchain("clang_x86_64") { + # Output linker map files for binary size analysis. + enable_linker_map = true +- ++ toolprefix = "/usr/bin/" + strip = "/usr/bin/llvm-strip" + toolchain_args = { + current_cpu = "x64" + current_os = "linux" + } +- shlib_extension = ".so" ++ shlib_extension = ".z.so" + } + + clang_toolchain("linux_clang_arm64") { ++ toolprefix = "/usr/bin/" + toolchain_args = { + current_cpu = "arm64" + current_os = "linux" + } ++ shlib_extension = ".z.so" + } +diff --git a/toolchain/toolchain.gni b/toolchain/toolchain.gni +index a079f0f..1e95b63 100755 +--- a/toolchain/toolchain.gni ++++ b/toolchain/toolchain.gni +@@ -68,7 +68,8 @@ if (is_mac) { + shlib_extension = ".dll" + executable_extension = ".exe" + } else if (is_posix) { +- shlib_extension = ".so" ++ # shlib_extension = ".so" ++ shlib_extension = ".z.so" + } else if (is_win) { + shlib_extension = ".dll" + } else { +-- +2.33.0 + diff --git a/0009-feat-add-common-subsystem-and-delete-useless-config.patch b/0009-feat-add-common-subsystem-and-delete-useless-config.patch new file mode 100644 index 0000000000000000000000000000000000000000..8faa23cee6e7dba661e09a9052dc3988797c4949 --- /dev/null +++ b/0009-feat-add-common-subsystem-and-delete-useless-config.patch @@ -0,0 +1,39 @@ +From 43f6c457bbbdd2cc158f49e6653ffa028661daf2 Mon Sep 17 00:00:00 2001 +From: tian hang +Date: Fri, 19 May 2023 09:29:22 +0000 +Subject: [PATCH 09/11] feat:add common subsystem and delete useless config + +--- + openeuler/vendor/openeuler/openeuler/config.json | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/openeuler/vendor/openeuler/openeuler/config.json b/openeuler/vendor/openeuler/openeuler/config.json +index f20f9c3..2dfbb49 100644 +--- a/openeuler/vendor/openeuler/openeuler/config.json ++++ b/openeuler/vendor/openeuler/openeuler/config.json +@@ -1,7 +1,6 @@ + { + "product_name": "openeuler", + "device_company": "openeuler", +- "device_build_path": "device/board/openeuler/openeuler", + "target_os": "linux", + "type": "standard", + "version": "3.0", +@@ -13,6 +12,14 @@ + "support_jsapi": false, + "inherit": [], + "subsystems": [ ++ { ++ "subsystem": "common", ++ "components": [ ++ { ++ "component": "common" ++ } ++ ] ++ }, + { + "subsystem": "commonlibrary", + "components": [ +-- +2.33.0 + diff --git a/0010-feat-use-include-samgr-for-samgr-include-files-confi.patch b/0010-feat-use-include-samgr-for-samgr-include-files-confi.patch new file mode 100644 index 0000000000000000000000000000000000000000..9648db2c89a2e82c09530ba44ca5a60985a319ac --- /dev/null +++ b/0010-feat-use-include-samgr-for-samgr-include-files-confi.patch @@ -0,0 +1,59 @@ +From 7526b048d75a773274144236209eea422e2307c5 Mon Sep 17 00:00:00 2001 +From: tian hang +Date: Fri, 19 May 2023 09:34:27 +0000 +Subject: [PATCH 10/11] feat:use include/samgr for samgr include files config + +--- + .../systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn | 2 -- + .../systemabilitymgr/samgr/interfaces/innerkits/common/include | 2 +- + .../samgr/interfaces/innerkits/samgr_proxy/include | 2 +- + .../foundation/systemabilitymgr/samgr/services/lsamgr/include | 2 +- + 4 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn +index a129d8b..bf8ddb3 100644 +--- a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn +@@ -27,7 +27,6 @@ config("config_samgr_common") { + libs = ["samgr_common",] + } + +-################################################################################ + group("samgr_common") { + + public_configs = [ ":config_samgr_common" ] +@@ -35,4 +34,3 @@ group("samgr_common") { + all_dependent_configs = [ ":all_config_samgr_common" ] + + } +-################################################################################ +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include +index bc414ef..fa4da59 120000 +--- a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include +@@ -1 +1 @@ +-/usr/include/ +\ No newline at end of file ++/usr/include/samgr/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include +index bc414ef..fa4da59 120000 +--- a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include +@@ -1 +1 @@ +-/usr/include/ +\ No newline at end of file ++/usr/include/samgr/ +\ No newline at end of file +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include +index bc414ef..fa4da59 120000 +--- a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/services/lsamgr/include +@@ -1 +1 @@ +-/usr/include/ +\ No newline at end of file ++/usr/include/samgr/ +\ No newline at end of file +-- +2.33.0 + diff --git a/0011-feat-use-.z-for-libs-name.patch b/0011-feat-use-.z-for-libs-name.patch new file mode 100644 index 0000000000000000000000000000000000000000..c2c1a8569561c78f785eafd4fb4281ac2d73884a --- /dev/null +++ b/0011-feat-use-.z-for-libs-name.patch @@ -0,0 +1,47 @@ +From 9801c82c2e5f8f2fd20115c3af413d912d305e4b Mon Sep 17 00:00:00 2001 +From: tian hang +Date: Fri, 19 May 2023 09:37:15 +0000 +Subject: [PATCH 11/11] feat:use .z for libs name + +--- + .../samgr/interfaces/innerkits/common/BUILD.gn | 4 ++-- + .../samgr/interfaces/innerkits/samgr_proxy/BUILD.gn | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn +index bf8ddb3..4b46680 100644 +--- a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/common/BUILD.gn +@@ -17,14 +17,14 @@ config("all_config_samgr_common") { + include_dirs = [ + "include", + ] +- libs = ["samgr_common",] ++ libs = ["samgr_common.z",] + } + + config("config_samgr_common") { + include_dirs = [ + "include", + ] +- libs = ["samgr_common",] ++ libs = ["samgr_common.z",] + } + + group("samgr_common") { +diff --git a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn +index 44b42ad..b68ec17 100644 +--- a/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn ++++ b/openeuler/compiler_gn/foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/BUILD.gn +@@ -20,7 +20,7 @@ config("samgr_proxy_config") { + "//third_party/libxml2/include", + ] + +- libs = ["samgr_proxy",] ++ libs = ["samgr_proxy.z",] + } + + #config("samgr_proxy_private_config") { +-- +2.33.0 + diff --git a/0012-fix-rpm-build-fail-caused-by-wrong-useless-code.patch b/0012-fix-rpm-build-fail-caused-by-wrong-useless-code.patch new file mode 100644 index 0000000000000000000000000000000000000000..63e9fad63a86affa92324a8fc161181fe679dfff --- /dev/null +++ b/0012-fix-rpm-build-fail-caused-by-wrong-useless-code.patch @@ -0,0 +1,24 @@ +From c42d7cc5c56f11131dd6debee3b383b49d2d4344 Mon Sep 17 00:00:00 2001 +From: tian2020 +Date: Tue, 30 May 2023 16:50:10 +0800 +Subject: [PATCH] fix rpm build fail caused by wrong useless code + +--- + config/mac/xcrun.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/mac/xcrun.py b/config/mac/xcrun.py +index 0e29287..4f48d12 100755 +--- a/config/mac/xcrun.py ++++ b/config/mac/xcrun.py +@@ -25,6 +25,6 @@ if __name__ == '__main__': + if rv == 0 and args.stamp: + if os.path.exists(args.stamp): + os.unlink(args.stamp) +- with open(args.stamp, 'w+') as fp: ++ #with open(args.stamp, 'w+') as fp: + + sys.exit(rv) +-- +2.33.0 + diff --git a/0013-feature-use-llvm-tools-version-15-for-build.patch b/0013-feature-use-llvm-tools-version-15-for-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..5b1fd0a9edfb299f3feb0e06bb24d0186ee79213 --- /dev/null +++ b/0013-feature-use-llvm-tools-version-15-for-build.patch @@ -0,0 +1,104 @@ +From f368525248e0bd5f4b101bfa7b4bff98a0eb45af Mon Sep 17 00:00:00 2001 +From: tian2020 +Date: Tue, 13 Jun 2023 16:33:47 +0800 +Subject: [PATCH] feature:use llvm tools version 15 for build + +--- + build_scripts/build.sh | 3 +-- + config/clang/clang.gni | 4 ++-- + config/ohos/BUILD.gn | 2 +- + config/ohos/config.gni | 2 +- + toolchain/gcc_toolchain.gni | 2 +- + toolchain/toolchain.gni | 2 +- + 6 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/build_scripts/build.sh b/build_scripts/build.sh +index dea04e9..f17f9fe 100755 +--- a/build_scripts/build.sh ++++ b/build_scripts/build.sh +@@ -114,7 +114,6 @@ esac + PYTHON3_DIR=/usr + PYTHON3=${PYTHON3_DIR}/bin/python3 + PYTHON=${PYTHON3_DIR}/bin/python +-LLVM=/usr/lib64/llvm15/bin + if [[ ! -f "${PYTHON3}" ]]; then + echo -e "\033[33m Please execute the build/prebuilts_download.sh \033[0m" + exit 1 +@@ -124,7 +123,7 @@ else + fi + fi + +-export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:${LLVM}:$PATH ++export PATH=${source_root_dir}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:$PATH + + ${PYTHON3} ${source_root_dir}/build/scripts/tools_checker.py + +diff --git a/config/clang/clang.gni b/config/clang/clang.gni +index 38719bb..9728e12 100755 +--- a/config/clang/clang.gni ++++ b/config/clang/clang.gni +@@ -4,9 +4,9 @@ + + import("//build/toolchain/toolchain.gni") + +-default_clang_base_path = "//prebuilts/clang/ohos/${host_platform_dir}/llvm" ++default_clang_base_path = "/usr/lib64/llvm15/" + clang_lib_path = +- "//prebuilts/clang/ohos/${host_platform_dir}/llvm/lib/clang/12.0.1/lib" ++ "${default_clang_base_path}/lib/clang/15.0.7/lib" + + declare_args() { + # Indicates if the build should use the Chrome-specific plugins for enforcing +diff --git a/config/ohos/BUILD.gn b/config/ohos/BUILD.gn +index f177a03..84a3ea1 100755 +--- a/config/ohos/BUILD.gn ++++ b/config/ohos/BUILD.gn +@@ -79,7 +79,7 @@ config("runtime_library") { + + ldflags += [ + "-L" + rebase_path("${musl_sysroot}/usr/lib/${abi_target}", root_build_dir), +- "-L" + rebase_path("${clang_base_path}/lib/clang/12.0.1/lib/${abi_target}", ++ "-L" + rebase_path("${clang_base_path}/lib/clang/15.0.7/lib/${abi_target}", + root_build_dir), + ] + +diff --git a/config/ohos/config.gni b/config/ohos/config.gni +index b7e1c45..e5d4d54 100644 +--- a/config/ohos/config.gni ++++ b/config/ohos/config.gni +@@ -37,5 +37,5 @@ if (is_ohos) { + assert(false, "Architecture not supported") + } + +- libclang_rt_file = "${clang_base_path}/lib/clang/12.0.1/lib/${abi_target}/libclang_rt.builtins.a" ++ libclang_rt_file = "${clang_base_path}/lib/clang/15.0.7/lib/${abi_target}/libclang_rt.builtins.a" + } +diff --git a/toolchain/gcc_toolchain.gni b/toolchain/gcc_toolchain.gni +index 0c91ccf..6a68e42 100755 +--- a/toolchain/gcc_toolchain.gni ++++ b/toolchain/gcc_toolchain.gni +@@ -585,7 +585,7 @@ template("clang_toolchain") { + + gcc_toolchain(target_name) { + # prefix = rebase_path("$clang_base_path/bin", root_build_dir) +- prefix = "/usr/bin" ++ prefix = "/usr/lib64/llvm15/bin" + cc = "$prefix/clang" + cxx = "$prefix/clang++" + ld = cxx +diff --git a/toolchain/toolchain.gni b/toolchain/toolchain.gni +index 1e95b63..7794e6f 100755 +--- a/toolchain/toolchain.gni ++++ b/toolchain/toolchain.gni +@@ -46,7 +46,7 @@ hermetic_xcode_path = + declare_args() { + if (is_clang) { + # Clang compiler version. Clang files are placed at version-dependent paths. +- clang_version = "12.0.1" ++ clang_version = "15.0.7" + } + use_custom_clang = true + } +-- +2.33.0 + diff --git a/build-OpenHarmony-v3.2-Release.tar.gz b/build-OpenHarmony-v3.2-Release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..394cda51ff292884398b0afcb7bfedba21ed8f5d Binary files /dev/null and b/build-OpenHarmony-v3.2-Release.tar.gz differ diff --git a/distributed-build.spec b/distributed-build.spec new file mode 100644 index 0000000000000000000000000000000000000000..a7dd4d0c88248bcb61e132bdf332a5adcf1fa7a0 --- /dev/null +++ b/distributed-build.spec @@ -0,0 +1,45 @@ +%define debug_package %{nil} +%global openHarmony_source_release OpenHarmony-v3.2-Release +Name: distributed-build +Version: 1.0.0 +Release: 1 +Summary: openEuler embedded softbus build tools +License: Apache-2.0 +URL: https://gitee.com/openharmony/build +Requires: ninja-build, gn, clang15, llvm15, lld15, python, python-pyyaml, python-jinja2, distributed-build_lite +SOURCE0: https://gitee.com/openharmony/build/repository/archive/%{openHarmony_source_release}.tar.gz #/build-%{openHarmony_source_release}.tar.gz +Patch0001: 0001-feat-Adapt-to-Openeuler-python-export-lld.patch +Patch0002: 0002-feat-Adapt-to-Openeuler-for-compilation.patch +Patch0003: 0003-feat-Adapt-to-Openeuler-add-clang.patch +Patch0004: 0004-feat-Adapt-to-Openeuler-add-include-file.patch +Patch0005: 0005-feat-use-pyyaml-on-openeuler.patch +Patch0006: 0006-feat-add-base-config.json-for-openeuler.patch +Patch0007: 0007-feat-add-gn-files-to-use-packages-on-openeuler.patch +Patch0008: 0008-feat-Adapt-to-openeuler.patch +Patch0009: 0009-feat-add-common-subsystem-and-delete-useless-config.patch +Patch0010: 0010-feat-use-include-samgr-for-samgr-include-files-confi.patch +Patch0011: 0011-feat-use-.z-for-libs-name.patch +Patch0012: 0012-fix-rpm-build-fail-caused-by-wrong-useless-code.patch +Patch0013: 0013-feature-use-llvm-tools-version-15-for-build.patch + +BuildArch: noarch + +%description +openEuler embedded softbus build tools + +%prep +%autosetup -p1 -n build-%{openHarmony_source_release} + +#%build +#nothing to do + +%install +install -d %{buildroot}/opt/distributed-middleware-build +cp -rp %{_builddir}/build-%{openHarmony_source_release}/* %{buildroot}/opt/distributed-middleware-build + +%files +/opt/distributed-middleware-build + +%changelog +* Tue May 30 2023 tianhang - 1.0.0-1 +- Init and Adapt to Openeuler