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:soft_create_linker" ] 30 if (is_asan) { 31 asan = "-asan" 32 } else { 33 asan = "" 34 } 35 36 _musl_linker_so = 37 "${root_out_dir}/common/common/libc/./ld-musl-${musl_arch}${asan}.so.1" 38 source = _musl_linker_so 39 install_enable = true 40 install_images = [ 41 "system", 42 "updater", 43 "ramdisk", 44 ] 45 part_name = "common" 46 module_install_dir = "lib" 47} 48 49ohos_prebuilt_shared_library("musl-libc.so") { 50 deps = [ "//third_party/musl:soft_libc_musl_shared" ] 51 source = "${musl_sysroot}/usr/lib/${musl_target_triple}/libc.so" 52 install_images = [ 53 "system", 54 "updater", 55 "ramdisk", 56 ] 57 part_name = "common" 58} 59 60ohos_prebuilt_etc("musl_ld_path_etc_cfg") { 61 if (target_cpu == "arm") { 62 source = "ld-musl-arm.path" 63 } else { 64 source = "ld-musl-aarch64.path" 65 } 66 if (is_asan) { 67 output = string_replace(source, ".path", "-asan.path") 68 } 69 install_images = [ 70 "system", 71 "updater", 72 "ramdisk", 73 ] 74 part_name = "common" 75} 76 77ohos_prebuilt_shared_library("musl-libcxx.so") { 78 enable_strip = true 79 if (target_cpu == "arm") { 80 source = "${clang_base_path}/lib/arm-linux-ohos/libc++.so" 81 } else if (target_cpu == "arm64") { 82 source = "${clang_base_path}/lib/aarch64-linux-ohos/libc++.so" 83 } else if (target_cpu == "x86_64") { 84 source = "${clang_base_path}/lib/x86_64-linux-ohos/libc++.so" 85 } else { 86 source = "" 87 } 88 install_images = [ 89 "system", 90 "updater", 91 ] 92 part_name = "common" 93} 94