mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Autotools: read git commit hash at compile time
Also do as cmake to avoid full recompilation when the hash changes.
This commit is contained in:
parent
489cdae255
commit
0b09424017
@ -39,16 +39,6 @@ esac
|
|||||||
AC_SUBST(lyx_devel_version)
|
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 Define the option to set a LyX version on installed executables and directories
|
||||||
dnl
|
dnl
|
||||||
|
@ -35,8 +35,6 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8] LYX_OBJECTS_LAYOUT)
|
|||||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||||
PACKAGE=$save_PACKAGE
|
PACKAGE=$save_PACKAGE
|
||||||
|
|
||||||
LYX_CHECK_GIT_COMMIT
|
|
||||||
|
|
||||||
# Allow to build some parts of the code as one big chunk
|
# Allow to build some parts of the code as one big chunk
|
||||||
m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
|
m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
|
||||||
AC_ARG_ENABLE(monolithic-build,
|
AC_ARG_ENABLE(monolithic-build,
|
||||||
@ -327,7 +325,6 @@ AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
|
|||||||
"${version_suffix}",[Program version suffix])
|
"${version_suffix}",[Program version suffix])
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
|
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([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_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])
|
AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
|
||||||
|
@ -11,7 +11,8 @@ endif
|
|||||||
|
|
||||||
SUBDIRS = support frontends . $(CLIENT) tex2lyx
|
SUBDIRS = support frontends . $(CLIENT) tex2lyx
|
||||||
|
|
||||||
EXTRA_DIST = pch.h \
|
EXTRA_DIST = lyx_commit_hash.h.in \
|
||||||
|
pch.h \
|
||||||
CMakeLists.txt \
|
CMakeLists.txt \
|
||||||
graphics/CMakeLists.txt \
|
graphics/CMakeLists.txt \
|
||||||
insets/CMakeLists.txt \
|
insets/CMakeLists.txt \
|
||||||
@ -302,6 +303,13 @@ HEADERFILESCORE = \
|
|||||||
STANDALONEFILES = \
|
STANDALONEFILES = \
|
||||||
Layout.cpp
|
Layout.cpp
|
||||||
|
|
||||||
|
.PHONY: lyx_commit_hash.h
|
||||||
|
|
||||||
|
lyx_commit_hash.h:
|
||||||
|
$(AM_V_GEN)hash=`cd "$(top_srcdir)" && git log -1 --pretty=format:%H 2>/dev/null || echo none` ; \
|
||||||
|
sed s/@LYX_GIT_COMMIT_HASH@/$$hash/ "$(srcdir)"/lyx_commit_hash.h.in >$@
|
||||||
|
BUILT_SOURCES += lyx_commit_hash.h
|
||||||
|
CLEANFILES += lyx_commit_hash.h
|
||||||
|
|
||||||
lyxcore.cpp:
|
lyxcore.cpp:
|
||||||
@echo -e '$(SOURCEFILESCORE:%=\n#include "%")\n' > $@
|
@echo -e '$(SOURCEFILESCORE:%=\n#include "%")\n' > $@
|
||||||
@ -336,7 +344,7 @@ BUILT_SOURCES += $(MOCEDFILES)
|
|||||||
CLEANFILES += $(MOCEDFILES)
|
CLEANFILES += $(MOCEDFILES)
|
||||||
|
|
||||||
moc_%.cpp: %.h
|
moc_%.cpp: %.h
|
||||||
$(QT_MOC) $(MOCFLAG) -o $@ $<
|
$(AM_V_GEN)$(QT_MOC) $(MOCFLAG) -o $@ $<
|
||||||
|
|
||||||
liblyxcore_a_DEPENDENCIES = $(MOCEDFILES)
|
liblyxcore_a_DEPENDENCIES = $(MOCEDFILES)
|
||||||
|
|
||||||
|
16
src/lyx_commit_hash.h.in
Normal file
16
src/lyx_commit_hash.h.in
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* \file lyx_commit_hash.h
|
||||||
|
* This file is part of LyX, the document processor.
|
||||||
|
* Licence details can be found in the file COPYING.
|
||||||
|
*
|
||||||
|
* If LyX is compiled from a git clone, this should contain the HEAD
|
||||||
|
* commit hash.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LYX_COMMIT_HASH_H
|
||||||
|
#define _LYX_COMMIT_HASH_H
|
||||||
|
|
||||||
|
#define LYX_GIT_COMMIT_HASH "@LYX_GIT_COMMIT_HASH@"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -10,11 +10,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if ! defined(LYX_DATE)
|
#if ! defined(LYX_DATE)
|
||||||
#include <lyx_date.h>
|
#include "lyx_date.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined(LYX_GIT_COMMIT_HASH)
|
#if ! defined(LYX_GIT_COMMIT_HASH)
|
||||||
#include <lyx_commit_hash.h>
|
#include "lyx_commit_hash.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user