Files
heartwood/scripts/build-man-pages.sh
T
cloudhead 95b5191533 Reproducible cross-compiled builds
Implement a new build pipeline using `podman` and `zig` that is
reproducible and can be run entirely on linux.

We also simplify the versioning system, defaulting to the output of `git
describe` when there are no exact tag matches.
2024-04-20 11:11:00 +02:00

50 lines
987 B
Bash
Executable File

#!/bin/sh
set -e
# Attempt to install `asciidoctor` on Debian, Arch Linux and MacOS.
install() {
os="$(uname)"
case "$os" in
Linux)
if command -v apt-get >/dev/null 2>&1; then
# Debian
apt-get update
apt-get install -y asciidoctor
elif command -v pacman >/dev/null 2>&1; then
# Arch Linux
pacman -Sy --noconfirm asciidoctor
fi ;;
Darwin) # MacOS
if command -v brew >/dev/null 2>&1; then
brew install asciidoctor
fi ;;
*)
echo "fatal: unknown operating system: $os"
exit 1 ;;
esac
}
main() {
if [ $# -lt 2 ]; then
echo "usage: $0 <output-dir> <input-file>..."
exit 1
fi
outdir="$1"
shift
if ! command -v asciidoctor >/dev/null 2>&1; then
echo "Installing 'asciidoctor'.."
install
fi
for input in "$@"; do
echo "Building $input.."
asciidoctor --doctype manpage --backend manpage --destination-dir "$outdir" "$input"
done
}
main "$@"