#! /bin/bash

set -e
set -x

cd "$(mktemp -dt plumed.XXXXXX)"

git clone https://github.com/doxygen/doxygen.git

cd doxygen

if [ -n "$1" ] ; then
  echo "installing doxygen $version"
  version=$1
else
  echo "installing latest doxygen"
  version=$(git tag | tail -n 1)
fi

git checkout $version

mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/opt" ../
make -j 4
make install

cd ../

