#!/bin/bash
# Build script for NIP (optimized)

echo "🔨 Building NIP..."
echo ""

# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"

# Compile the binary
nim c --opt:speed --mm:arc -d:release -o:nip nip.nim

if [ $? -eq 0 ]; then
    echo ""
    echo "✅ Build successful!"
    echo "📦 Binary: ./nip"
    echo ""
    echo "Try it:"
    echo "  ./nip --help"
    echo "  ./nip graft nix:hello"
else
    echo ""
    echo "❌ Build failed!"
    exit 1
fi
