diff --git a/third_party/musl/ndk_script/BUILD.gn b/third_party/musl/ndk_script/BUILD.gn index e3aedb0b6454c4daca73c7ffa2f2f3999e4011b5..ad9e795af0b47bd4891e36cd97459a4f73b9f05c 100644 --- a/third_party/musl/ndk_script/BUILD.gn +++ b/third_party/musl/ndk_script/BUILD.gn @@ -53,6 +53,8 @@ if (host_os == "mac") { args = [ "-i" ] + [ rebase_path("${darwin_system_toolchains_dir}/libcxx-ndk") ] args += [ "-o" ] + [ rebase_path("${ndk_darwin_toolchains_out_dir}") ] + args += + [ "-l" ] + [ rebase_path("${darwin_system_toolchains_dir}/llvm/bin") ] if (host_cpu == "arm64") { deps = [ ":darwin_arm64" ] } else { @@ -98,6 +100,8 @@ if (host_os == "mac") { args = [ "-i" ] + [ rebase_path("${linux_x86_64_toolchains_dir}/libcxx-ndk") ] args += [ "-o" ] + [ rebase_path("${ndk_linux_toolchains_out_dir}") ] + args += + [ "-l" ] + [ rebase_path("${linux_x86_64_toolchains_dir}/llvm/bin") ] deps = [ ":linux_x86_64" ] } @@ -107,6 +111,8 @@ if (host_os == "mac") { args = [ "-i" ] + [ rebase_path("${windows_x86_64_toolchain_dir}/libcxx-ndk") ] args += [ "-o" ] + [ rebase_path("${ndk_windows_toolchains_out_dir}") ] + args += + [ "-l" ] + [ rebase_path("${linux_x86_64_toolchains_dir}/llvm/bin") ] deps = [ ":windows_x86_64" ] } } diff --git a/third_party/musl/ndk_script/toolchain.sh b/third_party/musl/ndk_script/toolchain.sh index 7e9acb9de0a8310f931848561eeb434570b23c31..7f90ff69dfbb4c8cb752eb19a562d905fa4dce31 100755 --- a/third_party/musl/ndk_script/toolchain.sh +++ b/third_party/musl/ndk_script/toolchain.sh @@ -2,7 +2,7 @@ # Copyright (c) Huawei Technologies Co., Ltd. 2020-2030. All rights reserved. set -e -while getopts "o:i:t:h" arg +while getopts "o:i:l:t:h" arg do case "${arg}" in "o") @@ -11,6 +11,9 @@ do "i") SOURCE_DIR=${OPTARG} ;; + "l") + TOOL_DIR=${OPTARG} + ;; "h") echo "help" ;; @@ -33,3 +36,17 @@ done cp -rfp ${SOURCE_DIR}/lib ${OUT_DIR} cp -rfp ${SOURCE_DIR}/include ${OUT_DIR} +function strip_dir() { + for file in `ls $1` + do + if [ -f $1"/"$file ] && [[ $(file -b $1"/"$file) =~ "shared object" ]] + then + echo $1"/"$file + ${TOOL_DIR}/llvm-strip $1"/"$file + elif [ -d $1"/"$file ] + then + strip_dir $1"/"$file + fi + done +} +strip_dir ${OUT_DIR}/lib