shithub: opusfile

Download patch

ref: 3c7191a95f14df6a0d88649024c453807ec99c6b
parent: b8f50b4e1caa9ad805d0f4f341608dcabd6a64d7
author: Ralph Giles <[email protected]>
date: Mon Sep 17 21:05:43 EDT 2012

Embed the git revision in the doxygen documentation.

The simple git-version script asks git for the current
revision, and falls back to 'unknown' if the result is
empty. This will have little effect until we have tags
in the repository.

We use the FILE_VERSION_FILTER option on doxygen to
embed this in the documentation with each file reference.

Unfortunately, there doesn't seem to be a way to
set PROJECT_NUMBER globally in the same way. This
commit unsets that option to avoid confusing references
in the generated documentation.

--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -1,10 +1,12 @@
 # Process with doxygen to generate API documentation
 
 PROJECT_NAME           = "opusfile"
-PROJECT_NUMBER         = unknown
+PROJECT_NUMBER         =
 PROJECT_BRIEF          = "Stand alone decoder library for .opus files."
 INPUT                  = ../include/opusfile.h
 OPTIMIZE_OUTPUT_FOR_C  = YES
+
+FILE_VERSION_FILTER    = "/bin/sh git-version.sh"
 
 QUIET                  = YES
 WARNINGS               = YES
--- /dev/null
+++ b/doc/git-version.sh
@@ -1,0 +1,12 @@
+#!/bin/sh
+
+# script to build a version string
+
+GIT_VERSION=$(git describe --tags --dirty 2> /dev/null)
+if test -z ${GIT_VERSION}; then
+  VERSION='unknown'
+else
+  VERSION=${GIT_VERSION}
+fi
+
+echo ${VERSION}