forked from compiler-explorer/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_compilers.sh
executable file
·62 lines (52 loc) · 1.38 KB
/
get_compilers.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -ex
OPT=$(pwd)/.travis-compilers
mkdir -p "${OPT}"
mkdir -p "${OPT}/tmp"
fetch() {
curl -v ${http_proxy:+--proxy "$http_proxy"} -L "$*"
}
get_ghc() {
local VER=$1
local DIR=ghc-$VER
pushd "${OPT}/tmp"
fetch "https://downloads.haskell.org/~ghc/${VER}/ghc-${VER}-x86_64-deb8-linux.tar.xz" | tar Jxf -
cd "${OPT}/tmp/ghc-${VER}"
./configure --prefix="${OPT}/ghc"
make install
rm -rf "${OPT}/ghc/lib/ghc-${VER}"/Cabal*
rm -rf "${OPT}/ghc/share"
popd
rm -rf "${OPT}/tmp/ghc-${VER}"
}
get_gdc() {
vers=$1
build=$2
mkdir "${OPT}/gdc"
pushd "${OPT}/gdc"
fetch "https://gdcproject.org/downloads/binaries/${vers}/x86_64-linux-gnu/gdc-${vers}+${build}.tar.xz" | tar Jxf -
popd
}
do_rust_install() {
local DIR=$1
pushd "${OPT}/tmp"
fetch "http://static.rust-lang.org/dist/${DIR}.tar.gz" | tar zxf -
cd "${DIR}"
./install.sh --prefix="${OPT}/rust" --without=rust-docs
popd
rm -rf "${OPT}/tmp/${DIR}"
}
install_new_rust() {
local NAME=$1
do_rust_install "rust-${NAME}-x86_64-unknown-linux-gnu"
}
if [[ ! -d "${OPT}/ghc/bin" ]]; then
get_ghc 8.0.2
fi
if [[ ! -d "${OPT}/gdc/x86_64-pc-linux-gnu/bin" ]]; then
get_gdc 5.2.0 2.066.1
fi
GODBOLT_RUST_VERSION=1.46.0
if ! ("${OPT}"/rust/bin/rustc -V | grep -q -F "${GODBOLT_RUST_VERSION}"); then
install_new_rust "${GODBOLT_RUST_VERSION}"
fi