[gimp] app: define GIMP_GIT_LAST_COMMIT_{TIMESTAMP,YEAR} macros
- From: Nils Philippsen <nphilipp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: define GIMP_GIT_LAST_COMMIT_{TIMESTAMP,YEAR} macros
- Date: Tue, 28 Sep 2010 15:58:21 +0000 (UTC)
commit 37d98767423151430e42e88e33c7e7c7156c8b1d
Author: Nils Philippsen <nils redhat com>
Date: Fri Sep 17 11:52:45 2010 +0200
app: define GIMP_GIT_LAST_COMMIT_{TIMESTAMP,YEAR} macros
app/Makefile.am | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index 1f7e897..c68de37 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -268,10 +268,21 @@ dist-hook: dist-check-gimp-console dist-dump-gimprc
# in which case the git-version.h we ship is correct.
git-version.h: update-git-version-header
@if test -d "$(top_srcdir)/.git"; then \
- echo "#define GIMP_GIT_VERSION \"`git describe`\"" > "$ tmp"; \
+ git_version="`git describe`"; \
+ git_last_commit_timestamp="`git log -n1 --reverse --pretty=%ct`"; \
+ git_last_commit_year="`date --utc -d \"1970-01-01 + $$git_last_commit_timestamp seconds\" '+%Y'`"; \
elif test ! -f "$@"; then \
- echo "#define GIMP_GIT_VERSION \"Unknown, shouldn't happen\"" > "$ tmp"; \
- fi
+ git_version="Unknown, shouldn't happen"; \
+ git_last_commit_timestamp=-1; \
+ git_last_commit_year="`date --utc '+%Y'`"; \
+ fi; \
+ echo "#ifndef __GIT_VERSION_H__" > "$ tmp"; \
+ echo "#define __GIT_VERSION_H__" >> "$ tmp"; \
+ echo "#include <time.h>" >> "$ tmp"; \
+ echo "#define GIMP_GIT_VERSION \"$$git_version\"" >> "$ tmp"; \
+ echo "#define GIMP_GIT_LAST_COMMIT_TIMESTAMP ((time_t)$$git_last_commit_timestamp)" >> "$ tmp"; \
+ echo "#define GIMP_GIT_LAST_COMMIT_YEAR \"$$git_last_commit_year\"" >> "$ tmp"; \
+ echo "#endif /* __GIT_VERSION_H__ */" >> "$ tmp"
@if ( test -f "$ tmp" && test -f "$@" && cmp "$ tmp" "$@" > /dev/null ); then \
rm -f "$ tmp"; \
elif test -f "$ tmp"; then \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]