1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License 13 14import("//build/config/clang/clang.gni") 15import("//build/config/ohos/musl.gni") 16import("//build/ohos.gni") 17 18group("musl_install") { 19 deps = [ 20 ":ld-musl-arm.so.1", 21 ":musl-libc.so", 22 ":musl-libcxx.so", 23 ":musl_ld_path_etc_cfg", 24 "//third_party/musl:musl_libs", 25 ] 26} 27 28ohos_prebuilt_shared_library("ld-musl-arm.so.1") { 29 deps = [ "//third_party/musl:${musl_target_abi_name}_create_linker" ] 30 if (is_asan) { 31 asan = "-asan" 32 } else { 33 asan = "" 34 } 35 if (musl_target_abi_name == "soft") { 36 _libs_path_prefix = "." 37 } else { 38 _libs_path_prefix = "${musl_target_abi_name}" 39 } 40 if (musl_target_abi_name == "a7_hard_neon-vfpv4") { 41 musl_subarch = "hf" 42 } else { 43 musl_subarch = "" 44 } 45 _muls_linker_so = "${root_out_dir}/common/common/libc/${_libs_path_prefix}/ld-musl-${musl_arch}${musl_subarch}${asan}.so.1" 46 source = _muls_linker_so 47 install_enable = true 48 install_images = [ 49 "system", 50 "updater", 51 "ramdisk", 52 ] 53 part_name = "common" 54} 55 56ohos_prebuilt_shared_library("musl-libc.so") { 57 deps = [ "//third_party/musl:${musl_target_abi_name}_libc_musl_shared" ] 58 source = "${musl_sysroot}/usr/lib/${musl_target_triple}/libc.so" 59 install_images = [ 60 "system", 61 "updater", 62 "ramdisk", 63 ] 64 part_name = "common" 65} 66 67ohos_prebuilt_etc("musl_ld_path_etc_cfg") { 68 if (target_cpu == "arm") { 69 source = "ld-musl-arm.path" 70 } else { 71 source = "ld-musl-aarch64.path" 72 } 73 if (is_asan) { 74 output = string_replace(source, ".path", "-asan.path") 75 } 76 install_images = [ 77 "system", 78 "updater", 79 ] 80 part_name = "common" 81} 82 83ohos_prebuilt_shared_library("musl-libcxx.so") { 84 if (target_cpu == "arm") { 85 source = "${clang_base_path}/lib/arm-linux-ohos/c++/libc++.so" 86 } else if (target_cpu == "arm64") { 87 source = "${clang_base_path}/lib/aarch64-linux-ohos/c++/libc++.so" 88 } else { 89 source = "" 90 } 91 install_images = [ 92 "system", 93 "updater", 94 ] 95 part_name = "common" 96} 97