nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [patch] letting autoconf brand a build from SVN


From: Benno Schulenberg
Subject: [Nano-devel] [patch] letting autoconf brand a build from SVN
Date: Fri, 03 Apr 2015 13:02:40 +0200

Hi all,

Now that the compile time has disappeared from the version string,
it would be nice if there were some other and better way to identify
a build from SVN.  The patch below achieves this for me, but surely
there are things wrong with it.  Mike, Kamil, Eitan, Jordi?  Is this
portable enough?  And what can be improved?

Benno

Index: src/nano.h
===================================================================
--- src/nano.h  (revision 5172)
+++ src/nano.h  (working copy)
@@ -600,4 +600,10 @@
 /* The maximum number of bytes buffered at one time. */
 #define MAX_BUF_SIZE 128
 
+#ifdef REVISION
+#define BRANDING "nano SVN "REVISION
+#else
+#define BRANDING PACKAGE_STRING
+#endif
+
 #endif /* !NANO_H */
Index: src/winio.c
===================================================================
--- src/winio.c (revision 5172)
+++ src/winio.c (working copy)
@@ -2125,8 +2125,7 @@
     if (space >= 4) {
        /* Add a space after the version message, and account for both
         * it and the two spaces before it. */
-       mvwaddnstr(topwin, 0, 2, PACKAGE_STRING,
-               actual_x(PACKAGE_STRING, verlen));
+       mvwaddnstr(topwin, 0, 2, BRANDING, actual_x(BRANDING, verlen));
        verlen += 3;
 
        /* Account for the full length of the version message. */
Index: src/nano.c
===================================================================
--- src/nano.c  (revision 5172)
+++ src/nano.c  (working copy)
@@ -960,7 +960,11 @@
  * it was compiled with. */
 void version(void)
 {
+#ifdef REVISION
+    printf(" GNU nano, from %s, SVN revision %s\n", VERSION, REVISION);
+#else
     printf(_(" GNU nano, version %s\n"), VERSION);
+#endif
     printf(" (C) 1999..2015 Free Software Foundation, Inc.\n");
     printf(
        _(" Email: address@hidden       Web: http://www.nano-editor.org/";));
Index: configure.ac
===================================================================
--- configure.ac        (revision 5172)
+++ configure.ac        (working copy)
@@ -20,7 +20,7 @@
 #
 # $Id$
 
-AC_INIT([GNU nano], [2.4.0-svn], address@hidden, [nano])
+AC_INIT([GNU nano], [2.4.0], address@hidden, [nano])
 AC_CONFIG_SRCDIR([src/nano.c])
 AC_CANONICAL_HOST
 AM_INIT_AUTOMAKE
@@ -680,6 +680,16 @@
 AC_CHECK_PROG(haveit, makeinfo, yes, no)
 AM_CONDITIONAL(HAVE_MAKEINFO, test x$haveit = xyes)
 
+AC_MSG_CHECKING([whether building from SVN])
+if test -d .svn ; then
+    AC_MSG_RESULT([yes])
+    AC_PATH_PROG([SVNVERSION], [svnversion])
+    REVISION=`($SVNVERSION >/dev/null 2>&1) && ($SVNVERSION -n)`
+    AC_SUBST(REVISION)
+    AC_DEFINE_UNQUOTED([REVISION],"${REVISION}","Setting REVISION in 
config.h.")
+else
+    AC_MSG_RESULT([no])
+fi
 
 AC_CONFIG_FILES([
 Makefile

-- 
http://www.fastmail.com - Does exactly what it says on the tin

Attachment: brand-with-svn-version.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]