sovereign-router / scripts /build-all-components.sh
SNAPKITTYWEST's picture
Add sovereign-router source: router-server.mjs, kernel-registry, agent-registry, omega-field, MAGMA verbs
931572e verified
Raw
History Blame Contribute Delete
7.41 kB
#!/usr/bin/env bash
# Master build script for SNAPKITTYWEST sovereign compute stack
# Builds all components: Haskell, C++, C#, OCaml
set -euo pipefail
echo "============================================"
echo "SNAPKITTYWEST Sovereign Compute Stack Build"
echo "============================================"
echo ""
# Track results
HASKELL_OK=0
CPP_OK=0
CSHARP_OK=0
OCAML_OK=0
# ════════════════════════════════════════════════════════════════
# Phase 1: Haskell Datalog Engine
# ════════════════════════════════════════════════════════════════
echo "Phase 1: Haskell Datalog Engine"
echo "--------------------------------"
if command -v ghc &> /dev/null; then
echo " GHC found: $(ghc --version)"
# Check for cabal
if command -v cabal &> /dev/null; then
echo " Building Haskell Datalog Engine..."
cd errant/datalog
if cabal build; then
echo " βœ“ Haskell Datalog Engine built successfully"
HASKELL_OK=1
else
echo " βœ— Haskell Datalog Engine build failed"
fi
cd ../..
else
echo " βœ— cabal not found"
fi
else
echo " βœ— GHC not found (Haskell build skipped)"
fi
echo ""
# ════════════════════════════════════════════════════════════════
# Phase 2: C++ Modules
# ════════════════════════════════════════════════════════════════
echo "Phase 2: C++ Modules"
echo "--------------------"
if command -v cmake &> /dev/null; then
echo " CMake found: $(cmake --version | head -1)"
# Check for Ninja or Make
if command -v ninja &> /dev/null; then
GENERATOR="Ninja"
elif command -v make &> /dev/null; then
GENERATOR="Unix Makefiles"
else
GENERATOR="Visual Studio 17 2022"
fi
echo " Generator: $GENERATOR"
echo " Building C++ modules..."
cd sovereign-utqc/cpp
mkdir -p build
if cmake -S . -B build -G "$GENERATOR" && cmake --build build; then
echo " βœ“ C++ modules built successfully"
CPP_OK=1
else
echo " βœ— C++ modules build failed"
fi
cd ../..
else
echo " βœ— CMake not found (C++ build skipped)"
fi
echo ""
# ════════════════════════════════════════════════════════════════
# Phase 3: C# AGT
# ════════════════════════════════════════════════════════════════
echo "Phase 3: C# AGT"
echo "----------------"
if command -v dotnet &> /dev/null; then
echo " .NET found: $(dotnet --version)"
echo " Building C# AGT..."
cd sovereign-utqc/csharp
if dotnet build SnapKitty.AGT.slnx --configuration Release; then
echo " βœ“ C# AGT built successfully"
echo " Running tests..."
if dotnet test SnapKitty.AGT.slnx --configuration Release --no-build; then
echo " βœ“ C# AGT tests passed"
CSHARP_OK=1
else
echo " βœ— C# AGT tests failed"
fi
else
echo " βœ— C# AGT build failed"
fi
cd ../..
else
echo " βœ— .NET not found (C# build skipped)"
fi
echo ""
# ════════════════════════════════════════════════════════════════
# Phase 4: OCaml snap-prism
# ════════════════════════════════════════════════════════════════
echo "Phase 4: OCaml snap-prism"
echo "-------------------------"
if command -v dune &> /dev/null; then
echo " dune found: $(dune --version)"
echo " Building OCaml snap-prism..."
cd sovereign-utqc/snap-prism-ocaml
if dune build; then
echo " βœ“ OCaml snap-prism built successfully"
echo " Running tests..."
if dune runtest; then
echo " βœ“ OCaml snap-prism tests passed"
OCAML_OK=1
else
echo " βœ— OCaml snap-prism tests failed"
fi
else
echo " βœ— OCaml snap-prism build failed"
fi
cd ../..
else
echo " βœ— dune not found (OCaml build skipped)"
fi
echo ""
# ════════════════════════════════════════════════════════════════
# Phase 5: Rust Workspaces
# ════════════════════════════════════════════════════════════════
echo "Phase 5: Rust Workspaces"
echo "------------------------"
if command -v cargo &> /dev/null; then
echo " Cargo found: $(cargo --version)"
echo " Building sovereign-utqc..."
if cargo test --manifest-path sovereign-utqc/Cargo.toml --workspace; then
echo " βœ“ sovereign-utqc tests passed"
else
echo " βœ— sovereign-utqc tests failed"
fi
echo " Building sovereign-llm..."
if cargo test --manifest-path sovereign-llm/Cargo.toml --workspace; then
echo " βœ“ sovereign-llm tests passed"
else
echo " βœ— sovereign-llm tests failed"
fi
else
echo " βœ— Cargo not found (Rust build skipped)"
fi
echo ""
# ════════════════════════════════════════════════════════════════
# Summary
# ════════════════════════════════════════════════════════════════
echo "============================================"
echo "Build Summary"
echo "============================================"
echo ""
echo " Haskell Datalog: $([ $HASKELL_OK -eq 1 ] && echo 'βœ“ PASS' || echo 'βœ— FAIL')"
echo " C++ Modules: $([ $CPP_OK -eq 1 ] && echo 'βœ“ PASS' || echo 'βœ— FAIL')"
echo " C# AGT: $([ $CSHARP_OK -eq 1 ] && echo 'βœ“ PASS' || echo 'βœ— FAIL')"
echo " OCaml snap-prism: $([ $OCAML_OK -eq 1 ] && echo 'βœ“ PASS' || echo 'βœ— FAIL')"
echo ""
# Calculate total
TOTAL=$((HASKELL_OK + CPP_OK + CSHARP_OK + OCAML_OK))
echo " Total: $TOTAL/4 components built successfully"
echo ""
if [ $TOTAL -eq 4 ]; then
echo "All components built successfully!"
exit 0
else
echo "Some components failed to build."
exit 1
fi