From 74a49f62a85727fb32add853bc194c92ace749a4 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 7 Oct 2024 23:56:09 -0400 Subject: [PATCH] chore: preemptevely install Cargo --- scripts/dependencies.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/dependencies.sh b/scripts/dependencies.sh index 88bcdf2826..c630374491 100755 --- a/scripts/dependencies.sh +++ b/scripts/dependencies.sh @@ -47,6 +47,23 @@ function setup_llvm_deps() { } function compile_cairo_native_runtime() { + # First we need to make sure Cargo exists + if command -v cargo >/dev/null 2>&1; then + echo "Rust is already installed with cargo available in PATH." + else + echo "cargo not found. Installing Rust..." + if ! curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path; then + echo >&2 "Failed to install Rust. Aborting." + return 1 + fi + # shellcheck disable=SC1090 + source "$HOME/.cargo/env" || { + echo >&2 "Failed to source Rust environment. Aborting." + return 1 + } + fi + + # Then we clone and build the runtime from the repo git clone https://github.com/lambdaclass/cairo_native.git pushd ./cairo_native || exit 1 git switch v0.2.0-alpha.2 --detach