mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Add the git commit (if applicable) to LyX version
This only works for autotools right now, but adding that to cmake is trivial
This commit is contained in:
parent
d605048b5c
commit
8ecb96c09a
@ -8,9 +8,10 @@ dnl Usage LYX_CHECK_VERSION Displays version of LyX being built and
|
||||
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
|
||||
@ -38,6 +39,16 @@ esac
|
||||
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
|
||||
|
@ -35,6 +35,8 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8] LYX_OBJECTS_LAYOUT)
|
||||
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,
|
||||
@ -322,6 +324,7 @@ AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
|
||||
"${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])
|
||||
|
@ -1089,9 +1089,11 @@ int parse_version(string const &, string const &, string &)
|
||||
{
|
||||
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;
|
||||
|
@ -115,7 +115,12 @@ static QString version()
|
||||
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);
|
||||
@ -138,6 +143,9 @@ static QString buildinfo()
|
||||
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;
|
||||
|
||||
|
@ -20,6 +20,8 @@ extern char const * const lyx_version = PACKAGE_VERSION;
|
||||
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>])
|
||||
|
@ -20,6 +20,8 @@ extern char const * const lyx_version;
|
||||
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>])
|
||||
|
Loading…
Reference in New Issue
Block a user