Skip to content

Commit

Permalink
wip: pass dir in as arg
Browse files Browse the repository at this point in the history
  • Loading branch information
PearsonWhite committed Oct 14, 2024
1 parent 62851d3 commit db3afa3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions scripts/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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."
}

Expand Down
4 changes: 3 additions & 1 deletion scripts/install_build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down Expand Up @@ -52,4 +54,4 @@ install_common_packages
install_pypy &
install_rust &
wait
./dependencies.sh
./dependencies.sh "$1"
3 changes: 2 additions & 1 deletion scripts/sequencer-ci.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}"

0 comments on commit db3afa3

Please sign in to comment.