----------------------------------------------------------------- Revision: 45071f0b2b50cd4c2d6993e2f8cdb709dd0d6606 Ancestor: 5a1b790556f2372c9cfc080af4a11e3c3d19b2ce Author: deryni@pidgin.im Date: 2007-04-27T04:25:21 Branch: im.pidgin.pidgin Modified files: libpurple/plugins/perl/Makefile.am libpurple/plugins/perl/perl.c ChangeLog: Kill the libpurpleperl hack library and move the init stuff to perl.so itself. This works fine for me and I'm hoping will work fine on Solaris as well. When it gets tested we'll want to drop libpurpleperl.c but until I know it works I don't want to drop it (because of mtn's die die dir merge stuff). ============================================================ --- libpurple/plugins/perl/Makefile.am 3518ce198c5e1c7fdeb3febdfbf5ebb718eb4fe2 +++ libpurple/plugins/perl/Makefile.am a4f9187f35a74b4187f88c462ee63639d5a1d15b @@ -1,13 +1,11 @@ plugindir = $(libdir)/purple plugindir = $(libdir)/purple -hackdir = $(plugindir)/private perl_dirs = common plugin_LTLIBRARIES = perl.la -hack_LTLIBRARIES = libpurpleperl.la perl_la_LDFLAGS = -module -avoid-version -perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS) libpurpleperl.la +perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS) perl_la_SOURCES = \ perl.c \ perl-common.c \ @@ -17,13 +15,8 @@ perl_la_DEPENDENCIES = \ perl_la_DEPENDENCIES = \ .libs/libperl_orig.a \ - .libs/DynaLoader.a \ - libpurpleperl.la + .libs/DynaLoader.a -libpurpleperl_la_LDFLAGS = -module -avoid-version -libpurpleperl_la_LIBADD = $(GLIB_LIBS) -libpurpleperl_la_SOURCES = libpurpleperl.c - .libs/libperl_orig.a: @mkdir -p .libs @rm -f .libs/libperl_orig.a @@ -89,8 +82,7 @@ EXTRA_DIST = \ EXTRA_DIST = \ Makefile.mingw \ common/Makefile.mingw \ - $(common_sources) \ - libpurpleperl.c + $(common_sources) common/Makefile: common/Makefile.PL @if test "x${top_srcdir}" != "x${top_builddir}"; then \ ============================================================ --- libpurple/plugins/perl/perl.c eb1bd2f3253b8435b5b02784e6ff86a34c9a08f1 +++ libpurple/plugins/perl/perl.c a2dc08ba952afed765f024b06d1c2837c82f38d2 @@ -608,4 +608,23 @@ init_plugin(PurplePlugin *plugin) loader_info.exts = g_list_append(loader_info.exts, "pl"); } +#ifdef __SUNPRO_C +#pragma init (my_init) +#else +void __attribute__ ((constructor)) my_init(void); +#endif + +void +my_init(void) +{ + /* Mostly evil hack... puts perl.so's symbols in the global table but + * does not create a circular dependency because g_module_open will + * only open the library once. */ + /* Do we need to keep track of the returned GModule here so that we + * can g_module_close it when this plugin gets unloaded? + * At the moment I don't think this plugin can ever get unloaded but + * in case that becomes possible this wants to get noted. */ + g_module_open("perl.so", 0); +} + PURPLE_INIT_PLUGIN(perl, init_plugin, info)