From db3afa39e02893d4a7e623bce333730aebc8d094 Mon Sep 17 00:00:00 2001 From: Pearson White Date: Mon, 14 Oct 2024 11:13:29 -0400 Subject: [PATCH] wip: pass dir in as arg --- scripts/dependencies.sh | 8 ++++++-- scripts/install_build_tools.sh | 4 +++- scripts/sequencer-ci.Dockerfile | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/dependencies.sh b/scripts/dependencies.sh index e8a062eb239..0124c8d58f6 100755 --- a/scripts/dependencies.sh +++ b/scripts/dependencies.sh @@ -47,6 +47,7 @@ function setup_llvm_deps() { } function compile_cairo_native_runtime() { + SEQUENCER_DIR="$1" # 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." @@ -70,16 +71,19 @@ function compile_cairo_native_runtime() { cargo build -p cairo-native-runtime --release --all-features --quiet popd || exit 1 - mv ./cairo_native/target/release/libcairo_native_runtime.a $SEQUENCER_DIR/crates/blockifier/libcairo_native_runtime.a + mv ./cairo_native/target/release/libcairo_native_runtime.a ${SEQUENCER_DIR}/crates/blockifier/libcairo_native_runtime.a rm -rf ./cairo_native } function main() { + # Set SEQUENCER_DIR as first argument, or by default the pwd. + SEQUENCER_DIR=${1:-$(pwd)} + [ "$(uname)" = "Linux" ] && install_essential_deps_linux setup_llvm_deps echo "LLVM dependencies installed successfully." - compile_cairo_native_runtime + compile_cairo_native_runtime "$SEQUENCER_DIR" echo "Cairo Native runtime compiled successfully." } diff --git a/scripts/install_build_tools.sh b/scripts/install_build_tools.sh index e9b649b45c3..420af416dd8 100755 --- a/scripts/install_build_tools.sh +++ b/scripts/install_build_tools.sh @@ -3,6 +3,8 @@ set -e [[ ${UID} == "0" ]] || SUDO="sudo" +# Set SEQUENCER_DIR as first argument, or by default the pwd. +SEQUENCER_DIR=${1:-$(pwd)} function install_common_packages() { $SUDO bash -c ' @@ -52,4 +54,4 @@ install_common_packages install_pypy & install_rust & wait -./dependencies.sh +./dependencies.sh "$1" diff --git a/scripts/sequencer-ci.Dockerfile b/scripts/sequencer-ci.Dockerfile index d27157f4b5f..6eb073a6332 100644 --- a/scripts/sequencer-ci.Dockerfile +++ b/scripts/sequencer-ci.Dockerfile @@ -3,6 +3,7 @@ FROM ubuntu:20.04 ARG USERNAME=sequencer ARG USER_UID=1000 ARG USER_GID=$USER_UID +ARG SEQUENCER_DIR=local RUN apt update && apt install -y sudo @@ -21,4 +22,4 @@ ENV PATH=$PATH:${RUSTUP_HOME}/bin COPY install_build_tools.sh . COPY dependencies.sh . -RUN ./install_build_tools.sh +RUN ./install_build_tools.sh "${SEQUENCER_DIR}"