aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/unix/sccache.sh
blob: 8a403ba7474672f00e76cbfd2eaefafc871dc96b (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
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Copyright (C) 2018 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

set -ex

source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
## comment fo changin patchset..coin privision issue

function installSccache {
    targetArch=$1
    targetVersion=$2
    sha1=$3
    targetFile=sccache-$targetVersion-$targetArch.tar.gz
    primaryUrl=http://ci-files01-hki.ci.qt.io/input/sccache/$targetFile
    cacheUrl=https://github.com/mozilla/sccache/releases/download/$targetVersion/$targetFile
    DownloadURL "$primaryUrl" "$cacheUrl" "$sha1" "$targetFile"

    sudo mkdir -p /usr/local/sccache
    sudo tar -C /usr/local/sccache -x -z --totals --strip-components=1 --file="$targetFile"

    # add sccache __before__ the real compiler
    SetEnvVar "PATH" "/usr/local/sccache:\$PATH"

    # disable sccache server from shutting down after being idle
    SetEnvVar "SCCACHE_IDLE_TIMEOUT" "0"

    # copy sccache wrapper and place as a first in PATH
    mkdir -p "$HOME/sccache_wrapper"
    cp "${BASH_SOURCE%/*}/sccache_wrapper" "$HOME/sccache_wrapper/sccache"
    chmod 755 "$HOME/sccache_wrapper/sccache"
    SetEnvVar "PATH" "$HOME/sccache_wrapper:\$PATH"

}