generate plugin version from hg identify trunk
authornathan
Sat, 29 Dec 2007 14:56:02 +0100
branchtrunk
changeset 9dc75c2890a31
parent 8 1a7977c2b683
child 10 bb902053eaff
generate plugin version from hg identify
.exclude
.hgignore
Makefile
decoder-snd.c
mp3.c
mplayer.c
stream.c
version.h
     1.1 --- a/.exclude	Sat Dec 29 14:54:06 2007 +0100
     1.2 +++ b/.exclude	Sat Dec 29 14:56:02 2007 +0100
     1.3 @@ -4,3 +4,4 @@
     1.4  *.mo
     1.5  *.pot
     1.6  .hg
     1.7 +version.c
     2.1 --- a/.hgignore	Sat Dec 29 14:54:06 2007 +0100
     2.2 +++ b/.hgignore	Sat Dec 29 14:56:02 2007 +0100
     2.3 @@ -8,3 +8,4 @@
     2.4  *.orig
     2.5  *.rej
     2.6  *.bak
     2.7 +version.c
     3.1 --- a/Makefile	Sat Dec 29 14:54:06 2007 +0100
     3.2 +++ b/Makefile	Sat Dec 29 14:56:02 2007 +0100
     3.3 @@ -65,20 +65,22 @@
     3.4  ### Allow user defined options to overwrite defaults:
     3.5  
     3.6  -include $(VDRDIR)/Make.config
     3.7 -
     3.8 -### The version number of this plugin (taken from the main source file):
     3.9 -
    3.10 -VERSION = $(shell grep 'define PLUGIN_VERSION' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
    3.11 +-include Make.config
    3.12 +
    3.13 +### The version number of this plugin:
    3.14 +
    3.15 +RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
    3.16 +VERSION := $(shell if test -d .hg; then echo -n '$(RELEASE)-'; (hg identify 2>/dev/null || echo -n Unknown) | sed -e 's/ .*//'; else echo -n '$(RELEASE)'; fi)
    3.17  
    3.18  ### The version number of VDR (taken from VDR's "config.h"):
    3.19  
    3.20 -VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
    3.21 -APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
    3.22 +VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
    3.23 +APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
    3.24  ifeq ($(strip $(APIVERSION)),)
    3.25     APIVERSION = $(VDRVERSION)
    3.26  endif
    3.27 -VDRVERSNUM = $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
    3.28 -APIVERSNUM = $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
    3.29 +VDRVERSNUM := $(shell sed -ne '/define VDRVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
    3.30 +APIVERSNUM := $(shell sed -ne '/define APIVERSNUM/ s/^.[a-zA-Z ]*\([0-9]*\) .*$$/\1/p' $(VDRDIR)/config.h)
    3.31  ifeq ($(strip $(APIVERSNUM)),)
    3.32     APIVERSNUM = $(VDRVERSNUM)
    3.33  endif
    3.34 @@ -108,7 +110,7 @@
    3.35    endif
    3.36  endif
    3.37  
    3.38 -COM_OBJS = i18n.o data.o menu.o
    3.39 +COM_OBJS = i18n.o data.o menu.o version.o
    3.40  
    3.41  OBJS     = $(PLUGIN).o $(COM_OBJS)\
    3.42              data-mp3.o setup-mp3.o player-mp3.o stream.o network.o\
    3.43 @@ -156,8 +158,9 @@
    3.44  
    3.45  MAKEDEP = g++ -MM -MG
    3.46  DEPFILE = .dependencies
    3.47 -$(DEPFILE): Makefile
    3.48 -	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) $(OBJS2:%.o=%.c) > $@
    3.49 +DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c))
    3.50 +$(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
    3.51 +	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
    3.52  
    3.53  -include $(DEPFILE)
    3.54  
    3.55 @@ -199,6 +202,13 @@
    3.56  
    3.57  i18n-$(PLUGIN2): $(I18Nmsgs2)
    3.58  
    3.59 +version.c: FORCE
    3.60 +	@echo >$@.new "/* this file will be overwritten without warning */"; \
    3.61 +	 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
    3.62 +	 diff $@.new $@ >$@.diff 2>&1; \
    3.63 +	 if test -s $@.diff; then mv -f $@.new $@; fi; \
    3.64 +	 rm -f $@.new $@.diff;
    3.65 +
    3.66  dist: clean
    3.67  	@-rm -rf $(TMPDIR)/$(ARCHIVE)
    3.68  	@mkdir $(TMPDIR)/$(ARCHIVE)
    3.69 @@ -209,4 +219,7 @@
    3.70  
    3.71  clean:
    3.72  	@-rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr-*.so $(PACKAGE).tar.gz core* *~
    3.73 +	@-rm -f version.c
    3.74  	@-rm -f $(PODIR)/*.mo
    3.75 +
    3.76 +FORCE:
    3.77 \ No newline at end of file
     4.1 --- a/decoder-snd.c	Sat Dec 29 14:54:06 2007 +0100
     4.2 +++ b/decoder-snd.c	Sat Dec 29 14:56:02 2007 +0100
     4.3 @@ -1,7 +1,7 @@
     4.4  /*
     4.5   * MP3/MPlayer plugin to VDR (C++)
     4.6   *
     4.7 - * (C) 2001-2005 Stefan Huelswitt <s.huelswitt@gmx.de>
     4.8 + * (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
     4.9   *
    4.10   * This code is free software; you can redistribute it and/or
    4.11   * modify it under the terms of the GNU General Public License
    4.12 @@ -708,7 +708,7 @@
    4.13      if(code/100==2) {
    4.14        const char *host=getenv("HOSTNAME"); if(!host) host="unknown";
    4.15        const char *user=getenv("USER"); if(!user) user="nobody";
    4.16 -      code=DoCddbCmd("cddb hello %s %s %s %s\n",user,host,PLUGIN_NAME,PLUGIN_VERSION);
    4.17 +      code=DoCddbCmd("cddb hello %s %s %s %s\n",user,host,PLUGIN_NAME,PluginVersion);
    4.18        if(code/100==2) {
    4.19          code=DoCddbCmd("proto %d\n",CDDB_PROTO);
    4.20          if(code>0) {
     5.1 --- a/mp3.c	Sat Dec 29 14:54:06 2007 +0100
     5.2 +++ b/mp3.c	Sat Dec 29 14:56:02 2007 +0100
     5.3 @@ -1538,7 +1538,6 @@
     5.4  
     5.5  // --- cPluginMP3 --------------------------------------------------------------
     5.6  
     5.7 -static const char *VERSION        = PLUGIN_VERSION;
     5.8  static const char *DESCRIPTION    = trNOOP("A versatile audio player");
     5.9  static const char *MAINMENUENTRY  = "MP3";
    5.10  
    5.11 @@ -1550,7 +1549,7 @@
    5.12  public:
    5.13    cPluginMp3(void);
    5.14    virtual ~cPluginMp3();
    5.15 -  virtual const char *Version(void) { return VERSION; }
    5.16 +  virtual const char *Version(void) { return PluginVersion; }
    5.17    virtual const char *Description(void) { return tr(DESCRIPTION); }
    5.18    virtual const char *CommandLineHelp(void);
    5.19    virtual bool ProcessArgs(int argc, char *argv[]);
     6.1 --- a/mplayer.c	Sat Dec 29 14:54:06 2007 +0100
     6.2 +++ b/mplayer.c	Sat Dec 29 14:56:02 2007 +0100
     6.3 @@ -728,7 +728,6 @@
     6.4  
     6.5  // --- cPluginMPlayer ----------------------------------------------------------
     6.6  
     6.7 -static const char *VERSION        = PLUGIN_VERSION;
     6.8  static const char *DESCRIPTION    = trNOOP("Media replay via MPlayer");
     6.9  static const char *MAINMENUENTRY  = "MPlayer";
    6.10  
    6.11 @@ -740,7 +739,7 @@
    6.12  public:
    6.13    cPluginMPlayer(void);
    6.14    virtual ~cPluginMPlayer();
    6.15 -  virtual const char *Version(void) { return VERSION; }
    6.16 +  virtual const char *Version(void) { return PluginVersion; }
    6.17    virtual const char *Description(void) { return tr(DESCRIPTION); }
    6.18    virtual const char *CommandLineHelp(void);
    6.19    virtual bool ProcessArgs(int argc, char *argv[]);
     7.1 --- a/stream.c	Sat Dec 29 14:54:06 2007 +0100
     7.2 +++ b/stream.c	Sat Dec 29 14:56:02 2007 +0100
     7.3 @@ -1,7 +1,7 @@
     7.4  /*
     7.5   * MP3/MPlayer plugin to VDR (C++)
     7.6   *
     7.7 - * (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de>
     7.8 + * (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
     7.9   *
    7.10   * This code is free software; you can redistribute it and/or
    7.11   * modify it under the terms of the GNU General Public License
    7.12 @@ -389,7 +389,7 @@
    7.13             "Accept: audio/mpeg\r\n"   //XXX audio/x-mpegurl, */*
    7.14             "Icy-MetaData: 1\r\n"
    7.15             "%s\r\n",
    7.16 -           p,PLUGIN_NAME,PLUGIN_VERSION,h,a);
    7.17 +           p,PLUGIN_NAME,PluginVersion,h,a);
    7.18    free(p); free(h);  
    7.19  
    7.20    if(++cc==1) asyncStatus.Set(tr("Connecting to stream server ..."));
     8.1 --- a/version.h	Sat Dec 29 14:54:06 2007 +0100
     8.2 +++ b/version.h	Sat Dec 29 14:56:02 2007 +0100
     8.3 @@ -1,7 +1,7 @@
     8.4  /*
     8.5   * MP3/MPlayer plugin to VDR (C++)
     8.6   *
     8.7 - * (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de>
     8.8 + * (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
     8.9   *
    8.10   * This code is free software; you can redistribute it and/or
    8.11   * modify it under the terms of the GNU General Public License
    8.12 @@ -23,6 +23,8 @@
    8.13  #define ___VERSION_H
    8.14  
    8.15  #define PLUGIN_NAME    "VDR-MP3"
    8.16 -#define PLUGIN_VERSION "0.10.1"
    8.17 +#define PLUGIN_RELEASE "0.10.1"
    8.18 +
    8.19 +extern const char *PluginVersion;
    8.20  
    8.21  #endif //___VERSION_H