#!/bin/bash # Build Archipelago Rust Backend echo "============================================" echo "Building Archipelago Backend" echo "============================================" echo "" # Check if Rust is installed if ! command -v rustc &> /dev/null; then echo "❌ Rust is not installed or not in PATH" echo "" echo "Installing Rust..." curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable # Source the cargo environment source "$HOME/.cargo/env" echo "✅ Rust installed" else echo "✅ Rust is already installed ($(rustc --version))" fi echo "" # Check if rustup default is set if ! rustc --version &> /dev/null 2>&1; then echo "⚙️ Configuring Rust default toolchain..." source "$HOME/.cargo/env" rustup default stable echo "✅ Rust configured" fi echo "" echo "Rust version: $(rustc --version)" echo "Cargo version: $(cargo --version)" echo "" # Navigate to core directory cd "$(dirname "$0")/core" || exit 1 echo "============================================" echo "Building Backend" echo "============================================" echo "" echo "This will take 5-10 minutes on first build..." echo "" # Build the backend cargo build --bin archipelago if [ $? -eq 0 ]; then echo "" echo "============================================" echo "✅ Backend Built Successfully!" echo "============================================" echo "" echo "You can now run the full stack:" echo "" echo "1. Start backend (Terminal 1):" echo " cd core" echo " cargo run --bin archipelago" echo "" echo "2. Start frontend (Terminal 2):" echo " cd neode-ui" echo " npm run dev" echo "" echo "3. Or use the dev script:" echo " ./scripts/dev-start.sh" echo " Choose option 2 (Full stack)" echo "" else echo "" echo "============================================" echo "❌ Backend Build Failed" echo "============================================" echo "" echo "Check the error messages above." echo "" echo "Common fixes:" echo "1. Make sure Rust is in PATH:" echo " source ~/.cargo/env" echo "" echo "2. Update Rust:" echo " rustup update" echo "" echo "3. Clean and rebuild:" echo " cargo clean" echo " cargo build --bin archipelago" echo "" fi