From c6d55b9b3d030d390017762df49d8a98bdc5dcf4 Mon Sep 17 00:00:00 2001 From: sam bacha Date: Mon, 21 Mar 2022 10:01:29 -0700 Subject: [PATCH] sync --- install | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/install b/install index 4d4495b..adc834a 100755 --- a/install +++ b/install @@ -51,9 +51,36 @@ OPTIONS: -h, --help Print help information -v, --version Install a specific version -b, --branch Install a specific branch - -r, --repo Install a forks main branch" + -r, --repo Install a forks main branch + -p, --path Install a local repository" exit 0 fi + +# Installs foundry from a local repository if --path parameter is provided +if [[ -n "$FOUNDRYUP_LOCAL_REPO" ]]; then + # Ignore branches/versions as we do not want to modify local git state + if [ -n "$FOUNDRYUP_REPO" ] || [ -n "$FOUNDRY_BRANCH" ] || [ -n "$FOUNDRY_VERSION" ]; then + echo "foundryup: !WARN! --branch, --version, and --repo arguments are ignored during local install" + fi + if ! command -v cargo &> /dev/null ; then + # Error if cargo is not already installed. + echo "foundryup: cargo is not installed. Please install it first." + exit 1 + fi + # Enter local repo and build + echo "foundryup: installing from $FOUNDRYUP_LOCAL_REPO" + cd $FOUNDRYUP_LOCAL_REPO + RUSTFLAGS="-C target-cpu=native" cargo build --release # need 4 speed + # Remove prior installations if they exist + rm -f "$FOUNDRY_BIN_DIR/forge" + rm -f "$FOUNDRY_BIN_DIR/cast" + # Symlink from local repo binaries to bin dir + ln -s "$PWD/target/release/forge" "$FOUNDRY_BIN_DIR/forge" + ln -s "$PWD/target/release/cast" "$FOUNDRY_BIN_DIR/cast" + echo foundryup: done! + exit 0 +fi + FOUNDRYUP_REPO=${FOUNDRYUP_REPO-gakonst/foundry} if [[ "$FOUNDRYUP_REPO" == "gakonst/foundry" && -z "$FOUNDRYUP_BRANCH" ]]; then FOUNDRYUP_VERSION=${FOUNDRYUP_VERSION-nightly}