File size: 7,405 Bytes
931572e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/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