#!/usr/bin/env bash # Build the Singe manual from docs/Manual.adoc. # Produces docs/Manual.html and docs/Manual.pdf. The version comes from CMakeLists.txt. set -euo pipefail here=$(cd "$(dirname "$0")" && pwd) src=$here/docs/Manual.adoc if [[ ! -f $src ]]; then echo "error: $src not found" >&2 exit 1 fi for tool in asciidoctor asciidoctor-pdf; do if ! command -v "$tool" > /dev/null; then echo "error: $tool not found (gem install asciidoctor asciidoctor-pdf rouge)" >&2 exit 1 fi done version=$(sed -n 's/^project(singe2 VERSION \([0-9.]*\).*/\1/p' "$here/CMakeLists.txt") asciidoctor -a revnumber="$version" "$src" -o "$here/docs/Manual.html" asciidoctor-pdf -a revnumber="$version" "$src" -o "$here/docs/Manual.pdf" echo "built:" ls -la "$here/docs/Manual.html" "$here/docs/Manual.pdf"