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 libavcodec-dev \ 20 libavutil-dev \ 21 libcap-dev \ 22 libclang-dev \ 23 libdbus-1-dev \ 24 libdrm-dev \ 25 libepoxy-dev \ 26 libglib2.0-dev \ 27 libguestfs-tools \ 28 libslirp-dev \ 29 libssl-dev \ 30 libswscale-dev \ 31 libva-dev \ 32 libwayland-dev \ 33 libxext-dev \ 34 lld \ 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# Install nightly toolchain. Only used for rustfmt 83rustup toolchain install nightly --profile minimal --component rustfmt 84 85# Cargo extension to install binary packages from github 86curl -L https://github.com/cargo-bins/cargo-binstall/releases/download/v1.4.4/cargo-binstall-x86_64-unknown-linux-gnu.tgz | tar -xzvvf - -C ${CARGO_HOME:-~/.cargo}/bin 87 88# The bindgen tool is required to build a crosvm dependency. 89cargo binstall --no-confirm bindgen-cli --version "0.68.1" 90 91# binutils are wrappers to call the rustup bundled versions of llvm tools. 92cargo binstall --no-confirm cargo-binutils 93 94# The mdbook and mdbook-mermaid tools are used to build the crosvm book. 95cargo binstall --no-confirm mdbook --version "0.4.25" 96cargo binstall --no-confirm mdbook-mermaid --version "0.12.6" 97cargo binstall --no-confirm mdbook-linkcheck --version "0.7.7" 98 99# Nextest is an improved test runner for cargo 100cargo binstall --no-confirm cargo-nextest --version "0.9.49" 101