diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..d614d04decf11e712cd538a45fc5f197fc004da7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +llvm-19.1.7.tar.gz.aa filter=lfs diff=lfs merge=lfs -text +llvm-19.1.7.tar.gz.ab filter=lfs diff=lfs merge=lfs -text +llvm-19.1.7.tar.gz.ac filter=lfs diff=lfs merge=lfs -text +llvm-19.1.7.tar.gz.ad filter=lfs diff=lfs merge=lfs -text diff --git a/llvm-19.1.7.tar.gz.aa b/llvm-19.1.7.tar.gz.aa new file mode 100644 index 0000000000000000000000000000000000000000..6cd75546a74260db1586be10f7c2602133e315dc --- /dev/null +++ b/llvm-19.1.7.tar.gz.aa @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3dae36a25f12f73c7bb3e69dd00ca4c67698d0866f327af033484cca1f902639 +size 838860800 diff --git a/llvm-19.1.7.tar.gz.ab b/llvm-19.1.7.tar.gz.ab new file mode 100644 index 0000000000000000000000000000000000000000..ce407803f121716ba52b1aac09257c9478ee192a --- /dev/null +++ b/llvm-19.1.7.tar.gz.ab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e357f1e90193e823371947eb77ad0676a066edd3b21b575f6a64e3e6f6c33337 +size 838860800 diff --git a/llvm-19.1.7.tar.gz.ac b/llvm-19.1.7.tar.gz.ac new file mode 100644 index 0000000000000000000000000000000000000000..7fa27984a4a1936e66229855ee38d1c45c9f73ea --- /dev/null +++ b/llvm-19.1.7.tar.gz.ac @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15ed8418b026b17c1694d34ecb812fe123b87b3aaf84a8909b834bac5b21e496 +size 838860800 diff --git a/llvm-19.1.7.tar.gz.ad b/llvm-19.1.7.tar.gz.ad new file mode 100644 index 0000000000000000000000000000000000000000..c60785185a7de3dd35540554d20c9de7b2324fe0 --- /dev/null +++ b/llvm-19.1.7.tar.gz.ad @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc9a1d06b3470e373bed82da37509b717534c29bc36f3c66ee30479c589cf6cb +size 28966004 diff --git a/toolchain.sh b/toolchain.sh new file mode 100755 index 0000000000000000000000000000000000000000..1bdc1baffa44181f65361af650ec98a8c9414a57 --- /dev/null +++ b/toolchain.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Copyright (c) Huawei Technologies Co., Ltd. 2020-2030. All rights reserved. +set -e + +while getopts "o:i:l:t:h" arg +do + case "${arg}" in + "o") + OUT_DIR=${OPTARG} + ;; + "i") + SOURCE_DIR=${OPTARG} + ;; + "l") + TOOL_DIR=${OPTARG} + ;; + "h") + echo "help" + ;; + ?) + echo "unkonw argument" + exit 1 + ;; + esac +done + + +ndk_dir=$(ls ${SOURCE_DIR}/lib/|more |grep ohos |grep -v mipsel |grep -v riscv |awk '{print $NF}') + +for i in $ndk_dir +do + find ${OUT_DIR}/lib/$i -name 'libc++.a' -type f -exec bash -c 'echo "INPUT(-lc++_static -lc++abi)" > $1' _ {} \; + find ${OUT_DIR}/lib/$i -name 'libc++.so' -type f -exec bash -c 'echo "INPUT(-lc++_shared)" > $1' _ {} \; +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 +} +function remove_unnecessary_file { + file_list=("bin/llvm-ifs" "bin/llvm-ifs.exe" "lib/clang/current" "lib/arm-liteos-ohos" "lib/loongarch64-linux-ohos" "lib/mipsel-linux-ohos" "lib/riscv64-linux-ohos" "lib/clang/15.0.4/bin/loongarch64-linux-ohos" "lib/clang/15.0.4/lib/arm-liteos-ohos" "lib/clang/15.0.4/lib/i386-unknown-linux-gnu" "lib/clang/15.0.4/lib/loongarch64-linux-ohos" "lib/clang/15.0.4/lib/mipsel-linux-ohos" "lib/clang/15.0.4/lib/riscv64-linux-ohos" "lib/clang/15.0.4/lib/windows") + + for i in "${file_list[@]}"; do + if [ -e "${OUT_DIR}/${i}" ]; then + rm -rf "${OUT_DIR}/${i}" + fi + done +} +remove_unnecessary_file +strip_dir ${OUT_DIR}/lib