22
33set -ex
44
5- SCCACHE_VERSION=" 0.9.1"
6-
7- CARGO_FLAGS=" "
8-
9- install_prereqs_ubuntu () {
5+ install_ubuntu () {
6+ echo " Preparing to build sccache from source"
107 apt-get update
118 # libssl-dev will not work as it is upgraded to libssl3 in Ubuntu-22.04.
129 # Instead use lib and headers from OpenSSL1.1 installed in `install_openssl.sh``
1310 apt-get install -y cargo
14-
15- # cleanup after ourselves
16- trap ' cleanup_ubuntu' EXIT
17-
18- echo " Downloading old sccache binary from S3 repo for PCH builds"
19- curl --retry 3 https://s3.amazonaws.com/ossci-linux/sccache -o /opt/cache/bin/sccache-0.2.14a
20- chmod 755 /opt/cache/bin/sccache-0.2.14a
21- }
22-
23- cleanup_ubuntu () {
11+ echo " Checking out sccache repo"
12+ git clone https://github.com/mozilla/sccache -b v0.9.1
13+ cd sccache
14+ echo " Building sccache"
15+ cargo build --release
16+ cp target/release/sccache /opt/cache/bin
17+ echo " Cleaning up"
18+ cd ..
2419 rm -rf sccache
2520 apt-get remove -y cargo rustc
2621 apt-get autoclean && apt-get clean
27- }
2822
29- install_prereqs_almalinux () {
30- dnf install -y cargo
31- # use vendored openssl, we're not going to use the dist-server anyways
32- CARGO_FEATURES=" --bin sccache --features openssl/vendored"
33- }
34-
35- build_and_install_sccache () {
36- # modern version of git don't like openssl1.1
37- wget -q -O sccache.tar.gz " https://github.com/mozilla/sccache/archive/refs/tags/v${SCCACHE_VERSION} .tar.gz"
38- tar xzf sccache.tar.gz
39- pushd " sccache-${SCCACHE_VERSION} "
40- cargo build --release ${CARGO_FEATURES}
41- cp target/release/sccache /opt/cache/bin
23+ echo " Downloading old sccache binary from S3 repo for PCH builds"
24+ curl --retry 3 https://s3.amazonaws.com/ossci-linux/sccache -o /opt/cache/bin/sccache-0.2.14a
25+ chmod 755 /opt/cache/bin/sccache-0.2.14a
4226}
4327
4428install_binary () {
@@ -51,21 +35,8 @@ mkdir -p /opt/cache/lib
5135sed -e ' s|PATH="\(.*\)"|PATH="/opt/cache/bin:\1"|g' -i /etc/environment
5236export PATH=" /opt/cache/bin:$PATH "
5337
54- echo " Preparing to build sccache from source"
55- DIST_ID=$( . /etc/os-release && echo " $ID " )
56- case ${DIST_ID} in
57- ubuntu)
58- install_prereqs_ubuntu
59- ;;
60- almalinux)
61- install_prereqs_almalinux
62- ;;
63- * )
64- echo " ERROR: Unknown distribution ${DIST_ID} "
65- exit 1
66- ;;
67- esac
68- build_and_install_sccache
38+ # Setup compiler cache
39+ install_ubuntu
6940chmod a+x /opt/cache/bin/sccache
7041
7142function write_sccache_stub() {
0 commit comments