Projects
Eulaceura:Mainline
distributed-build
_service:obs_scm:0002-feat-Adapt-to-Openeuler-f...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0002-feat-Adapt-to-Openeuler-for-compilation.patch of Package distributed-build
From 15ecabfa18a391b57ee46ed94b3b0aa74e00b5af Mon Sep 17 00:00:00 2001 From: zxstty <zhaojiaqi18@huawei.com> Date: Thu, 9 Nov 2023 11:10:52 +0800 Subject: [PATCH] 0002 --- 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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2