[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH] build: refresh the git description whenever somethi
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH] build: refresh the git description whenever something is rebuilt |
Date: |
Fri, 20 May 2016 13:52:34 +0200 |
---
configure.ac | 11 -----------
src/Makefile.am | 12 ++++++++++++
src/nano.c | 3 ++-
src/nano.h | 6 ------
src/winio.c | 7 +++++++
5 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0c42e1e..def04d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -692,17 +692,6 @@ AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support =
xyes)
AC_CHECK_PROG(haveit, makeinfo, yes, no)
AM_CONDITIONAL(HAVE_MAKEINFO, test x$haveit = xyes)
-AC_MSG_CHECKING([whether building from git])
-if test -d .git ; then
- AC_MSG_RESULT([yes])
- AC_PATH_PROG([GIT], [git])
- REVISION=`($GIT rev-parse --is-inside-work-tree >/dev/null 2>&1) && ($GIT
rev-parse --short HEAD)`
- AC_SUBST(REVISION)
- AC_DEFINE_UNQUOTED([REVISION],"${REVISION}","Setting REVISION in
config.h.")
-else
- AC_MSG_RESULT([no])
-fi
-
AC_CONFIG_FILES([
Makefile
doc/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index df65845..8bce1bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,17 @@
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
+GIT_DESCRIPTION = "\"$(shell git describe --tags 2>/dev/null)\""
+
+nano.o: revision.h
+winio.o: revision.h
+
+revision.h: update_revision
+ @[ -f $@ ] || touch $@
+ @echo "#define REVISION $(GIT_DESCRIPTION)" | cmp -s $@ - || \
+ echo "#define REVISION $(GIT_DESCRIPTION)" > $@
+
+.PHONY: update_revision
+
bin_PROGRAMS = nano
nano_SOURCES = browser.c \
chars.c \
diff --git a/src/nano.c b/src/nano.c
index 7f623d0..0499f17 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -21,6 +21,7 @@
**************************************************************************/
#include "proto.h"
+#include "revision.h"
#include <stdio.h>
#include <stdarg.h>
@@ -936,7 +937,7 @@ void usage(void)
void version(void)
{
#ifdef REVISION
- printf(" GNU nano from git, commit %s (after %s)\n", REVISION, VERSION);
+ printf(" GNU nano from git, %s\n", REVISION);
#else
printf(_(" GNU nano, version %s\n"), VERSION);
#endif
diff --git a/src/nano.h b/src/nano.h
index 7140728..7117259 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -585,10 +585,4 @@ enum
/* The maximum number of bytes buffered at one time. */
#define MAX_BUF_SIZE 128
-#ifdef REVISION
-#define BRANDING PACKAGE_VERSION"-git "REVISION
-#else
-#define BRANDING PACKAGE_STRING
-#endif
-
#endif /* !NANO_H */
diff --git a/src/winio.c b/src/winio.c
index ba6eb63..8444f64 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -21,6 +21,7 @@
**************************************************************************/
#include "proto.h"
+#include "revision.h"
#include <stdio.h>
#include <stdarg.h>
@@ -28,6 +29,12 @@
#include <unistd.h>
#include <ctype.h>
+#ifdef REVISION
+#define BRANDING REVISION
+#else
+#define BRANDING PACKAGE_STRING
+#endif
+
static int *key_buffer = NULL;
/* The keystroke buffer, containing all the keystrokes we
* haven't handled yet at a given point. */
--
2.8.1
- [Nano-devel] [PATCH] build: refresh the git description whenever something is rebuilt,
Benno Schulenberg <=