From 73917abf6036ab12f9c47545bba4395798003d86 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 16 Apr 2006 09:36:10 +0200 Subject: [PATCH] Implemented APIVERSION for the VDR plugin API version number --- HISTORY | 33 ++++++++++++++++++++++++++++++++ Makefile | 9 +++++---- PLUGINS.html | 11 ++++++++++- PLUGINS/src/hello/Makefile | 8 ++++---- PLUGINS/src/osddemo/Makefile | 8 ++++---- PLUGINS/src/servicedemo/Makefile | 10 +++++----- PLUGINS/src/skincurses/Makefile | 8 ++++---- PLUGINS/src/sky/Makefile | 8 ++++---- PLUGINS/src/status/Makefile | 8 ++++---- PLUGINS/src/svdrpdemo/Makefile | 8 ++++---- config.h | 15 ++++++++++++++- newplugin | 8 ++++---- plugin.c | 6 +++--- 13 files changed, 98 insertions(+), 42 deletions(-) diff --git a/HISTORY b/HISTORY index ce71fd8a..45bbb177 100644 --- a/HISTORY +++ b/HISTORY @@ -4534,6 +4534,8 @@ Video Disk Recorder Revision History other than /usr/include/linux/dvb, you can define DVBDIR in the Make.config file (see also INSTALL). Any reference to DVBDIR should be removed from all plugins' Makefiles, like this: + + ------------------------------------------------------------ --- PLUGINS/src/hello/Makefile 2005/11/11 13:20:14 1.10 +++ PLUGINS/src/hello/Makefile 2006/04/15 11:58:46 1.11 @@ -20,7 +20,6 @@ @@ -4552,6 +4554,7 @@ Video Disk Recorder Revision History +INCLUDES += -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' + ------------------------------------------------------------ Thanks to Marco Schlüßler for pointing out this problem. - Implemented kNext and kPrev keys (based on a patch from Peter Juszack). @@ -4561,3 +4564,33 @@ Video Disk Recorder Revision History allow updating only the PIDs (see MANUAL for details). When updating to this version of VDR, please verify that the setting is as you want it to be, because the values have been shifted. +- The new APIVERSION (see config.h) now allows existing compiled plugins to be + used with newer versions of VDR, as long as there have been no changes to the + VDR header files since the last APIVERSION. Existing plugins' Makefiles should + have all references to VDRVERSION changed to APIVERSION, like this: + + ------------------------------------------------------------ + --- PLUGINS/src/hello/Makefile 2006/04/15 11:58:46 1.11 + +++ PLUGINS/src/hello/Makefile 2006/04/16 09:03:50 1.12 + @@ -28,9 +28,9 @@ + + -include $(VDRDIR)/Make.config + + -### The version number of VDR (taken from VDR's "config.h"): + +### The version number of VDR's plugin API (taken from VDR's "config.h"): + + -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') + +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') + + ### The name of the distribution archive: + + @@ -67,7 +67,7 @@ + + libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ + - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + + @cp $@ $(LIBDIR)/$@.$(APIVERSION) + + dist: clean + @-rm -rf $(TMPDIR)/$(ARCHIVE) + ------------------------------------------------------------ diff --git a/Makefile b/Makefile index d18be29a..f5862139 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # See the main source file 'vdr.c' for copyright information and # how to reach the author. # -# $Id: Makefile 1.86 2006/04/15 12:24:28 kls Exp $ +# $Id: Makefile 1.87 2006/04/16 09:00:30 kls Exp $ .DELETE_ON_ERROR: @@ -79,9 +79,10 @@ DEFINES += -D_GNU_SOURCE DEFINES += -DVIDEODIR=\"$(VIDEODIR)\" DEFINES += -DPLUGINDIR=\"$(PLUGINLIBDIR)\" -# The version number of VDR (taken from VDR's "config.h"): +# The version numbers of VDR and the plugin API (taken from VDR's "config.h"): VDRVERSION = $(shell grep 'define VDRVERSION ' config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' config.h | awk '{ print $$3 }' | sed -e 's/"//g') ifdef VFAT # for people who want their video directory on a VFAT partition @@ -183,7 +184,7 @@ plugins: include-dir clean-plugins: @for i in `ls $(PLUGINDIR)/src | grep -v '[^a-z0-9]'`; do $(MAKE) -C "$(PLUGINDIR)/src/$$i" clean; done - @-rm -f $(PLUGINDIR)/lib/libvdr-*.so.$(VDRVERSION) + @-rm -f $(PLUGINDIR)/lib/libvdr-*.so.$(APIVERSION) # Install the files: @@ -215,7 +216,7 @@ install-doc: install-plugins: plugins @mkdir -p $(PLUGINLIBDIR) - @cp $(PLUGINDIR)/lib/libvdr-*.so.$(VDRVERSION) $(PLUGINLIBDIR) + @cp $(PLUGINDIR)/lib/libvdr-*.so.$(APIVERSION) $(PLUGINLIBDIR) # Source documentation: diff --git a/PLUGINS.html b/PLUGINS.html index 8f0e12ef..b1c4877e 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -165,11 +165,20 @@ loadable library file for that plugin (we'll get to the details later). The lib directory contains the dynamically loadable libraries of all available plugins. Note that the names of these files are created by concatenating

+
  - +
libvdr-hello.so.1.1.0
VDR plugin
library prefix
name of
the plugin
shared object
indicator
VDR version number
this plugin was
compiled for
VDR plugin
library prefix
name of
the plugin
shared object
indicator
API version number
this plugin was
compiled for

+The API version number refers to the plugin API version number of the VDR +version this plugin was compiled with. Compiled plugins can run with newer versions +of VDR as long as their plugin API version number is still the same as that of +the current VDR version. That way minor fixes to VDR, that don't require changes +to the VDR header files, can be made without requiring all plugins to be +recompiled. +

+

The plugin library files can be stored in any directory. If the default organization is not used, the path to the plugin directory has be be given to VDR through the -L option. diff --git a/PLUGINS/src/hello/Makefile b/PLUGINS/src/hello/Makefile index 33b2064b..6f3dd4c7 100644 --- a/PLUGINS/src/hello/Makefile +++ b/PLUGINS/src/hello/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.11 2006/04/15 11:58:46 kls Exp $ +# $Id: Makefile 1.12 2006/04/16 09:03:50 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -28,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -67,7 +67,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/PLUGINS/src/osddemo/Makefile b/PLUGINS/src/osddemo/Makefile index 9f5662f6..8a0aef4b 100644 --- a/PLUGINS/src/osddemo/Makefile +++ b/PLUGINS/src/osddemo/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.5 2006/04/15 11:59:01 kls Exp $ +# $Id: Makefile 1.6 2006/04/16 09:03:55 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -28,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -67,7 +67,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/PLUGINS/src/servicedemo/Makefile b/PLUGINS/src/servicedemo/Makefile index 77665eff..c76b871f 100644 --- a/PLUGINS/src/servicedemo/Makefile +++ b/PLUGINS/src/servicedemo/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.3 2006/04/15 11:59:07 kls Exp $ +# $Id: Makefile 1.4 2006/04/16 09:03:59 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -29,9 +29,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -68,11 +68,11 @@ all: libvdr-$(PLUGIN1).so libvdr-$(PLUGIN2).so libvdr-$(PLUGIN1).so: $(PLUGIN1).o $(CXX) $(CXXFLAGS) -shared $(PLUGIN1).o -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) libvdr-$(PLUGIN2).so: $(PLUGIN2).o $(CXX) $(CXXFLAGS) -shared $(PLUGIN2).o -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/PLUGINS/src/skincurses/Makefile b/PLUGINS/src/skincurses/Makefile index 30503405..360b0d2f 100644 --- a/PLUGINS/src/skincurses/Makefile +++ b/PLUGINS/src/skincurses/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.3 2006/04/15 11:59:12 kls Exp $ +# $Id: Makefile 1.4 2006/04/16 09:04:04 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -28,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -67,7 +67,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -lncurses -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/PLUGINS/src/sky/Makefile b/PLUGINS/src/sky/Makefile index cc8fdf0b..e9435380 100644 --- a/PLUGINS/src/sky/Makefile +++ b/PLUGINS/src/sky/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.5 2006/04/15 11:59:17 kls Exp $ +# $Id: Makefile 1.6 2006/04/16 09:04:06 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -28,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -67,7 +67,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/PLUGINS/src/status/Makefile b/PLUGINS/src/status/Makefile index c41af407..e6525e9e 100644 --- a/PLUGINS/src/status/Makefile +++ b/PLUGINS/src/status/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.9 2006/04/15 11:59:23 kls Exp $ +# $Id: Makefile 1.10 2006/04/16 09:04:10 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -28,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -67,7 +67,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/PLUGINS/src/svdrpdemo/Makefile b/PLUGINS/src/svdrpdemo/Makefile index 789f4750..27258748 100644 --- a/PLUGINS/src/svdrpdemo/Makefile +++ b/PLUGINS/src/svdrpdemo/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile 1.3 2006/04/15 11:59:28 kls Exp $ +# $Id: Makefile 1.4 2006/04/16 09:04:13 kls Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -28,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -67,7 +67,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) diff --git a/config.h b/config.h index 14cd0b8b..7e518bde 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.250 2006/04/14 09:46:32 kls Exp $ + * $Id: config.h 1.251 2006/04/16 09:36:10 kls Exp $ */ #ifndef __CONFIG_H @@ -19,9 +19,22 @@ #include "i18n.h" #include "tools.h" +// VDR's own version number: + #define VDRVERSION "1.3.47" #define VDRVERSNUM 10347 // Version * 10000 + Major * 100 + Minor +// The plugin API's version number: + +#define APIVERSION "1.3.47" +#define APIVERSNUM 10347 // Version * 10000 + Major * 100 + Minor + +// When loading plugins, VDR searches them by their APIVERSION, which +// may be smaller than VDRVERSION in case there have been no changes to +// VDR header files since the last APIVERSION. This allows compiled +// plugins to work with newer versions of the core VDR as long as no +// VDR header files have changed. + #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/newplugin b/newplugin index dfa0fc07..9ac83c85 100755 --- a/newplugin +++ b/newplugin @@ -12,7 +12,7 @@ # See the main source file 'vdr.c' for copyright information and # how to reach the author. # -# $Id: newplugin 1.24 2006/04/15 11:59:43 kls Exp $ +# $Id: newplugin 1.25 2006/04/16 09:04:21 kls Exp $ $PLUGIN_NAME = $ARGV[0] || die "Usage: newplugin \n"; @@ -83,9 +83,9 @@ TMPDIR = /tmp -include \$(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = \$(shell grep 'define VDRVERSION ' \$(VDRDIR)/config.h | awk '{ print \$\$3 }' | sed -e 's/"//g') +APIVERSION = \$(shell grep 'define APIVERSION ' \$(VDRDIR)/config.h | awk '{ print \$\$3 }' | sed -e 's/"//g') ### The name of the distribution archive: @@ -122,7 +122,7 @@ all: libvdr-\$(PLUGIN).so libvdr-\$(PLUGIN).so: \$(OBJS) \$(CXX) \$(CXXFLAGS) -shared \$(OBJS) -o \$\@ - \@cp \$\@ \$(LIBDIR)/\$\@.\$(VDRVERSION) + \@cp \$\@ \$(LIBDIR)/\$\@.\$(APIVERSION) dist: clean \@-rm -rf \$(TMPDIR)/\$(ARCHIVE) diff --git a/plugin.c b/plugin.c index 4f673f76..88841899 100644 --- a/plugin.c +++ b/plugin.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.c 1.20 2006/04/15 11:17:03 kls Exp $ + * $Id: plugin.c 1.21 2006/04/16 09:23:30 kls Exp $ */ #include "plugin.h" @@ -290,7 +290,7 @@ void cPluginManager::AddPlugin(const char *Args) if (p) { *p = 0; p += strlen(SO_INDICATOR); - if (strcmp(p, VDRVERSION) == 0) { + if (strcmp(p, APIVERSION) == 0) { char *name = e->d_name + strlen(LIBVDR_PREFIX); if (strcmp(name, "*") != 0) { // let's not get into a loop! AddPlugin(e->d_name + strlen(LIBVDR_PREFIX)); @@ -306,7 +306,7 @@ void cPluginManager::AddPlugin(const char *Args) if (p) *p = 0; char *buffer = NULL; - asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION); + asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION); dlls.Add(new cDll(buffer, Args)); free(buffer); free(s);