From acba90be80a21749bdeb22e6c14bb906fe45a8c5 Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Fri, 2 Jun 2006 01:50:02 +0000 Subject: [PATCH] Refactor the file backend into a shared library and a loadable module. This should let us build on both Win32 AND MacOS, and means we don't need to compile the file-backend sources multiple times. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14296 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 14 ++++++++++ src/backend/Makefile.am | 2 -- src/backend/file/Makefile.am | 17 ++++++++--- src/backend/file/gnc-backend-file.c | 4 +-- src/backend/file/gnc-backend-file.h | 3 +- src/backend/gnc-backend-api.h | 31 --------------------- src/business/business-core/file/Makefile.am | 8 +----- src/gnome/Makefile.am | 26 ++--------------- 8 files changed, 34 insertions(+), 71 deletions(-) delete mode 100644 src/backend/gnc-backend-api.h diff --git a/ChangeLog b/ChangeLog index 17148f0db6..110d857821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,20 @@ * po/nb.po: updated Norwegian Bokmål translation by Sigve Indregard + * src/backend/Makefile.am: + * src/backend/gnc-backend-api.h: + deleted gnc-backend-api.h, which isn't needed by anything + * src/backend/file/gnc-backend-file.[ch]: + make "gnc_new_backend()" into a private function. It's + never called from anywhere, so it's not needed in the API. + * src/backend/file/Makefile.am: + Build a shared library (libgnc-backend-file-utils) and a + loadable module (libgnc-backend-file). This should let us + build on MacOS AND windows. + * src/business/business-core/file/Makefile.am: + * src/gnome/Makefile.am: + link against libgnc-backend-file-utils + 2006-06-01 Andreas Köhler * src/gnome-utils/dialog-preferences.c: Do not try to find diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am index 9e4b3111b2..f523c5e14d 100644 --- a/src/backend/Makefile.am +++ b/src/backend/Makefile.am @@ -1,5 +1,3 @@ SUBDIRS = file ${SQL_DIR} DIST_SUBDIRS = file postgres - -noinst_HEADERS = gnc-backend-api.h diff --git a/src/backend/file/Makefile.am b/src/backend/file/Makefile.am index 553c9a3752..b72b8df8c4 100644 --- a/src/backend/file/Makefile.am +++ b/src/backend/file/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = . test -#Now a shared GModule, not a package library. -lib_LTLIBRARIES = libgnc-backend-file.la +# Now a shared library AND a GModule +lib_LTLIBRARIES = libgnc-backend-file-utils.la libgnc-backend-file.la AM_CFLAGS = \ -I.. -I../.. \ @@ -15,9 +15,8 @@ AM_CFLAGS = \ ${GLIB_CFLAGS} \ ${GCONF_CFLAGS} -libgnc_backend_file_la_SOURCES = \ +libgnc_backend_file_utils_la_SOURCES = \ gnc-account-xml-v2.c \ - gnc-backend-file.c \ gnc-book-xml-v2.c \ gnc-budget-xml-v2.c \ gnc-commodity-xml-v2.c \ @@ -40,6 +39,9 @@ libgnc_backend_file_la_SOURCES = \ sixtp-utils.c \ sixtp.c +libgnc_backend_file_la_SOURCES = \ + gnc-backend-file.c + noinst_HEADERS = \ gnc-backend-file.h \ gnc-xml.h \ @@ -57,9 +59,16 @@ noinst_HEADERS = \ sixtp-stack.h \ sixtp-utils.h +libgnc_backend_file_utils_la_LIBADD = \ + ${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} \ + ${top_builddir}/src/engine/libgncmod-engine.la \ + ${top_builddir}/src/core-utils/libcore-utils.la \ + ${QOF_LIBS} + libgnc_backend_file_la_LDFLAGS = -module -avoid-version libgnc_backend_file_la_LIBADD = \ ${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} \ ${top_builddir}/src/engine/libgncmod-engine.la \ ${top_builddir}/src/core-utils/libcore-utils.la \ + libgnc-backend-file-utils.la \ ${QOF_LIBS} diff --git a/src/backend/file/gnc-backend-file.c b/src/backend/file/gnc-backend-file.c index 06876e6fca..ad1b1a9825 100644 --- a/src/backend/file/gnc-backend-file.c +++ b/src/backend/file/gnc-backend-file.c @@ -45,6 +45,7 @@ #include #include +#include "qof.h" #include "TransLog.h" #include "gnc-engine.h" @@ -53,7 +54,6 @@ #include "io-gncxml.h" #include "io-gncbin.h" #include "io-gncxml-v2.h" -#include "gnc-backend-api.h" #include "gnc-backend-file.h" #include "gnc-gconf-utils.h" @@ -945,7 +945,7 @@ compression_changed_cb(GConfEntry *entry, gpointer user_data) be->file_compression = gnc_gconf_get_bool("general", "file_compression", NULL); } -QofBackend* +static QofBackend* gnc_backend_new(void) { FileBackend *gnc_be; diff --git a/src/backend/file/gnc-backend-file.h b/src/backend/file/gnc-backend-file.h index 4bc946ff02..d55f2c3431 100644 --- a/src/backend/file/gnc-backend-file.h +++ b/src/backend/file/gnc-backend-file.h @@ -53,7 +53,8 @@ struct FileBackend_struct typedef struct FileBackend_struct FileBackend; -QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void); +// This is now a static inside the module +//QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void); G_MODULE_EXPORT const gchar * g_module_check_init(GModule *module); diff --git a/src/backend/gnc-backend-api.h b/src/backend/gnc-backend-api.h deleted file mode 100644 index bcb107ef8a..0000000000 --- a/src/backend/gnc-backend-api.h +++ /dev/null @@ -1,31 +0,0 @@ -/********************************************************************\ - * gnc-backend-api.h -- public functions needed by gnucash backends * - * Copyright (C) 2001 Linux Developers Group, Inc. * - * * - * 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, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - * * -\********************************************************************/ - -#ifndef GNC_BACKEND_API_H -#define GNC_BACKEND_API_H - -#include "qof.h" - -QofBackend * gnc_backend_new (void); - -#endif diff --git a/src/business/business-core/file/Makefile.am b/src/business/business-core/file/Makefile.am index 259c64ed27..87a2e7ab5e 100644 --- a/src/business/business-core/file/Makefile.am +++ b/src/business/business-core/file/Makefile.am @@ -43,15 +43,9 @@ noinst_HEADERS = \ libgncmod_business_backend_file_la_LDFLAGS = -module -# When building on windows, the following variable must also contain -# ${top_builddir}/src/backend/file/libgnc-backend-file.la, which won't -# build on MacOSX because libgnc-backend-file.so is a module and not a -# library. This problem has to be solved on an architectural basis by -# probably moving the relevant portion of libgnc-backend-file.so into -# a new shared library which will be used by both the gnc-backend-file -# module and this module here (and libgncgnome.so, too) libgncmod_business_backend_file_la_LIBADD = \ ${top_builddir}/src/business/business-core/libgncmod-business-core.la \ + ${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \ ${top_builddir}/src/engine/libgncmod-engine.la \ ${top_builddir}/src/gnc-module/libgncmodule.la \ ${LIBXML2_LIBS} \ diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am index 541288e6d5..fc86213720 100644 --- a/src/gnome/Makefile.am +++ b/src/gnome/Makefile.am @@ -14,6 +14,7 @@ libgncgnome_la_LIBADD = \ ${top_builddir}/src/report/report-system/libgncmod-report-system.la \ ${top_builddir}/src/gnome-search/libgncmod-gnome-search.la \ ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \ + ${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \ ${top_builddir}/src/app-utils/libgncmod-app-utils.la \ ${top_builddir}/src/engine/libgw-engine.la \ ${top_builddir}/src/engine/libgncmod-engine.la \ @@ -61,30 +62,7 @@ libgncgnome_la_SOURCES = \ lot-viewer.c \ reconcile-list.c \ top-level.c \ - window-reconcile.c \ - ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \ - ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \ - ${top_srcdir}/src/backend/file/sixtp-utils.c \ - ${top_srcdir}/src/backend/file/sixtp.c \ - ${top_srcdir}/src/backend/file/sixtp-stack.c \ - ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \ - ${top_srcdir}/src/backend/file/io-example-account.c \ - ${top_srcdir}/src/backend/file/io-gncbin-r.c \ - ${top_srcdir}/src/backend/file/io-gncxml-gen.c \ - ${top_srcdir}/src/backend/file/io-gncxml-v1.c \ - ${top_srcdir}/src/backend/file/io-gncxml-v2.c \ - ${top_srcdir}/src/backend/file/io-utils.c \ - ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-budget-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \ - ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c - + window-reconcile.c gnomeappdir = ${datadir}/applications