summarylogtreecommitdiffstats
path: root/update_links.sh
blob: aca43d758d073af6fa9cf37d01dadceeb1460ffd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/bash

: ${ANDROID_NDK:="/opt/android-ndk"}
OLLVM_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

processPath(){
    ndk_path=$2
    if [[ $ndk_path == "" ]]; then
        ndk_path=$1
    fi
    linkTo=`readlink "${OLLVM_PATH}/$1"`
    if [[ $linkTo == "${ANDROID_NDK}/$ndk_path" ]]; then
        return
    fi
    echo "Update path for ${OLLVM_PATH}/$1 -> ${ANDROID_NDK}/$ndk_path"
    rm "${OLLVM_PATH}/$1"
    ln -s "${ANDROID_NDK}/$ndk_path" "${OLLVM_PATH}/$1"
}

processPath "build"
processPath "source.properties"
processPath "toolchains/llvm/prebuilt/linux-x86_64/sysroot"

ollvm_ver=`${OLLVM_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --version | head -1 | awk {'print $3'}`
andllvm_ver=`${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --version | head -1 | awk {'print $8'}`
processPath "toolchains/llvm/prebuilt/linux-x86_64/lib/clang/${ollvm_ver}/lib" "toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${andllvm_ver}/lib"