function go() {

PACKAGE_NAME=$1
PACKAGE_VERSION=$2
ARCHIVE_EXT=$3

URI_PREFIX="http://downloads.sourceforge.net/${PACKAGE_NAME}/"
URI_BASE="${PACKAGE_NAME}-${PACKAGE_VERSION}"
URI_FILE="${URI_BASE}${ARCHIVE_EXT}"
INI_FILE="${PACKAGE_NAME}.ini"
QCH_FILE="${PACKAGE_NAME}-${PACKAGE_VERSION}-doc.qch"
QHP_FILE="${PACKAGE_NAME}-${PACKAGE_VERSION}-doc.qhp"

HPP_FILE="html/index.hhp"
HPP_LOCATION="${URI_BASE}/doc/${HPP_FILE}"

## Download
if [ ! -f "${URI_FILE}" ]; then
    wget "${URI_PREFIX}${URI_FILE}" || exit 1
fi

## Unpack
if [ ! -d "${URI_BASE}" ]; then
    tar xf "${URI_FILE}"
fi

pushd "${URI_BASE}/doc" || exit 1

## Make temp file
TEMPFILE=`mktemp`
if [ "x${TEMPFILE}" = x ]; then
    popd ; exit 1
fi

## Fix Doxygen input
sed -e 's/^\(GENERATE_HTMLHELP\).\+$/\1 = YES/' -e 's/^\(HHC_LOCATION.\+\)$/# \1/' Doxyfile > "${TEMPFILE}"
rm Doxyfile
mv "${TEMPFILE}" Doxyfile || { popd ; exit 1 ; }

## Create Doxygen output
if [ ! -f "${HPP_FILE}" ]; then
    doxygen || { popd ; exit 1 ; }
fi

popd || exit 1


## Create Qt help files
LD_LIBRARY_PATH=$QTDIR/lib ../doxygen2qthelp "--config=${INI_FILE}" \
    --qch "${HPP_LOCATION}" "${QCH_FILE}" || exit 1

LD_LIBRARY_PATH=$QTDIR/lib ../doxygen2qthelp "--config=${INI_FILE}" \
    --qhp "${HPP_LOCATION}" "${QHP_FILE}" || exit 1

exit 0

}

