Skip to content

Commit

Permalink
Update install_mips_rust_tool
Browse files Browse the repository at this point in the history
  • Loading branch information
xander42280 committed Dec 20, 2024
1 parent 9f4ca17 commit 57a3783
Showing 1 changed file with 2 additions and 53 deletions.
55 changes: 2 additions & 53 deletions install_mips_rust_tool
Original file line number Diff line number Diff line change
@@ -1,61 +1,10 @@
#!/usr/bin/env bash

# Reference: https://github.com/foundry-rs/foundry/blob/master/foundryup/install

set -e

echo "🚀 Installing mips-linux-muslsf-cross..." && echo

BASE_DIR=$HOME
MIPS_DIR=${MIPS_DIR-"$BASE_DIR/.mipsrust"}
MIPS_BIN_DIR="$MIPS_DIR/mips-linux-muslsf-cross/bin"

MIPS_TOOL_URL="http://musl.cc/mips-linux-muslsf-cross.tgz"

# Create the mips tool directory .
mkdir -p $MIPS_DIR

echo && echo "Downloading $MIPS_TOOL_URL..."
wget "$MIPS_TOOL_URL" -O "mips-linux-muslsf-cross.tgz"

if [ ! -f "mips-linux-muslsf-cross.tgz" ]; then
echo && echo "Download failed."
exit 1
fi

echo && echo "Unpacking to $MIPS_DIR..."
tar -xzf "mips-linux-muslsf-cross.tgz" -C "$MIPS_DIR"

if [ ! -d "$MIPS_BIN_DIR" ]; then
echo && echo "Unpack failed."
exit 1
fi

echo && echo "Cleaning up..."
rm "mips-linux-muslsf-cross.tgz"

CONFIG_FILE="$HOME/.cargo/config"

touch $CONFIG_FILE

TARGET_CONFIG="[target.mips-unknown-linux-musl]
linker = \"$MIPS_BIN_DIR/mips-linux-muslsf-gcc\"
rustflags = [\"--cfg\", 'target_os=\"zkvm\"',\"-C\", \"target-feature=+crt-static\", \"-C\", \"link-arg=-g\"]"

echo "🚀 Installing mips-zkm-zkvm-elf..." && echo

if [ -f "$CONFIG_FILE" ]; then

if grep -q "target.mips-unknown-linux-musl" "$CONFIG_FILE"; then
echo && echo "Target configuration already exists in $CONFIG_FILE."
else

echo && echo "$TARGET_CONFIG" >> "$CONFIG_FILE"
echo && echo "Target configuration added to $CONFIG_FILE."
fi
else
echo && echo "$CONFIG_FILE does not exists, please check your rust setting."
exit 1
fi
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/zkMIPS/toolchain/refs/heads/main/setup.sh | sh

echo && echo "✅ Installation complete!"

0 comments on commit 57a3783

Please sign in to comment.