changeset 27093:77177e6000e4

Install the Purple and Pidgin perl modules under $libdir instead of in perl's normal @INC locations. Since they aren't usable by perl directly existing there just confused people and conflicted with similarly named perl modules. Thanks Zsombor Welker. Fixes #5428
author Etan Reisner <pidgin@unreliablesource.net>
date Thu, 18 Jun 2009 23:01:51 +0000
parents 19cbe3af6167
children e3fd06032c4b
files configure.ac libpurple/plugins/perl/Makefile.am libpurple/plugins/perl/common/Makefile.PL.in libpurple/plugins/perl/perl.c pidgin/plugins/perl/Makefile.am pidgin/plugins/perl/common/Makefile.PL.in
diffstat 6 files changed, 40 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Thu Jun 18 22:48:49 2009 +0000
+++ b/configure.ac	Thu Jun 18 23:01:51 2009 +0000
@@ -1563,30 +1563,6 @@
 			AC_MSG_RESULT(no)
 		fi
 
-		if test "x$prefix" != "xNONE"; then
-			prefix=`eval echo $prefix`
-			PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=$prefix"
-		fi
-
-		AC_ARG_WITH(perl-lib,
-		[AC_HELP_STRING([--with-perl-lib=[site|vendor|DIR]],
-			[specify where to install the Perl libraries for pidgin. Default is site.])],
-		[
-			if test "x$withval" = xsite; then
-				PERL_MM_PARAMS=""
-			elif test "x$withval" = xvendor; then
-				if test -z "`$perlpath -v | grep '5\.0'`"; then
-					PERL_MM_PARAMS="INSTALLDIRS=vendor"
-				else
-					PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=`perl -e 'use Config; print $Config{prefix}'`"
-				fi
-			else
-				PERL_MM_PARAMS="INSTALLDIRS=vendor PREFIX=$withval"
-			fi
-		])
-
-		AC_SUBST(PERL_MM_PARAMS)
-
 		AC_MSG_CHECKING(for DynaLoader.a)
 		DYNALOADER_A=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*([[^ ]]*DynaLoader\.a).*/\2/'`
 
--- a/libpurple/plugins/perl/Makefile.am	Thu Jun 18 22:48:49 2009 +0000
+++ b/libpurple/plugins/perl/Makefile.am	Thu Jun 18 23:01:51 2009 +0000
@@ -99,7 +99,7 @@
 			${LN_S} -f $$srcloc/$$f $$f; \
 		done; \
 	fi
-	@cd common && $(perlpath) Makefile.PL $(PERL_MM_PARAMS)
+	@cd common && $(perlpath) Makefile.PL
 
 common/Makefile.PL: common/Makefile.PL.in $(top_builddir)/config.status
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
@@ -108,7 +108,7 @@
 	@for dir in $(perl_dirs); do \
 		cd $$dir && \
 		if [ ! -f Makefile ]; then \
-			$(perlpath) Makefile.PL $(PERL_MM_PARAMS); \
+			$(perlpath) Makefile.PL; \
 		fi && \
 		($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
 		 $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
@@ -164,6 +164,7 @@
 	-I$(top_srcdir) \
 	-I$(top_srcdir)/libpurple \
 	-I$(top_builddir)/libpurple \
+	-DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)\" \
 	$(DEBUG_CFLAGS) \
 	$(GLIB_CFLAGS) \
 	$(PLUGIN_CFLAGS) \
--- a/libpurple/plugins/perl/common/Makefile.PL.in	Thu Jun 18 22:48:49 2009 +0000
+++ b/libpurple/plugins/perl/common/Makefile.PL.in	Thu Jun 18 23:01:51 2009 +0000
@@ -13,4 +13,16 @@
     'INC'               => '-I. -I@srcdir@ -I@top_srcdir@ -I@top_srcdir@/libpurple @GLIB_CFLAGS@',
     'OBJECT'            => '$(O_FILES)', # link all the C files too
 #    'OPTIMIZE'          => '-g', # For debugging
+    'INSTALLDIRS'          => 'vendor',
+    'INSTALL_BASE'         => '$(prefix)',
+    'INSTALLVENDORARCH'    => '$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/perl',
+    'INSTALLVENDORMAN3DIR' => '$(mandir)/man3',
+    'macro'                => {
+        'prefix'               => '@prefix@',
+        'exec_prefix'          => '@exec_prefix@',
+        'libdir'               => '@libdir@',
+        'mandir'               => '@mandir@',
+        'datarootdir'          => '@datarootdir@',
+        'PURPLE_MAJOR_VERSION' => '@PURPLE_MAJOR_VERSION@',
+    },
 );
--- a/libpurple/plugins/perl/perl.c	Thu Jun 18 22:48:49 2009 +0000
+++ b/libpurple/plugins/perl/perl.c	Thu Jun 18 23:01:51 2009 +0000
@@ -131,6 +131,7 @@
 #endif
 {
 	char *file = __FILE__;
+	GList *search_paths = purple_plugins_get_search_paths();
 	dXSUB_SYS;
 
 	/* This one allows dynamic loading of perl modules in perl scripts by
@@ -139,6 +140,17 @@
 #ifdef _WIN32
 	newXS("Win32CORE::bootstrap", boot_Win32CORE, file);
 #endif
+
+	while (search_paths != NULL) {
+		gchar *uselib;
+		const gchar *search_path = search_paths->data;
+		search_paths = g_list_next(search_paths);
+
+		uselib = g_strdup_printf("unshift @INC, \"%s%cperl\";",
+		                         search_path, G_DIR_SEPARATOR);
+		eval_pv(uselib, TRUE);
+		g_free(uselib);
+	}
 }
 
 static void
--- a/pidgin/plugins/perl/Makefile.am	Thu Jun 18 22:48:49 2009 +0000
+++ b/pidgin/plugins/perl/Makefile.am	Thu Jun 18 23:01:51 2009 +0000
@@ -44,7 +44,7 @@
 			${LN_S} -f $$srcloc/$$f $$f; \
 		done; \
 	fi
-	@cd common && $(perlpath) Makefile.PL $(PERL_MM_PARAMS)
+	@cd common && $(perlpath) Makefile.PL
 
 common/Makefile.PL: common/Makefile.PL.in $(top_builddir)/config.status
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
@@ -53,7 +53,7 @@
 	@for dir in $(perl_dirs); do \
 		cd $$dir && \
 		if [ ! -f Makefile ]; then \
-			$(perlpath) Makefile.PL $(PERL_MM_PARAMS); \
+			$(perlpath) Makefile.PL; \
 		fi && \
 		($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
 		$(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
--- a/pidgin/plugins/perl/common/Makefile.PL.in	Thu Jun 18 22:48:49 2009 +0000
+++ b/pidgin/plugins/perl/common/Makefile.PL.in	Thu Jun 18 23:01:51 2009 +0000
@@ -13,4 +13,15 @@
     'OBJECT'        => '$(O_FILES)', # link all the C files too
     'TYPEMAPS'      => ["@top_srcdir@/libpurple/plugins/perl/common/typemap"],
 #    'OPTIMIZE'      => '-g', # For debugging.
+    'INSTALLDIRS'          => 'vendor',
+    'INSTALL_BASE'         => '$(prefix)',
+    'INSTALLVENDORARCH'    => '$(libdir)/pidgin/perl',
+    'INSTALLVENDORMAN3DIR' => '$(mandir)/man3',
+    'macro'                => {
+        'prefix'      => '@prefix@',
+        'exec_prefix' => '@exec_prefix@',
+        'libdir'      => '@libdir@',
+        'mandir'      => '@mandir@',
+        'datarootdir' => '@datarootdir@',
+    },
 );