SNAPKITTYWEST's picture
chore: push full sov-kernel-monster content from local build
9425aed verified
Raw History Blame Contribute Delete
1.1 kB
#!/bin/bash
#
# Build Sovereign WASM Operations
# Compiles Rust source to WASM using wasm-pack
#
# Output: ../dist/ directory with bundler-compatible WASM
# Binary size target: <500KB (release)
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "Building Sovereign WASM Operations..."
echo "Target: wasm32-unknown-unknown (bundler-compatible)"
echo ""
# Build with wasm-pack
# --target bundler: Generates ES module format for bundlers (webpack, vite, etc.)
# --release: Optimized build with LTO and size optimization
# --out-dir: Output directory relative to Cargo.toml location
wasm-pack build \
--target bundler \
--release \
--out-dir dist/
echo ""
echo "Build complete!"
echo ""
# Report binary sizes
if [ -f "dist/sovereign_wasm_ops.wasm" ]; then
SIZE=$(ls -lh dist/sovereign_wasm_ops.wasm | awk '{print $5}')
echo "WASM binary size: $SIZE"
fi
# List all generated files
echo ""
echo "Generated files in dist/:"
ls -lh dist/ | grep -v "^total" | awk '{printf " %-40s %8s\n", $9, $5}'
echo ""
echo "✓ Ready for production"