2026-02-03 21:35:00 +00:00
|
|
|
# ╔══════════════════════════════════════════════════════════════════════╗
|
|
|
|
|
# ║ DISTRIBUTION & PACKAGING RECIPES ║
|
|
|
|
|
# ║ Targets, cross-compilation, and distribution ║
|
|
|
|
|
# ╚══════════════════════════════════════════════════════════════════════╝
|
|
|
|
|
|
|
|
|
|
distro-help:
|
|
|
|
|
@echo "DISTRIBUTION & TARGET MODULE"
|
|
|
|
|
@echo ""
|
|
|
|
|
@echo "Targets:"
|
|
|
|
|
@echo " just distro::list-targets List installed Rust targets"
|
|
|
|
|
@echo " just distro::install-targets Install common cross-compile targets"
|
|
|
|
|
@echo " just distro::install-target TGT Install specific target"
|
|
|
|
|
@echo ""
|
|
|
|
|
@echo "Build:"
|
|
|
|
|
@echo " just distro::build-target TGT Build for specific target"
|
|
|
|
|
@echo " just distro::build-all-targets Build for all installed targets"
|
|
|
|
|
@echo ""
|
|
|
|
|
@echo "Installation:"
|
2026-02-17 23:15:12 +00:00
|
|
|
@echo " just distro::install Install server binaries to ~/.local/bin"
|
2026-02-03 21:35:00 +00:00
|
|
|
@echo " just distro::install DIR=/path Install to custom directory"
|
2026-02-17 23:15:12 +00:00
|
|
|
@echo " just distro::install UI=true Also build frontend (trunk --release)"
|
|
|
|
|
@echo ""
|
|
|
|
|
@echo " Binaries installed: vapora-backend, vapora-agents, vapora-mcp-server,"
|
|
|
|
|
@echo " vapora-a2a, vapora (CLI)"
|
2026-02-03 21:35:00 +00:00
|
|
|
@echo ""
|
|
|
|
|
@echo "Utilities:"
|
|
|
|
|
@echo " just distro::clean-targets Clean target build artifacts"
|
|
|
|
|
|
|
|
|
|
WORKSPACE_ROOT := justfile_directory()
|
|
|
|
|
|
|
|
|
|
# === TARGETS ===
|
|
|
|
|
|
|
|
|
|
[doc("List installed Rust targets")]
|
|
|
|
|
list-targets:
|
|
|
|
|
@echo "=== Installed Rust Targets ==="
|
|
|
|
|
rustup target list | grep installed
|
|
|
|
|
@echo ""
|
|
|
|
|
@echo "Common VAPORA targets:"
|
|
|
|
|
@echo " x86_64-unknown-linux-gnu Linux x86_64 (default)"
|
|
|
|
|
@echo " x86_64-apple-darwin macOS Intel"
|
|
|
|
|
@echo " aarch64-apple-darwin macOS ARM64 (Apple Silicon)"
|
|
|
|
|
@echo " aarch64-unknown-linux-gnu Linux ARM64"
|
|
|
|
|
@echo " x86_64-pc-windows-gnu Windows x86_64"
|
2026-02-17 23:15:12 +00:00
|
|
|
@echo " wasm32-unknown-unknown WebAssembly (frontend)"
|
2026-02-03 21:35:00 +00:00
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
[doc("Install common cross-compile targets including wasm32")]
|
2026-02-03 21:35:00 +00:00
|
|
|
install-targets:
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
|
|
|
|
echo "=== Installing Rust targets ==="
|
|
|
|
|
TARGETS=(
|
|
|
|
|
"x86_64-unknown-linux-gnu"
|
|
|
|
|
"x86_64-apple-darwin"
|
|
|
|
|
"aarch64-apple-darwin"
|
|
|
|
|
"aarch64-unknown-linux-gnu"
|
|
|
|
|
"x86_64-pc-windows-gnu"
|
2026-02-17 23:15:12 +00:00
|
|
|
"wasm32-unknown-unknown"
|
2026-02-03 21:35:00 +00:00
|
|
|
)
|
|
|
|
|
for target in "${TARGETS[@]}"; do
|
2026-02-17 23:15:12 +00:00
|
|
|
if rustup target list --installed | grep -q "$target"; then
|
|
|
|
|
echo " ✓ $target (already installed)"
|
|
|
|
|
else
|
|
|
|
|
echo " Installing $target..."
|
|
|
|
|
rustup target add "$target"
|
|
|
|
|
fi
|
2026-02-03 21:35:00 +00:00
|
|
|
done
|
|
|
|
|
echo "✓ Targets installed"
|
|
|
|
|
|
|
|
|
|
[doc("Install specific Rust target")]
|
|
|
|
|
install-target TARGET:
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
|
|
|
|
echo "=== Installing target: {{TARGET}} ==="
|
|
|
|
|
rustup target add "{{TARGET}}"
|
|
|
|
|
echo "✓ {{TARGET}} installed"
|
|
|
|
|
|
|
|
|
|
# === BUILD ===
|
|
|
|
|
|
|
|
|
|
[doc("Build for specific target")]
|
|
|
|
|
build-target TARGET:
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
|
|
|
|
echo "=== Building for {{TARGET}} (release) ==="
|
|
|
|
|
cd "{{ WORKSPACE_ROOT }}"
|
|
|
|
|
cargo build --release --target "{{TARGET}}" --workspace
|
|
|
|
|
echo "✓ Build complete for {{TARGET}}"
|
|
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
[doc("Build for all installed targets (excludes wasm32 — use frontend-build-release for that)")]
|
2026-02-03 21:35:00 +00:00
|
|
|
build-all-targets:
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
2026-02-17 23:15:12 +00:00
|
|
|
echo "=== Building for all native targets ==="
|
2026-02-03 21:35:00 +00:00
|
|
|
cd "{{ WORKSPACE_ROOT }}"
|
2026-02-17 23:15:12 +00:00
|
|
|
TARGETS=$(rustup target list --installed | grep -v wasm32)
|
2026-02-03 21:35:00 +00:00
|
|
|
for target in $TARGETS; do
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Building for $target..."
|
|
|
|
|
cargo build --release --target "$target" --workspace || {
|
|
|
|
|
echo "✗ Build failed for $target"
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
echo "✓ $target complete"
|
|
|
|
|
done
|
|
|
|
|
echo ""
|
2026-02-17 23:15:12 +00:00
|
|
|
echo "✓ All native target builds complete"
|
2026-02-03 21:35:00 +00:00
|
|
|
|
|
|
|
|
# === INSTALLATION ===
|
|
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
# Build and install all release binaries.
|
|
|
|
|
#
|
|
|
|
|
# Usage:
|
|
|
|
|
# just distro::install → ~/.local/bin, native only
|
|
|
|
|
# just distro::install DIR=/usr/local/bin → custom dir, native only
|
|
|
|
|
# just distro::install UI=true → ~/.local/bin + trunk --release
|
|
|
|
|
# just distro::install DIR=/opt UI=true → custom dir + trunk --release
|
|
|
|
|
#
|
|
|
|
|
# Binaries: vapora-backend, vapora-agents, vapora-mcp-server, vapora-a2a, vapora (CLI)
|
|
|
|
|
[doc("Build and install server binaries (DIR=path, UI=true for frontend)")]
|
|
|
|
|
install DIR="" UI="false":
|
2026-02-03 21:35:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
WORKSPACE="{{ WORKSPACE_ROOT }}"
|
|
|
|
|
WORKSPACE="$(cd "$WORKSPACE" && pwd)" || { echo "✗ Failed to access workspace"; exit 1; }
|
|
|
|
|
|
|
|
|
|
if [ -z "{{ DIR }}" ]; then
|
|
|
|
|
INSTALL_DIR="$HOME/.local/bin"
|
|
|
|
|
else
|
|
|
|
|
INSTALL_DIR="{{ DIR }}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "=== Building and Installing VAPORA binaries ==="
|
2026-02-17 23:15:12 +00:00
|
|
|
echo "Workspace: $WORKSPACE"
|
2026-02-03 21:35:00 +00:00
|
|
|
echo "Install directory: $INSTALL_DIR"
|
2026-02-17 23:15:12 +00:00
|
|
|
echo "Frontend (UI): {{ UI }}"
|
2026-02-03 21:35:00 +00:00
|
|
|
echo ""
|
|
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
# Build all server binaries in one pass (Cargo deduplicates shared deps)
|
|
|
|
|
echo "Building release binaries..."
|
|
|
|
|
cd "$WORKSPACE"
|
|
|
|
|
cargo build --release \
|
|
|
|
|
-p vapora-backend \
|
|
|
|
|
-p vapora-agents \
|
|
|
|
|
-p vapora-mcp-server \
|
|
|
|
|
-p vapora-a2a \
|
|
|
|
|
-p vapora-cli \
|
|
|
|
|
--quiet
|
|
|
|
|
echo "✓ Native binaries built"
|
2026-02-03 21:35:00 +00:00
|
|
|
echo ""
|
|
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
# Optionally build the Leptos frontend via trunk
|
|
|
|
|
if [ "{{ UI }}" = "true" ]; then
|
|
|
|
|
if ! command -v trunk &>/dev/null; then
|
|
|
|
|
echo "✗ trunk not found. Install with: cargo install trunk"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
echo "Building frontend (trunk --release)..."
|
|
|
|
|
cd "$WORKSPACE/crates/vapora-frontend"
|
|
|
|
|
trunk build --release
|
|
|
|
|
echo "✓ Frontend built → $WORKSPACE/crates/vapora-frontend/dist"
|
|
|
|
|
cd "$WORKSPACE"
|
|
|
|
|
echo ""
|
|
|
|
|
fi
|
2026-02-03 21:35:00 +00:00
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
# Copy binaries to install dir
|
|
|
|
|
mkdir -p "$INSTALL_DIR" || { echo "✗ Failed to create $INSTALL_DIR"; exit 1; }
|
|
|
|
|
echo "Installing to $INSTALL_DIR..."
|
2026-02-03 21:35:00 +00:00
|
|
|
|
|
|
|
|
declare -a BINARIES=(
|
|
|
|
|
"vapora-backend"
|
|
|
|
|
"vapora-agents"
|
|
|
|
|
"vapora-mcp-server"
|
2026-02-17 23:15:12 +00:00
|
|
|
"vapora-a2a"
|
2026-02-03 21:35:00 +00:00
|
|
|
"vapora"
|
|
|
|
|
)
|
|
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
INSTALLED=0
|
|
|
|
|
MISSING=0
|
2026-02-03 21:35:00 +00:00
|
|
|
for BIN_NAME in "${BINARIES[@]}"; do
|
|
|
|
|
BIN_PATH="$WORKSPACE/target/release/$BIN_NAME"
|
|
|
|
|
if [ -f "$BIN_PATH" ]; then
|
|
|
|
|
cp "$BIN_PATH" "$INSTALL_DIR/"
|
|
|
|
|
chmod +x "$INSTALL_DIR/$BIN_NAME"
|
|
|
|
|
echo " ✓ $BIN_NAME"
|
|
|
|
|
INSTALLED=$((INSTALLED + 1))
|
2026-02-17 23:15:12 +00:00
|
|
|
else
|
|
|
|
|
echo " ✗ $BIN_NAME (not found in target/release — build may have failed)"
|
|
|
|
|
MISSING=$((MISSING + 1))
|
2026-02-03 21:35:00 +00:00
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo ""
|
2026-02-17 23:15:12 +00:00
|
|
|
if [ "$INSTALLED" -eq 0 ]; then
|
2026-02-03 21:35:00 +00:00
|
|
|
echo "✗ No binaries were installed"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-02-17 23:15:12 +00:00
|
|
|
if [ "$MISSING" -gt 0 ]; then
|
|
|
|
|
echo "⚠ $MISSING binaries missing — check build output above"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "✓ Installation complete ($INSTALLED/$((INSTALLED + MISSING)) binaries)"
|
2026-02-03 21:35:00 +00:00
|
|
|
echo ""
|
2026-02-17 23:15:12 +00:00
|
|
|
echo "Install dir: $INSTALL_DIR"
|
2026-02-03 21:35:00 +00:00
|
|
|
|
|
|
|
|
if echo "$INSTALL_DIR" | grep -q "\.local/bin"; then
|
2026-02-17 23:15:12 +00:00
|
|
|
echo ""
|
|
|
|
|
echo "Ensure PATH includes $INSTALL_DIR:"
|
|
|
|
|
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
|
2026-02-03 21:35:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo ""
|
2026-02-17 23:15:12 +00:00
|
|
|
echo "Verify:"
|
|
|
|
|
echo " $INSTALL_DIR/vapora-backend --help"
|
|
|
|
|
echo " $INSTALL_DIR/vapora-agents --help"
|
|
|
|
|
echo " $INSTALL_DIR/vapora-a2a --help"
|
|
|
|
|
|
|
|
|
|
if [ "{{ UI }}" = "true" ]; then
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Frontend dist: $WORKSPACE/crates/vapora-frontend/dist"
|
|
|
|
|
fi
|
2026-02-03 21:35:00 +00:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
# === UTILITIES ===
|
|
|
|
|
|
|
|
|
|
[doc("Clean all target build artifacts")]
|
|
|
|
|
clean-targets:
|
|
|
|
|
@echo "=== Cleaning target artifacts ==="
|
|
|
|
|
cd "{{ WORKSPACE_ROOT }}" && cargo clean
|
|
|
|
|
@echo "✓ Cleaned all targets"
|