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