Include the git commit SHA1 in the version number.

For bug reports it's very convenient to know the exact version. For
release builds, the standard version triplet (major.minor.micro) is
more than sufficient, but that's not the case for development builds.
Due to the post-release version increment, development builds already
have a version number that is distinct from previous releases, but
including the git commit SHA1 is even more accurate.

On Windows, the git commit SHA1 is also embedded in the version
resource.
This commit is contained in:
Jef Driesen 2012-12-27 16:23:42 +01:00
parent 56b7730773
commit e2a7d8bb45
4 changed files with 35 additions and 1 deletions

View File

@ -106,6 +106,11 @@ AC_SUBST([DC_VERSION_MINOR],[dc_version_minor])
AC_SUBST([DC_VERSION_MICRO],[dc_version_micro])
AC_SUBST([DC_VERSION_LIBTOOL],[dc_version_lt_current:dc_version_lt_revision:dc_version_lt_age])
# Version suffix.
m4_ifset([dc_version_suffix],[
AC_DEFINE(HAVE_VERSION_SUFFIX, [1], [Define if a version suffix is present.])
])
AC_CONFIG_FILES([
libdivecomputer.pc
Makefile

View File

@ -77,6 +77,8 @@ libdivecomputer.exp: libdivecomputer.symbols
.rc.lo:
$(AM_V_GEN) $(LIBTOOL) --silent --tag=RC --mode=compile $(RC) $< -o $@
libdivecomputer.lo: revision.h
FORCE:
$(top_srcdir)/revision: FORCE
@if (test -d $(top_srcdir)/.git && cd $(top_srcdir) \

View File

@ -1,10 +1,22 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winver.h>
#ifdef HAVE_VERSION_SUFFIX
#include "revision.h"
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION @DC_VERSION_MAJOR@,@DC_VERSION_MINOR@,@DC_VERSION_MICRO@,0
PRODUCTVERSION @DC_VERSION_MAJOR@,@DC_VERSION_MINOR@,@DC_VERSION_MICRO@,0
FILEFLAGSMASK 0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef HAVE_VERSION_SUFFIX
FILEFLAGS VS_FF_PRERELEASE
#else
FILEFLAGS 0
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0
@ -21,6 +33,9 @@ BEGIN
VALUE "OriginalFilename", "libdivecomputer.dll"
VALUE "ProductName", "libdivecomputer"
VALUE "ProductVersion", "@VERSION@"
#ifdef HAVE_VERSION_SUFFIX
VALUE "Comments", DC_VERSION_REVISION
#endif
END
END
BLOCK "VarFileInfo"

View File

@ -19,8 +19,16 @@
* MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <libdivecomputer/version.h>
#ifdef HAVE_VERSION_SUFFIX
#include "revision.h"
#endif
const char *
dc_version (dc_version_t *version)
{
@ -30,7 +38,11 @@ dc_version (dc_version_t *version)
version->micro = DC_VERSION_MICRO;
}
#ifdef HAVE_VERSION_SUFFIX
return DC_VERSION " (" DC_VERSION_REVISION ")";
#else
return DC_VERSION;
#endif
}
int