#!/bin/bash

# This shell script and the accompanying Dockerfile are used by the project
# maintainers to create the precompiled doxygen binaries that are downloaded
# during the build. They are neither called during the build nor expected to be
# called by most developers or users of the project.

set -euxo pipefail

rm -f doxygen-*-*-x86_64.tar.gz doxygen-*-x86_64.tar.gz.sha256

docker build --build-arg UBUNTU_CODENAME=focal --tag doxygen-focal "${BASH_SOURCE%/*}"
trap 'docker rmi doxygen-focal' EXIT
docker run --detach --name doxygen-focal-build --tty doxygen-focal
trap 'docker rm -f doxygen-focal-build && docker rmi doxygen-focal' EXIT
docker cp doxygen-focal-build:$(docker exec doxygen-focal-build find /opt/doxygen/bin/ -maxdepth 1 -name 'doxygen-*-focal-x86_64.tar.gz') .

shasum --algorithm 256 doxygen-*-focal-x86_64.tar.gz | tee doxygen-focal-x86_64.tar.gz.sha256
