[dvblast-devel] [PATCH 4/4] Define VERSION_EXTRA using git describe in the Makefile.

Georgi Chorbadzhiyski gf at unixsol.org
Thu Aug 25 15:00:42 CEST 2011


---
 Makefile     |    6 ++++++
 dvblast.c    |    2 +-
 dvblastctl.c |    2 +-
 version.h    |    1 -
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index fc9dae9..faad3dc 100644
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,15 @@
 
 VERSION = 2.0.0
 TOPDIR = `basename ${PWD}`
+GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
 
 CFLAGS += -Wall -Wformat-security -O3 -fomit-frame-pointer
 CFLAGS += -g
+ifneq "$(GIT_VER)" ""
+CFLAGS += -DVERSION_EXTRA=\"git-$(GIT_VER)\"
+else
+CFLAGS += -DVERSION_EXTRA=\"release\"
+endif
 LDLIBS += -lrt
 LDLIBS_DVBLAST += -lpthread
 
diff --git a/dvblast.c b/dvblast.c
index 5a4718b..22378e0 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -399,7 +399,7 @@ static void SigHandler( int i_signal )
  *****************************************************************************/
 static void DisplayVersion()
 {
-    msg_Raw( NULL, "DVBlast %d.%d.%d%s", VERSION_MAJOR, VERSION_MINOR,
+    msg_Raw( NULL, "DVBlast %d.%d.%d (%s)", VERSION_MAJOR, VERSION_MINOR,
                                          VERSION_REVISION, VERSION_EXTRA );
 }
 
diff --git a/dvblastctl.c b/dvblastctl.c
index 7d983e3..6124208 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -84,7 +84,7 @@ char *psi_iconv(void *_unused, const char *psz_encoding,
 
 void usage()
 {
-    msg_Raw( NULL, "DVBlastctl %d.%d.%d%s", VERSION_MAJOR, VERSION_MINOR,
+    msg_Raw( NULL, "DVBlastctl %d.%d.%d (%s)", VERSION_MAJOR, VERSION_MINOR,
              VERSION_REVISION, VERSION_EXTRA );
     msg_Raw( NULL, "Usage: dvblastctl -r <remote socket> reload|shutdown|fe_status|mmi_status|mmi_open|mmi_close|mmi_get|mmi_send_text|mmi_send_choice|get_pat|get_cat|get_nit|get_sdt [<CAM slot>] [-x <text|xml>] [<text/choice>]" );
     exit(1);
diff --git a/version.h b/version.h
index ab98255..7cbf445 100644
--- a/version.h
+++ b/version.h
@@ -23,4 +23,3 @@
 #define VERSION_MAJOR 2
 #define VERSION_MINOR 0
 #define VERSION_REVISION 0
-#define VERSION_EXTRA "-svn"
-- 
1.7.5.1



More information about the dvblast-devel mailing list