blob: 2c5021ece2f11ea5e827f2922f5eb8527f138d79 [file] [log] [blame]
#!/bin/bash
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
set -e
# build_tock.sh is a wrapper to invoke Cargo from Meson. This is a workaround
# solution to read the rust-toolchain file from the Tock repository and set the
# RUSTFLAGS environment variable.
TARGET="${1}"
MODE="${2}"
MANIFEST_PATH="${3}"
TARGET_DIR="${4}"
TOOLCHAIN_FILE="${5}"
export RUSTFLAGS="${6}"
if [[ "${MODE}" == "release" ]]; then
RELEASE_FLAG="--release"
fi
cargo +"$(cat ${TOOLCHAIN_FILE})" build \
--target "${TARGET}" \
--manifest-path "${MANIFEST_PATH}" \
--target-dir "${TARGET_DIR}" \
${RELEASE_FLAG}