28 lines
851 B
Bash
Executable file
28 lines
851 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Build the Singe manual from docs/Manual.adoc.
|
|
# Produces .builddir/Manual.html and .builddir/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")
|
|
|
|
out=$here/.builddir
|
|
mkdir -p "$out"
|
|
asciidoctor -a revnumber="$version" "$src" -o "$out/Manual.html"
|
|
asciidoctor-pdf -a revnumber="$version" "$src" -o "$out/Manual.pdf"
|
|
|
|
echo "built:"
|
|
ls -la "$out/Manual.html" "$out/Manual.pdf"
|