Rename all project references from quicproquo/qpq to quicprochat/qpc across documentation, Docker configuration, CI workflows, packaging scripts, operational configs, and build tooling. - Docker: crate paths, binary names, user/group, data dirs, env vars - CI: workflow crate references, binary names, artifact names - Docs: all markdown files under docs/, SDK READMEs, book.toml - Packaging: OpenWrt Makefile, init script, UCI config (file renames) - Scripts: justfile, dev-shell, screenshot, cross-compile, ai_team - Operations: Prometheus config, alert rules, Grafana dashboard - Config: .env.example (QPQ_* → QPC_*), CODEOWNERS paths - Top-level: README, CONTRIBUTING, ROADMAP, CLAUDE.md
92 lines
2.6 KiB
Bash
Executable File
92 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Cross-compile quicprochat for musl targets (OpenWrt / embedded Linux).
|
|
#
|
|
# Produces statically linked, stripped binaries optimised for size.
|
|
# Requires: cargo-zigbuild (preferred) or cross.
|
|
#
|
|
# Usage:
|
|
# ./scripts/cross-compile.sh # all targets
|
|
# ./scripts/cross-compile.sh x86_64-unknown-linux-musl # single target
|
|
#
|
|
# Output: target/<triple>/release/qpc-server (stripped)
|
|
|
|
set -euo pipefail
|
|
|
|
TARGETS=(
|
|
x86_64-unknown-linux-musl
|
|
armv7-unknown-linux-musleabihf
|
|
aarch64-unknown-linux-musl
|
|
)
|
|
|
|
MAX_SIZE_MB=5
|
|
|
|
# Size-optimised release profile overrides.
|
|
export CARGO_PROFILE_RELEASE_OPT_LEVEL=s
|
|
export CARGO_PROFILE_RELEASE_LTO=true
|
|
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
|
|
export CARGO_PROFILE_RELEASE_STRIP=symbols
|
|
|
|
# Detect build tool.
|
|
if command -v cargo-zigbuild &>/dev/null; then
|
|
BUILD_CMD="cargo zigbuild"
|
|
elif command -v cross &>/dev/null; then
|
|
BUILD_CMD="cross build"
|
|
else
|
|
echo "ERROR: Install cargo-zigbuild or cross first:" >&2
|
|
echo " cargo install cargo-zigbuild # recommended" >&2
|
|
echo " cargo install cross # alternative" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# If arguments provided, use those as targets.
|
|
if [ $# -gt 0 ]; then
|
|
TARGETS=("$@")
|
|
fi
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
cd "$PROJECT_ROOT"
|
|
|
|
echo "=== quicprochat cross-compilation ==="
|
|
echo "Build tool: $BUILD_CMD"
|
|
echo "Targets: ${TARGETS[*]}"
|
|
echo ""
|
|
|
|
FAILED=()
|
|
for target in "${TARGETS[@]}"; do
|
|
echo "--- Building for $target ---"
|
|
if $BUILD_CMD --release --target "$target" --bin qpc-server; then
|
|
BINARY="target/$target/release/qpc-server"
|
|
if [ -f "$BINARY" ]; then
|
|
SIZE=$(stat -c%s "$BINARY" 2>/dev/null || stat -f%z "$BINARY")
|
|
SIZE_MB=$(echo "scale=2; $SIZE / 1048576" | bc)
|
|
MAX_BYTES=$((MAX_SIZE_MB * 1048576))
|
|
echo " Binary: $BINARY"
|
|
echo " Size: ${SIZE_MB} MB"
|
|
if [ "$SIZE" -gt "$MAX_BYTES" ]; then
|
|
echo " WARNING: Binary exceeds ${MAX_SIZE_MB} MB size limit!"
|
|
FAILED+=("$target (size: ${SIZE_MB} MB)")
|
|
else
|
|
echo " OK: within ${MAX_SIZE_MB} MB limit"
|
|
fi
|
|
else
|
|
echo " ERROR: Binary not found at $BINARY"
|
|
FAILED+=("$target (binary not found)")
|
|
fi
|
|
else
|
|
echo " ERROR: Build failed for $target"
|
|
FAILED+=("$target (build failed)")
|
|
fi
|
|
echo ""
|
|
done
|
|
|
|
if [ ${#FAILED[@]} -gt 0 ]; then
|
|
echo "=== FAILURES ==="
|
|
for f in "${FAILED[@]}"; do
|
|
echo " - $f"
|
|
done
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== All targets built successfully ==="
|