[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_99-8-g1df2226

Rémi Cardona nobody at users.sourceforge.net
Fri Jan 28 01:21:36 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  1df22263b02a7817c0656367fa86d180a8b96f61 (commit)
       via  da6be3f2963a77c433b9f7e914590d47fdf0ee71 (commit)
       via  088312c712b45be65d0e48cdcdd47758d5811ec5 (commit)
      from  298a54bbb7668f13c517bd54f3d29b9b1f502a8c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1df22263b02a7817c0656367fa86d180a8b96f61
Author: Rémi Cardona <remi at gentoo.org>
Date:   Fri Jan 28 00:52:34 2011 +0100

    build: add --enable-static-plugins support

commit da6be3f2963a77c433b9f7e914590d47fdf0ee71
Author: Rémi Cardona <remi at gentoo.org>
Date:   Wed Jan 26 22:59:45 2011 +0100

    build: compile the content of src/ after src/plugins/ and src/tests/
    
    Needed for later commits

commit 088312c712b45be65d0e48cdcdd47758d5811ec5
Author: Rémi Cardona <remi at gentoo.org>
Date:   Fri Jan 28 00:52:59 2011 +0100

    remote useless externs declarations

-----------------------------------------------------------------------

Changes:
diff --git a/configure.in b/configure.in
index a9fc085..9dc897d 100644
--- a/configure.in
+++ b/configure.in
@@ -282,6 +282,21 @@ else
 fi
 
 dnl ================================================================
+dnl Static or Shared plugins support
+dnl ================================================================
+
+AC_ARG_ENABLE(static-plugins,
+	AS_HELP_STRING(
+		[--enable-static-plugins],
+		[Statically build all plugins inside the main binary (default=no)]),
+	enable_static=$enableval,
+	enable_static=no)
+if test "$enable_static" = yes; then
+	AC_DEFINE(ENABLE_STATIC, 1, [Statically build all plugins inside the main binary])
+fi
+AM_CONDITIONAL(ENABLE_STATIC, [test "$enable_static" = yes])
+
+dnl ================================================================
 dnl Makefiles
 dnl ================================================================
 
@@ -318,6 +333,7 @@ echo "
                 Build with libxml2:        $build_libxml2
                 Build with OpenSSL:        $build_openssl
                 Build with OFX plugin:     $build_ofx
+                Build plugins statically:  $enable_static
                 Build ige_mac_integration: $os_osx
                 CUnit/unit tests support:  $build_cunit
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 1fd560f..4ef3bd4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,14 +1,23 @@
 # Process this file with automake to produce Makefile.in
 
 AM_CPPFLAGS = -I$(top_srcdir) $(GRISBI_CFLAGS) $(IGE_MAC_CFLAGS) -DLOCALEDIR=\"$(localedir)\" -DPIXMAPS_DIR="\"$(datadir)/pixmaps/@PACKAGE@\"" -DPLUGINS_DIR="\"$(plugindir)\"" -DLOGO_PATH="\"$(datadir)/pixmaps/@PACKAGE@/grisbi-logo.png\"" -DDATA_PATH="\"$(datadir)/@PACKAGE@\"" -DHELP_PATH="\"$(docdir)\""
-bin_PROGRAMS = grisbi
 
+bin_PROGRAMS = grisbi
 noinst_LTLIBRARIES = libgrisbi.la
 
 grisbi_LDADD = $(GRISBI_LIBS) $(IGE_MAC_LIBS) libgrisbi.la
 
+libgrisbi_la_LIBADD =
+if ENABLE_STATIC
+libgrisbi_la_LIBADD += \
+	plugins/gnucash/gnucash.la \
+	plugins/ofx/ofx.la \
+	plugins/openssl/openssl.la
+else
 libgrisbi_la_LDFLAGS = -export_dynamic
-libgrisbi_la_LIBADD = $(GRISBI_LIBS) $(IGE_MAC_LIBS)
+endif
+libgrisbi_la_LIBADD += $(GRISBI_LIBS) $(IGE_MAC_LIBS)
+
 libgrisbi_la_SOURCES = \
 	accueil.c		\
 	affichage.c		\
@@ -95,7 +104,6 @@ libgrisbi_la_SOURCES = \
 	gsb_fyear_config.c	\
 	gsb_payment_method.c	\
 	gsb_payment_method_config.c	\
-	gsb_plugins.c		\
 	gsb_real.c		\
 	gsb_reconcile.c		\
 	gsb_reconcile_config.c	\
@@ -295,11 +303,17 @@ libgrisbi_la_SOURCES = \
 	utils_operations.h	\
 	utils_str.h
 
+if ENABLE_STATIC
+libgrisbi_la_SOURCES += gsb_plugins_static.c
+else
+libgrisbi_la_SOURCES += gsb_plugins.c
+endif
+
 grisbi_SOURCES = 		\
 	main.c				\
 	main.h
 
-SUBDIRS = .
+SUBDIRS =
 
 if HAVE_CUNIT
 SUBDIRS += tests
diff --git a/src/gsb_plugins.c b/src/gsb_plugins.c
index 6ebb710..e2c0a9f 100644
--- a/src/gsb_plugins.c
+++ b/src/gsb_plugins.c
@@ -28,9 +28,6 @@
 /*END_INCLUDE*/
 
 /*START_EXTERN*/
-extern const gchar plugin_name[];
-extern const gchar plugin_name[];
-extern const gchar plugin_name[];
 /*END_EXTERN*/
 
 /*START_STATIC*/
diff --git a/src/gsb_plugins_static.c b/src/gsb_plugins_static.c
new file mode 100644
index 0000000..4f1fcaa
--- /dev/null
+++ b/src/gsb_plugins_static.c
@@ -0,0 +1,165 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*     Copyright (C)	2006-2006 Benjamin Drieu (bdrieu at april.org)	      */
+/* 			http://www.grisbi.org				      */
+/*                                                                            */
+/*  This program is free software; you can redistribute it and/or modify      */
+/*  it under the terms of the GNU General Public License as published by      */
+/*  the Free Software Foundation; either version 2 of the License, or         */
+/*  (at your option) any later version.                                       */
+/*                                                                            */
+/*  This program is distributed in the hope that it will be useful,           */
+/*  but WITHOUT ANY WARRANTY; without even the implied warranty of            */
+/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
+/*  GNU General Public License for more details.                              */
+/*                                                                            */
+/*  You should have received a copy of the GNU General Public License         */
+/*  along with this program; if not, write to the Free Software               */
+/*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "include.h"
+
+/*START_INCLUDE*/
+#include "gsb_plugins.h"
+#include "dialog.h"
+#include "include.h"
+#include "plugins/gnucash/gnucash.h"
+#include "plugins/ofx/ofx.h"
+#include "plugins/openssl/openssl.h"
+/*END_INCLUDE*/
+
+/*START_EXTERN*/
+/*END_EXTERN*/
+
+/*START_STATIC*/
+/*END_STATIC*/
+
+
+/** List of registered plugins.  It should contain gsb_plugin structures. */
+static GSList * plugins = NULL;
+
+/**
+ *
+ *
+ */
+void gsb_plugins_scan_dir ( const char *dirname )
+{
+    gsb_plugin *plugin = NULL;
+
+    plugin = g_malloc0 ( sizeof ( gsb_plugin ) );
+    plugin -> name = "gnucash";
+    plugin -> plugin_register = &gnucash_plugin_register;
+    plugin -> plugin_run =      &gnucash_plugin_run;
+    plugin -> plugin_release =  &gnucash_plugin_release;
+    plugin -> plugin_register ();
+    plugins = g_slist_append ( plugins, plugin );
+
+    plugin = g_malloc0 ( sizeof ( gsb_plugin ) );
+    plugin -> name = "ofx";
+    plugin -> plugin_register = &ofx_plugin_register;
+    plugin -> plugin_run =      &ofx_plugin_run;
+    plugin -> plugin_release =  &ofx_plugin_release;
+    plugin -> plugin_register ();
+    plugins = g_slist_append ( plugins, plugin );
+
+    plugin = g_malloc0 ( sizeof ( gsb_plugin ) );
+    plugin -> name = "openssl";
+    plugin -> plugin_register = &openssl_plugin_register;
+    plugin -> plugin_run =      &openssl_plugin_run;
+    plugin -> plugin_release =  &openssl_plugin_release;
+    plugin -> plugin_register ();
+    plugins = g_slist_append ( plugins, plugin );
+}
+
+
+
+/**
+ *
+ *
+ *
+ */
+gsb_plugin * gsb_plugin_find ( gchar * plugin_name )
+{
+    GSList * tmp = plugins;
+
+    g_return_val_if_fail ( plugin_name, NULL );
+    
+    while ( tmp )
+    {
+	gsb_plugin * plugin = (gsb_plugin *) tmp -> data;
+
+	if ( ! strcmp ( plugin_name, plugin -> name ) )
+	{
+	    return plugin;
+	}
+
+	tmp = tmp -> next;
+    }
+
+    return NULL;
+}
+
+
+
+/**
+ * Get activated plugins.
+ *
+ * \return A newly-allocated string representing activated plugins.
+ */
+gchar * gsb_plugin_get_list ()
+{
+    gchar * list = NULL;
+    gchar * old_list = NULL;
+    GSList * tmp = plugins;
+
+    while ( tmp )
+    {
+	gsb_plugin * plugin = (gsb_plugin *) tmp -> data;
+
+	if ( ! list )
+	{
+	    list = g_strconcat ( _("with plugins"), " ", plugin -> name, NULL );
+	}
+	else
+	{
+	    old_list = list;
+	    list = g_strconcat ( list, ", ", plugin -> name, NULL );
+	    g_free(old_list);
+	}
+
+	tmp = tmp -> next;
+    }
+    if (! list)
+    	list = g_strdup("no plugin");
+
+    return list;
+}
+
+
+
+/**
+ *
+ *
+ *
+ */
+void gsb_plugins_release ( )
+{
+    GSList * tmp = plugins;
+
+    while ( tmp )
+    {
+	gsb_plugin * plugin = (gsb_plugin *) tmp -> data;
+
+	plugin -> plugin_release ();
+
+	tmp = tmp -> next;
+    }        
+}
+
+
+
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */
diff --git a/src/plugins/gnucash/Makefile.am b/src/plugins/gnucash/Makefile.am
index f368c05..bebe254 100644
--- a/src/plugins/gnucash/Makefile.am
+++ b/src/plugins/gnucash/Makefile.am
@@ -4,7 +4,11 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src $(GRISBI_CFLAGS) $(XML2_CFLAGS
 
 if HAVE_XML2
 
+if ENABLE_STATIC
+noinst_LTLIBRARIES = gnucash.la
+else
 plugin_LTLIBRARIES = gnucash.la
+endif
 gnucash_la_SOURCES = gnucash.c gnucash.h
 gnucash_la_LDFLAGS = -module -avoid-version
 gnucash_la_LIBADD = $(XML2_LIBS)
diff --git a/src/plugins/gnucash/gnucash.c b/src/plugins/gnucash/gnucash.c
index 08b6e9d..10221d7 100644
--- a/src/plugins/gnucash/gnucash.c
+++ b/src/plugins/gnucash/gnucash.c
@@ -75,8 +75,10 @@ static struct import_format gnucash_format = {
 GSList * gnucash_accounts = NULL;
 
 
+#ifndef ENABLE_STATIC
 /** Module name. */
 G_MODULE_EXPORT const gchar plugin_name[] = "gnucash";
+#endif
 
 
 
diff --git a/src/plugins/ofx/Makefile.am b/src/plugins/ofx/Makefile.am
index e8b9f27..341ada8 100644
--- a/src/plugins/ofx/Makefile.am
+++ b/src/plugins/ofx/Makefile.am
@@ -4,7 +4,11 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src $(GRISBI_CFLAGS) $(LIBOFX_CFLA
 
 if HAVE_OFX
 
+if ENABLE_STATIC
+noinst_LTLIBRARIES = ofx.la
+else
 plugin_LTLIBRARIES = ofx.la
+endif
 ofx_la_SOURCES = ofx.c ofx.h
 ofx_la_LDFLAGS = -module -avoid-version
 ofx_la_LIBADD = $(LIBOFX_LIBS)
diff --git a/src/plugins/ofx/ofx.c b/src/plugins/ofx/ofx.c
index 9fb5907..52ed1f1 100644
--- a/src/plugins/ofx/ofx.c
+++ b/src/plugins/ofx/ofx.c
@@ -52,8 +52,10 @@ static struct import_format ofx_format ={
 
 
 
+#ifndef ENABLE_STATIC
 /** Module name. */
 G_MODULE_EXPORT const gchar plugin_name[] = "ofx";
+#endif
 
 
 
diff --git a/src/plugins/openssl/Makefile.am b/src/plugins/openssl/Makefile.am
index 6c27c4f..5717d04 100644
--- a/src/plugins/openssl/Makefile.am
+++ b/src/plugins/openssl/Makefile.am
@@ -4,7 +4,11 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src $(GRISBI_CFLAGS) $(OPENSSL_CFL
 
 if HAVE_SSL
 
+if ENABLE_STATIC
+noinst_LTLIBRARIES = openssl.la
+else
 plugin_LTLIBRARIES = openssl.la
+endif
 openssl_la_SOURCES = openssl.c openssl.h
 openssl_la_LDFLAGS = -module -avoid-version
 openssl_la_LIBADD = $(OPENSSL_LIBS)
diff --git a/src/plugins/openssl/openssl.c b/src/plugins/openssl/openssl.c
index 07bd5cb..c59cccb 100644
--- a/src/plugins/openssl/openssl.c
+++ b/src/plugins/openssl/openssl.c
@@ -313,8 +313,10 @@ return_bad_password:
 #endif
 
 
+#ifndef ENABLE_STATIC
 /** Module name. */
 G_MODULE_EXPORT const gchar plugin_name[] = "openssl";
+#endif
 
 
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list