#!/bin/sh set -eu # Top-level build script — builds all ZDDC HTML tools, the zddc-server # binaries, and the downloadable bundles (install.zip and track-*.zip). SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) echo "=== Building ZDDC tools ===" sh "$SCRIPT_DIR/transmittal/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/archive/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/classifier/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/mdedit/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/landing/build.sh" "${1:-}" "${2:-}" echo "" echo "=== Building zddc-server binaries ===" mkdir -p "$SCRIPT_DIR/zddc/dist/web" podman build --target binaries -o "$SCRIPT_DIR/zddc/dist/" "$SCRIPT_DIR/zddc/" 2>&1 | grep -v "^-->" echo "" echo "=== Assembling zddc/dist/web/ ===" # Only landing and archive ship inside the server bundle: they call the # server's JSON API (GET / for the project list, directory listings for the # archive) and are useless without it. transmittal, classifier, and mdedit # are pure client-side tools that work from file:// or any static host; # they are released to website/ for download but not bundled with the server. cp "$SCRIPT_DIR/landing/dist/index.html" "$SCRIPT_DIR/zddc/dist/web/index.html" cp "$SCRIPT_DIR/archive/dist/archive.html" "$SCRIPT_DIR/zddc/dist/web/archive.html" echo "Wrote zddc/dist/web/index.html" echo "Wrote zddc/dist/web/archive.html" # ─── Bootstrap zips ────────────────────────────────────────────────────────── # Generated from bootstrap/level{1,2}.html.tmpl on every build so they are # always in sync with the current bootstrap pattern. # # install.zip — drop into deployment root for self-contained install. # Contains the 5 current-stable HTMLs at root plus a # _template/ directory with 4 level-1 stubs that # projects can use as their starting layout. # track-.zip — drop the level-2 stubs over deployment root to make # the whole site track from zddc.varasys.io. # # install.zip needs at least one stable release to exist under # website/releases/; if none exist yet, that zip is skipped with a warning. WEBSITE_DIR="$SCRIPT_DIR/website" RELEASES_DIR="$WEBSITE_DIR/releases" BOOTSTRAP_DIR="$SCRIPT_DIR/bootstrap" mkdir -p "$WEBSITE_DIR" # tool|filename|title TOOL_TABLE='archive|archive.html|Archive transmittal|transmittal.html|Transmittal classifier|classifier.html|Classifier mdedit|mdedit.html|Markdown Editor landing|index.html|ZDDC' # Substitute {{TOOL}}, {{TOOL_TITLE}}, {{CHANNEL}} in a template. # Substitute {{TOOL}}, {{TOOL_TITLE}}, {{CHANNEL}} in a template. render_stub() { sed \ -e "s|{{TOOL_TITLE}}|$3|g" \ -e "s|{{TOOL}}|$2|g" \ -e "s|{{CHANNEL}}|${4:-}|g" \ "$1" > "$5" } build_install_zip() { # Verify a stable release exists for every tool before staging. _missing="" while IFS='|' read -r _tool _file _title; do [ -e "$RELEASES_DIR/${_tool}_latest.html" ] || _missing="$_missing $_tool" done <