|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | +cache="$HOME"/.cache/matplotlib |
| 5 | + |
| 6 | +fold_start() { |
| 7 | + key=$1 |
| 8 | + title=$2 |
| 9 | + echo -e "travis_fold:start:$key\e[2K" |
| 10 | + echo -e "travis_time:start:$key\e[2K" |
| 11 | + tick="$(date +%s)" |
| 12 | + echo "$title" |
| 13 | +} |
| 14 | + |
| 15 | +fold_end() { |
| 16 | + key=$1 |
| 17 | + tock="$(date +%s)" |
| 18 | + nano=000000000 |
| 19 | + echo -e "travis_time:end:$key:start=$tick$nano,finish=$tock$nano,duration=$((tock - tick))$nano\e[2K" |
| 20 | + echo -e "travis_fold:end:$key\e[2K" |
| 21 | +} |
| 22 | + |
| 23 | +cached_download() { |
| 24 | + file=$1 |
| 25 | + url=$2 |
| 26 | + shasum=$3 |
| 27 | + path="$cache/$file" |
| 28 | + if [[ ! -f "$path" |
| 29 | + || "$(shasum -a 256 "$path" | awk '{print $1}')" != "$shasum" ]] |
| 30 | + then |
| 31 | + curl -L -o "$path" "$url" |
| 32 | + fi |
| 33 | +} |
| 34 | + |
| 35 | +fold_start Python "Install Python 3.8 from python.org" |
| 36 | +cached_download python-3.8.5-macosx10.9.pkg \ |
| 37 | + https://www.python.org/ftp/python/3.8.5/python-3.8.5-macosx10.9.pkg \ |
| 38 | + e27c5a510c10f830084fb9c60b9e9aa8719d92e4537a80e6b4252c02396f0d29 |
| 39 | +sudo installer -package "$cache"/python-3.8.5-macosx10.9.pkg -target / |
| 40 | +sudo ln -s /usr/local/bin/python3 /usr/local/bin/python |
| 41 | +hash -r |
| 42 | +fold_end Python |
| 43 | + |
| 44 | +fold_start ccache 'Install ccache (compile it ourselves)' |
| 45 | +cached_download ccache-3.7.11.tar.xz \ |
| 46 | + https://github.com/ccache/ccache/releases/download/v3.7.11/ccache-3.7.11.tar.xz \ |
| 47 | + 8d450208099a4d202bd7df87caaec81baee20ce9dd62da91e9ea7b95a9072f68 |
| 48 | +tar xf "$cache"/ccache-3.7.11.tar.xz |
| 49 | +pushd ccache-3.7.11 |
| 50 | +./configure --prefix=/usr/local |
| 51 | +make -j2 |
| 52 | +make install |
| 53 | +popd |
| 54 | +for compiler in clang clang++ cc gcc c++ g++; do |
| 55 | + ln -sf ccache /usr/local/bin/$compiler |
| 56 | +done |
| 57 | +fold_end ccache |
| 58 | + |
| 59 | +fold_start freetype 'Install freetype (just unpack into the build directory)' |
| 60 | +cached_download freetype-2.6.1.tar.gz \ |
| 61 | + https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz \ |
| 62 | + 0a3c7dfbda6da1e8fce29232e8e96d987ababbbf71ebc8c75659e4132c367014 |
| 63 | +mkdir -p build |
| 64 | +tar -x -C build -f "$cache"/freetype-2.6.1.tar.gz |
| 65 | +fold_end freetype |
0 commit comments