# 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/config/clang/clang.gni") import("//build/config/ohos/musl.gni") import("//build/ohos.gni") group("musl_install") { deps = [ ":musl-libcxx.so", ":musl_ld_path_etc_cfg", "//third_party/musl:musl_libs", ] if (target_cpu == "riscv64") { deps += [ ":ld-musl-riscv64.so.1", ":musl-libc.so", ] } else { deps += [ ":ld-musl-arm.so.1" ] } } if (target_cpu == "riscv64") { ohos_prebuilt_shared_library("ld-musl-riscv64.so.1") { deps = [ "//third_party/musl:soft_create_linker" ] if (is_asan || is_tsan) { asan = "-asan" } else { asan = "" } _muls_linker_so = "${root_out_dir}/common/common/libc/ld-musl-${musl_arch}${asan}.so.1" source = _muls_linker_so install_enable = true install_images = [ "system", "updater", "ramdisk", ] subsystem_name = "build" part_name = "build_framework" module_install_dir = "lib" } } else { ohos_prebuilt_shared_library("ld-musl-arm.so.1") { deps = [ "//third_party/musl:soft_create_linker" ] if (is_asan || is_tsan) { asan = "-asan" } else { asan = "" } _musl_linker_so = "${root_out_dir}/common/common/libc/./ld-musl-${musl_arch}${asan}.so.1" source = _musl_linker_so install_enable = true install_images = [ "system", "updater", "ramdisk", ] if (target_cpu == "arm") { symlink_ext = [ "lib/libc.so" ] } else if (target_cpu == "arm64" || target_cpu == "x86_64") { symlink_ext = [ "lib64/libc.so" ] } subsystem_name = "build" part_name = "build_framework" module_install_dir = "lib" } } ohos_prebuilt_shared_library("musl-libc.so") { deps = [ "//third_party/musl:soft_libc_musl_shared" ] source = "${musl_sysroot}/usr/lib/${musl_target_triple}/libc.so" install_images = [ "system", "updater", "ramdisk", ] subsystem_name = "build" part_name = "build_framework" innerapi_tags = [ "chipsetsdk" ] relative_install_dir = "" } ohos_prebuilt_etc("musl_ld_path_etc_cfg") { if (target_cpu == "arm") { source = "ld-musl-arm.path" } else if (target_cpu == "riscv64") { source = "ld-musl-riscv64.path" } else { source = "ld-musl-aarch64.path" } if (is_asan || is_tsan) { output = string_replace(source, ".path", "-asan.path") } install_images = [ "system", "updater", "ramdisk", ] subsystem_name = "build" part_name = "build_framework" } ohos_prebuilt_shared_library("musl-libcxx.so") { enable_strip = true mini_debug = true if (target_cpu == "arm") { source = "${clang_base_path}/lib/arm-linux-ohos/libc++.so" } else if (target_cpu == "arm64") { source = "${clang_base_path}/lib/aarch64-linux-ohos/libc++.so" } else if (target_cpu == "x86_64") { source = "${clang_base_path}/lib/x86_64-linux-ohos/libc++.so" } else if (target_cpu == "riscv64") { source = "${clang_base_path}/lib/riscv64-linux-ohos/libc++.so" } else if (target_cpu == "loongarch64") { source = "${clang_base_path}/lib/loongarch64-linux-ohos/libc++.so" } else { source = "" } deps = [ ":musl-libcxx_unstripped_copy" ] install_images = [ "system", "updater", "ramdisk", ] subsystem_name = "build" part_name = "build_framework" innerapi_tags = [ "chipsetsdk" ] relative_install_dir = "" } copy("musl-libcxx_unstripped_copy") { if (target_cpu == "arm") { sources = [ "${clang_base_path}/lib/arm-linux-ohos/libc++.so" ] } else if (target_cpu == "arm64") { sources = [ "${clang_base_path}/lib/aarch64-linux-ohos/libc++.so" ] } else if (target_cpu == "x86_64") { sources = [ "${clang_base_path}/lib/x86_64-linux-ohos/libc++.so" ] } else if (target_cpu == "riscv64") { sources = [ "${clang_base_path}/lib/riscv64-linux-ohos/libc++.so" ] } else if (target_cpu == "loongarch64") { sources = [ "${clang_base_path}/lib/loongarch64-linux-ohos/libc++.so" ] } else { sources = [ "" ] } outputs = [ root_out_dir + "/lib.unstripped/clang/{{source_file_part}}" ] }