1#!/usr/bin/env bash 2# Copyright 2021 The ChromiumOS Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5set -ex 6 7sudo apt-get install --yes --no-install-recommends \ 8 black \ 9 ca-certificates \ 10 clang \ 11 cloud-image-utils \ 12 curl \ 13 dpkg-dev \ 14 expect \ 15 g++ \ 16 gcc \ 17 git \ 18 jq \ 19 libasound2-dev \ 20 libavcodec-dev \ 21 libavutil-dev \ 22 libcap-dev \ 23 libclang-dev \ 24 libdbus-1-dev \ 25 libdrm-dev \ 26 libepoxy-dev \ 27 libglib2.0-dev \ 28 libguestfs-tools \ 29 libslirp-dev \ 30 libssl-dev \ 31 libswscale-dev \ 32 libva-dev \ 33 libwayland-dev \ 34 libxext-dev \ 35 make \ 36 meson \ 37 mypy \ 38 nasm \ 39 ncat \ 40 ninja-build \ 41 openssh-client \ 42 pipx \ 43 pkg-config \ 44 protobuf-compiler \ 45 python3 \ 46 python3-argh \ 47 python3-pip \ 48 python3-rich \ 49 qemu-system-x86 \ 50 rsync \ 51 screen \ 52 strace \ 53 tmux \ 54 wayland-protocols \ 55 wget 56 57# mdformat is not available as a debian package. Install via pipx instead. 58pipx install mdformat 59pipx inject mdformat mdformat-gfm mdformat-footnote 60pipx ensurepath 61 62# Install rustup if not available yet 63if ! command -v rustup &>/dev/null; then 64 wget "https://static.rust-lang.org/rustup/archive/1.25.1/x86_64-unknown-linux-gnu/rustup-init" 65 echo "5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c *rustup-init" | sha256sum -c - 66 chmod +x rustup-init 67 ./rustup-init -y --no-modify-path --profile minimal --default-toolchain none 68 source ${CARGO_HOME:-~/.cargo}/env 69 rm rustup-init 70fi 71 72# Install required rust components. 73# This will also ensure the toolchain required by ./rust-toolchain is installed. 74rustup component add cargo clippy rustfmt 75 76# LLVM tools are used to generate and process coverage files 77rustup component add llvm-tools-preview 78 79# Allow cross-compilation via mingw64 80rustup target add x86_64-pc-windows-gnu 81 82# Cargo extension to install binary packages from github 83curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v0.19.3/cargo-binstall-x86_64-unknown-linux-gnu.tgz | tar -xzvvf - -C ${CARGO_HOME:-~/.cargo}/bin 84 85# Note: Using crate-meta-data will make too many requests to github to discover which release 86# to download. This will get throttled quickly and slow down massively. 87# This should be fixed by: https://github.com/cargo-bins/cargo-binstall/issues/776 88 89# The bindgen tool is required to build a crosvm dependency. 90cargo binstall --no-confirm --disable-strategies crate-meta-data bindgen-cli --version "0.64.0" 91 92# binutils are wrappers to call the rustup bundled versions of llvm tools. 93cargo binstall --no-confirm --disable-strategies crate-meta-data cargo-binutils 94 95# The mdbook and mdbook-mermaid tools are used to build the crosvm book. 96cargo binstall --no-confirm --disable-strategies crate-meta-data mdbook --version "0.4.25" 97cargo binstall --no-confirm --disable-strategies crate-meta-data mdbook-mermaid --version "0.12.6" 98cargo binstall --no-confirm --disable-strategies crate-meta-data mdbook-linkcheck --version "0.7.7" 99 100# Nextest is an improved test runner for cargo 101cargo binstall --no-confirm --disable-strategies crate-meta-data cargo-nextest --version "0.9.49" 102