|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2018 The Rust Project Developers. See the COPYRIGHT |
| 3 | +# file at the top-level directory of this distribution and at |
| 4 | +# http://rust-lang.org/COPYRIGHT. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 8 | +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 9 | +# option. This file may not be copied, modified, or distributed |
| 10 | +# except according to those terms. |
| 11 | + |
| 12 | +set -eux |
| 13 | + |
| 14 | +# Install prerequisites. |
| 15 | +apt-get update |
| 16 | +apt-get install -y --no-install-recommends \ |
| 17 | + apt-transport-https \ |
| 18 | + ca-certificates \ |
| 19 | + clang-5.0 \ |
| 20 | + cmake \ |
| 21 | + curl \ |
| 22 | + file \ |
| 23 | + g++ \ |
| 24 | + gdb \ |
| 25 | + git \ |
| 26 | + lld-5.0 \ |
| 27 | + make \ |
| 28 | + python \ |
| 29 | + sudo \ |
| 30 | + xz-utils |
| 31 | + |
| 32 | +# Set up a Clang-based cross compiler toolchain. |
| 33 | +# Based on the steps described at https://nuxi.nl/cloudabi/debian/ |
| 34 | +IFS=, |
| 35 | +for target in ${TARGETS}; do |
| 36 | + for tool in ar nm objdump ranlib size; do |
| 37 | + ln -s ../lib/llvm-5.0/bin/llvm-${tool} /usr/bin/${target}-${tool} |
| 38 | + done |
| 39 | + ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-cc |
| 40 | + ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-c++ |
| 41 | + ln -s ../lib/llvm-5.0/bin/lld /usr/bin/${target}-ld |
| 42 | + ln -s ../../${target} /usr/lib/llvm-5.0/${target} |
| 43 | + |
| 44 | + # FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It |
| 45 | + # can make use of ${target}-cc and ${target}-c++, without incorrectly |
| 46 | + # assuming it's MSVC. |
| 47 | + ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang |
| 48 | + ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang++ |
| 49 | +done |
| 50 | + |
| 51 | +# Install the C++ runtime libraries from CloudABI Ports. |
| 52 | +echo deb https://nuxi.nl/distfiles/cloudabi-ports/debian/ cloudabi cloudabi > \ |
| 53 | + /etc/apt/sources.list.d/cloudabi.list |
| 54 | +curl 'https://pgp.mit.edu/pks/lookup?op=get&search=0x0DA51B8531344B15' | \ |
| 55 | + apt-key add - |
| 56 | +apt-get update |
| 57 | +for target in ${TARGETS}; do |
| 58 | + apt-get install -y $(echo ${target} | sed -e s/_/-/g)-cxx-runtime |
| 59 | +done |
0 commit comments