dnl sets variable "build_type"
AC_DEFUN([LYX_CHECK_VERSION],[
echo "configuring LyX version" AC_PACKAGE_VERSION
+
+AC_MSG_CHECKING([for build type])
lyx_devel_version=no
lyx_prerelease=no
-AC_MSG_CHECKING([for build type])
AC_ARG_ENABLE(build-type,
AC_HELP_STRING([--enable-build-type=TYPE],[set build setting according to TYPE=rel(ease), pre(release), dev(elopment), prof(iling), gprof]),
[case $enableval in
AC_SUBST(lyx_devel_version)
])
+dnl If LyX is compiled from a git clone, find the HEAD commit hash
+dnl
+dnl
+AC_DEFUN([LYX_CHECK_GIT_COMMIT], [
+AC_MSG_CHECKING([for git commit hash])
+lyxgitcommit=`cd "$srcdir" && git log -1 --pretty=format:%H 2>/dev/null || true`
+test x$lyxgitcommit = x && lyxgitcommit="none"
+AC_MSG_RESULT($lyxgitcommit)
+])
+
dnl Define the option to set a LyX version on installed executables and directories
dnl
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
PACKAGE=$save_PACKAGE
+LYX_CHECK_GIT_COMMIT
+
# Allow to build some parts of the code as one big chunk
m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
AC_ARG_ENABLE(monolithic-build,
"${version_suffix}",[Program version suffix])
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
+AC_DEFINE_UNQUOTED([LYX_GIT_COMMIT_HASH], "$lyxgitcommit", [Git commit])
AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
{
cout << "LyX " << lyx_version
<< " (" << lyx_release_date << ")" << endl;
+ if (string(lyx_git_commit_hash) != "none")
+ cout << to_utf8(_(" Git commit hash "))
+ << string(lyx_git_commit_hash).substr(0,8) << endl;
cout << to_utf8(bformat(_("Built on %1$s[[date]], %2$s[[time]]"),
from_ascii(__DATE__), from_ascii(__TIME__))) << endl;
-
cout << lyx_version_info << endl;
exit(0);
return 0;
docstring version_date =
bformat(_("LyX Version %1$s\n(%2$s)"),
from_ascii(lyx_version),
- qstring_to_ucs4(loc_release_date))+"\n\n";
+ qstring_to_ucs4(loc_release_date))+"\n";
+ if (std::string(lyx_git_commit_hash) != "none")
+ version_date += _("Built from git commit hash ")
+ + from_utf8(lyx_git_commit_hash).substr(0,8);
+ version_date += "\n";
+
QString res;
QTextStream out(&res);
out << toqstr(version_date);
QTextStream out(&res);
out << "LyX " << lyx_version
<< " (" << lyx_release_date << ")" << endl;
+ if (std::string(lyx_git_commit_hash) != "none")
+ out << qt_(" Git commit hash ")
+ << QString(lyx_git_commit_hash).left(8) << endl;
out << toqstr(bformat(_("Built on %1$s[[date]], %2$s[[time]]"),
from_ascii(__DATE__), from_ascii(__TIME__))) << endl;
extern const int lyx_version_major = LYX_MAJOR_VERSION;
extern const int lyx_version_minor = LYX_MINOR_VERSION;
///
+extern char const * const lyx_git_commit_hash = LYX_GIT_COMMIT_HASH;
+///
extern char const * const lyx_release_date = LYX_DATE;
/// Package identifier (lyx[-<version-suffix>])
extern const int lyx_version_major;
extern const int lyx_version_minor;
///
+extern char const * const lyx_git_commit_hash;
+///
extern char const * const lyx_release_date;
/// Package identifier (lyx[-<version-suffix>])