From 39a95018b0abb91feb77121b7c84fe4267ce06f9 Mon Sep 17 00:00:00 2001
From: Klaus Schmidinger <vdr@tvdr.de>
Date: Sat, 29 Dec 2012 12:12:16 +0100
Subject: Re-enabled building plugins that still use pre-version-1.7.34
 Makefiles

---
 HISTORY     |  8 +++++++-
 Make.global | 13 +++----------
 Makefile    | 32 ++++++++++++++++++++++----------
 3 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/HISTORY b/HISTORY
index eff5f89a..d8e3ef0a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7460,7 +7460,7 @@ Video Disk Recorder Revision History
   is an I-frame (which normally shouldn't occur).
 - Fixed replaying ongoing recordings from other VDR instances.
 
-2012-12-28: Version 1.7.35
+2012-12-29: Version 1.7.35
 
 - Making sure that plugins include the VDR header files from the actual VDR source
   directory when doing "make plugins" (suggested by Christoper Reimer).
@@ -7483,3 +7483,9 @@ Video Disk Recorder Revision History
   PLGCFG = $(call PKGCFG,plgcfg)
   -include $(PLGCFG)
   accordingly (see the "newplugin" script for details).
+- Re-enabled building plugins that still use pre-version-1.7.34 Makefiles.
+  The file Make.global is present again to satisfy the "include" these Makefiles do,
+  but the file itself contains no settings. The VDR Makefile's "plugins" target
+  determines whether a particular plugin uses an old style Makefile and calls it
+  accordingly. Note that this only works when building plugins from within the VDR
+  source tree, using "make plugins" in the VDR source directory.
diff --git a/Make.global b/Make.global
index 3b927228..e2594025 100644
--- a/Make.global
+++ b/Make.global
@@ -4,14 +4,7 @@
 # See the main source file 'vdr.c' for copyright information and
 # how to reach the author.
 #
-# $Id: Make.global 1.1 2010/02/06 14:54:12 kls Exp $
+# $Id: Make.global 1.2 2012/12/29 12:03:01 kls Exp $
 
-# Plugins need to be compiled with position independent code, otherwise linking
-# VDR against it will fail.
-
-ifdef PLUGIN
-CFLAGS   += -fPIC
-CXXFLAGS += -fPIC
-endif
-
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+# This is just a dummy file for plugins that use old style (version 1.7.33
+# or earlier) Makefiles.
diff --git a/Makefile b/Makefile
index 65dbcf75..b342f55c 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 2.44 2012/12/29 10:29:59 kls Exp $
+# $Id: Makefile 2.45 2012/12/29 11:58:32 kls Exp $
 
 .DELETE_ON_ERROR:
 
@@ -194,20 +194,32 @@ plugins: include-dir vdr.pc
 	noapiv="";\
 	for i in `ls $(PLUGINDIR)/src | grep -v '[^a-z0-9]'`; do\
 	    echo "*** Plugin $$i:";\
+	    oldmakefile=`grep "Make.global" "$(PLUGINDIR)/src/$$i/Makefile"`;\
 	    if ! grep -q "\$$(LIBDIR)/.*\$$(APIVERSION)" "$(PLUGINDIR)/src/$$i/Makefile" ; then\
 	       echo "ERROR: plugin $$i doesn't honor APIVERSION - not compiled!";\
 	       noapiv="$$noapiv $$i";\
 	       continue;\
 	       fi;\
-            target=all;\
-	    if [ "$(LIBDIR)" = "$(CWD)/PLUGINS/lib" ] && [ "$(LOCDIR)" = "$(CWD)/locale" ]; then\
-	       target="install";\
+	    if [ -n "$$oldmakefile" ]; then\
+	       echo "********************************************************************";\
+	       echo "* Your plugin \"$$i\" is using an old Makefile!";\
+	       echo "* While this currently still works, it is strongly recommended";\
+	       echo "* that you convert that Makefile to the new style used since";\
+	       echo "* VDR version 1.7.35. Support for old style Makefiles may be dropped";\
+	       echo "* in future versions of VDR.";\
+	       echo "********************************************************************";\
+	       $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" CXXFLAGS="$(CXXFLAGS)" VDRDIR=$(UP3) LIBDIR=../../lib all || failed="$$failed $$i";\
+	    else\
+               target=all;\
+	       if [ "$(LIBDIR)" = "$(CWD)/PLUGINS/lib" ] && [ "$(LOCDIR)" = "$(CWD)/locale" ]; then\
+	          target="install";\
+	          fi;\
+	       includes=;\
+	       if [ "$(INCDIR)" != "$(CWD)/include" ]; then\
+	          includes="INCLUDES=-I$(UP3)/include";\
+	          fi;\
+	       $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" VDRDIR=$(UP3) $$includes $$target || failed="$$failed $$i";\
 	       fi;\
-	    includes=;\
-	    if [ "$(INCDIR)" != "$(CWD)/include" ]; then\
-	       includes="INCLUDES=-I$(UP3)/include";\
-	       fi;\
-	    $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" VDRDIR=$(UP3)$(CWD) $$includes $$target || failed="$$failed $$i";\
 	    done;\
 	if [ -n "$$noapiv" ] ; then echo; echo "*** plugins without APIVERSION:$$noapiv"; echo; fi;\
 	if [ -n "$$failed" ] ; then echo; echo "*** failed plugins:$$failed"; echo; exit 1; fi
@@ -250,7 +262,7 @@ install-doc:
 
 install-plugins: plugins
 	@for i in `ls $(PLUGINDIR)/src | grep -v '[^a-z0-9]'`; do\
-	     $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" VDRDIR=$(UP3)$(CWD) DESTDIR=$(DESTDIR) install;\
+	     $(MAKE) --no-print-directory -C "$(PLUGINDIR)/src/$$i" VDRDIR=$(UP3) DESTDIR=$(DESTDIR) install;\
 	     done
 
 # Includes:
-- 
cgit v1.2.3