[glom] Allow parallel installs of libglom major versions.



commit fae942dd380cdf6f519a5cdcacd5a818b705466e
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 3 18:46:40 2009 +0200

    Allow parallel installs of libglom major versions.
    
    * configure.ac: Define GLOM_ABI_VERSION as 1.12.
    * glom/Makefile.am:
    * glom/libglom/Makefile.am:
            * glom/python_embed/Makefile.am
    * glom/python_embed/python_module/Makefile.am:
    * regression_tests/Makefile.am: Add a 1.12 suffix to
    the libglom shared library name and the glom python module name.
    This must be changed in several places when the ABI version changes
    because we cannot use a variable in most of these places.
    Define it also as a macro for the .cc files, so Glom can import the
    correct version of the Glom python module
    - for instance, import glom-1.12.
    * glom/python_embed/glom_python.cc:
    * glom/python_embed/python_module/py_glom_module.cc: Import the
    correct version in python.

 ChangeLog                                         |   32 +++++++++++++++++++++
 configure.ac                                      |    6 ++++
 glom/Makefile.am                                  |    5 ++-
 glom/libglom/Makefile.am                          |   20 ++++++------
 glom/python_embed/Makefile.am                     |    3 +-
 glom/python_embed/glom_python.cc                  |    6 ++--
 glom/python_embed/python_module/Makefile.am       |   15 +++++----
 glom/python_embed/python_module/py_glom_module.cc |    2 +-
 ldtp/database-creation/create-db.py               |    2 +-
 regression_tests/Makefile.am                      |    2 +-
 10 files changed, 67 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b6220d2..6d016a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2009-07-03  Murray Cumming  <murrayc murrayc com>
+
+	Allow parallel installs of libglom major versions.
+
+	* configure.ac: Define GLOM_ABI_VERSION as 1.12.
+	* glom/Makefile.am:
+	* glom/libglom/Makefile.am:
+        * glom/python_embed/Makefile.am 
+	* glom/python_embed/python_module/Makefile.am: 
+	* regression_tests/Makefile.am: Add a 1.12 suffix to 
+	the libglom shared library name and the glom python module name.
+	This must be changed in several places when the ABI version changes 
+	because we cannot use a variable in most of these places.
+	Define it also as a macro for the .cc files, so Glom can import the 
+	correct version of the Glom python module
+	- for instance, import glom-1.12.  
+	* glom/python_embed/glom_python.cc:
+	* glom/python_embed/python_module/py_glom_module.cc: Import the 
+	correct version in python.
+
+2009-07-03  Murray Cumming  <murrayc murrayc com>
+
+	* configure.ac: 
+	* glom/Makefile.am:
+	* glom/libglom/Makefile.am:
+	* glom/libglom/python_embed/Makefile.am:
+	* glom/python_embed/glom_python.cc:
+	* glom/python_embed/python_module/Makefile.am: 
+	* glom/python_embed/python_module/py_glom_module.cc:
+	* ldtp/database-creation/create-db.py:
+	* regression_tests/Makefile.am:
+
 2009-09-30  Armin Burgmeier  <armin openismus com>
 
 	* ldtp/fields-edit/fields-edit.py: Added a new test which tests adding
diff --git a/configure.ac b/configure.ac
index ca2dfaa..85bf879 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,12 @@ AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 AM_SANITY_CHECK
 
+# Used for the install directories for headers.
+# The same number is used in the library name, which must be kept in sync,
+# but variables can't be used with that.
+GLOM_ABI_VERSION=1.12
+AC_SUBST([GLOM_ABI_VERSION])
+
 # libgettext-po changed its API, changing the error handler struct from po_error_handler to po_xerror_handler:
 AC_CHECK_MEMBER([struct po_xerror_handler.xerror], [have_gettext_po_xerror="yes"], [have_gettext_po_xerror="no"], [#include <gettext-po.h>])
 if test "$have_gettext_po_xerror" = "yes"; then
diff --git a/glom/Makefile.am b/glom/Makefile.am
index 763e60b..5c0c07b 100644
--- a/glom/Makefile.am
+++ b/glom/Makefile.am
@@ -26,7 +26,8 @@ AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_
            -DGLOM_XSLTDIR=\""$(glomxsltdir)/"\" \
            -DGLOM_EXAMPLES_DIR=\""$(glom_examples_dir)"\" \
            -DGLOM_EXAMPLES_DIR_ALTERNATIVE=\""$(glom_examples_dir_alternative)"\" \
-           -DGLOM_ICON_DIR=\""$(glom_icon_dir)"\"
+           -DGLOM_ICON_DIR=\""$(glom_icon_dir)"\" \
+           -DGLOM_ABI_VERSION=\""$(GLOM_ABI_VERSION)\""
 
 glom_SOURCES = main.cc \
                application.cc application.h \
@@ -91,7 +92,7 @@ glom_LDADD += bakery/libbakery_app.a \
               utility_widgets/egg/util/libeggutil.la
 
 glom_LDADD += python_embed/libpython_embed.a \
-              $(top_builddir)/glom/libglom/libglom-1.0.la \
+              $(top_builddir)/glom/libglom/libglom-$(GLOM_ABI_VERSION).la \
               $(GLOM_LIBS) $(PYTHON_LDFLAGS) $(MAEMO_LAUNCHER_LIBS)
 
 if !WIN32
diff --git a/glom/libglom/Makefile.am b/glom/libglom/Makefile.am
index 3cab848..31f4d4c 100644
--- a/glom/libglom/Makefile.am
+++ b/glom/libglom/Makefile.am
@@ -41,20 +41,20 @@ cc_sources = appstate.cc \
                      utils.cc \
                      gst-package.c
 
-library_includedir=$(includedir)/glom-1.0/libglom
+library_includedir=$(includedir)/glom-$(GLOM_ABI_VERSION)/libglom
 library_include_HEADERS = $(h_sources_public)
 
-lib_LTLIBRARIES = libglom-1.0.la
-libglom_1_0_la_SOURCES = $(h_sources) $(cc_sources)
+lib_LTLIBRARIES = libglom-1.12.la
+libglom_1_12_la_SOURCES = $(h_sources) $(cc_sources)
 
-libglom_1_0_la_LDFLAGS = -no-undefined
+libglom_1_12_la_LDFLAGS = -no-undefined
 
 # Link libglom statically on maemo and windows for now.
 if GLOM_ENABLE_MAEMO
-libglom_1_0_la_LDFLAGS += -static
+libglom_1_12_la_LDFLAGS += -static
 endif
 
-libglom_1_0_la_LIBADD  = document/libdocument.la \
+libglom_1_12_la_LIBADD  = document/libdocument.la \
                      document/bakery/libdocument_bakery.la \
                      document/bakery/view/libdocument_bakery_view.la \
                      connectionpool_backends/libconnectionpool_backends.la \
@@ -65,7 +65,7 @@ libglom_1_0_la_LIBADD  = document/libdocument.la \
                      $(LIBGLOM_LIBS) $(PYTHON_LDFLAGS)
 
 if !WIN32
-libglom_1_0_la_LIBADD += -lutil
+libglom_1_12_la_LIBADD += -lutil
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
@@ -77,15 +77,15 @@ pkgconfig_DATA = glom-1.0.pc
 noinst_PROGRAMS = test_sharedptr_layoutitem test_connectionpool test_document
 
 test_sharedptr_layoutitem_SOURCES = test_sharedptr_layoutitem.cc
-test_sharedptr_layoutitem_LDADD =  libglom-1.0.la \
+test_sharedptr_layoutitem_LDADD =  libglom-1.12.la \
               $(LIBGLOM_LIBS)
 
 test_connectionpool_SOURCES = test_connectionpool.cc
-test_connectionpool_LDADD =  libglom-1.0.la \
+test_connectionpool_LDADD =  libglom-1.12.la \
               $(LIBGLOM_LIBS)
 
 test_document_SOURCES = test_document.cc
-test_document_LDADD =  libglom-1.0.la \
+test_document_LDADD =  libglom-1.12.la \
               $(LIBGLOM_LIBS)
 
 if !WIN32
diff --git a/glom/python_embed/Makefile.am b/glom/python_embed/Makefile.am
index 8fd56a4..458ebbd 100644
--- a/glom/python_embed/Makefile.am
+++ b/glom/python_embed/Makefile.am
@@ -1,4 +1,5 @@
-AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_FLAGS) $(PYTHON_INCLUDES)
+AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_FLAGS) $(PYTHON_INCLUDES) \
+           -DGLOM_ABI_VERSION=\""$(GLOM_ABI_VERSION)\""
 
 SUBDIRS = python_module
 
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index a49d83b..84e230c 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -138,7 +138,7 @@ void ShowTrace()
 
 bool glom_python_module_is_available()
 {
-  PyObject* module_glom = PyImport_ImportModule((char*)"glom"); //TODO: unref this?
+  PyObject* module_glom = PyImport_ImportModule((char*)"glom-" GLOM_ABI_VERSION); //TODO: unref this?
   return module_glom != 0;
 }
 
@@ -183,7 +183,7 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
 
   //prefix the def line:
   const Glib::ustring func_name = "glom_calc_field_value";
-  func_def = "def " + func_name + "(record):\n  import glom\n  import gda\n" + func_def;
+  func_def = "def " + func_name + "(record):\n  import glom-" GLOM_ABI_VERSION "\n  import gda\n" + func_def;
   //We did this in main(): Py_Initialize();
 
   PyObject* pMain = PyImport_AddModule((char*)"__main__");
@@ -218,7 +218,7 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
   }
 
 
-  PyObject* module_glom = PyImport_ImportModule((char*)"glom");
+  PyObject* module_glom = PyImport_ImportModule((char*)"glom-" GLOM_ABI_VERSION);
   if(!module_glom)
   {
     g_warning("Could not import python glom module.");
diff --git a/glom/python_embed/python_module/Makefile.am b/glom/python_embed/python_module/Makefile.am
index ea7d8fc..77bf752 100644
--- a/glom/python_embed/python_module/Makefile.am
+++ b/glom/python_embed/python_module/Makefile.am
@@ -1,4 +1,5 @@
-AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_FLAGS) $(PYTHON_INCLUDES)
+AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_FLAGS) $(PYTHON_INCLUDES) \
+           -DGLOM_ABI_VERSION=\""$(GLOM_ABI_VERSION)\""
 
 SUBDIRS =
 
@@ -6,21 +7,21 @@ SUBDIRS =
 common_ldflags = -module -avoid-version -no-undefined
 
 # Build and install the python module:
-pyexec_LTLIBRARIES = glom.la
-glom_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initglom
+pyexec_LTLIBRARIES = glom-1.12.la
+glom_1_12_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initglom
 
-glom_la_LIBADD = $(top_builddir)/glom/libglom/libglom-1.0.la \
+glom_1_12_la_LIBADD = $(top_builddir)/glom/libglom/libglom-1.12.la \
                  $(GLOM_LIBS) $(PYTHON_LDFLAGS)
 
 if !WIN32
-glom_la_LIBADD += -lutil
+glom_1_12_la_LIBADD += -lutil
 endif
 
-glom_la_SOURCES = py_glom_module.cc py_glom_module.h
+glom_1_12_la_SOURCES = py_glom_module.cc py_glom_module.h
 
 if WIN32
 # Python .pyd modules are simply DLLs, but they have to be called .pyd for
 # python to find them, and libtool only creates .dll.
 install-exec-hook:
-	mv $(pyexecdir)/glom.dll $(pyexecdir)/glom.pyd
+	mv $(pyexecdir)/glom.dll $(pyexecdir)/glom-1.12.pyd
 endif
diff --git a/glom/python_embed/python_module/py_glom_module.cc b/glom/python_embed/python_module/py_glom_module.cc
index e0f84f3..cbf0266 100644
--- a/glom/python_embed/python_module/py_glom_module.cc
+++ b/glom/python_embed/python_module/py_glom_module.cc
@@ -49,7 +49,7 @@ initglom(void)
     return;
 
 
-  m = Py_InitModule3((char*)"glom", pyglom_methods,
+  m = Py_InitModule3((char*)"glom-" GLOM_ABI_VERSION, pyglom_methods,
                       (char*)"Python module for Glom caluclated fields.");
 
 
diff --git a/ldtp/database-creation/create-db.py b/ldtp/database-creation/create-db.py
index bed5cb8..64b5ee2 100755
--- a/ldtp/database-creation/create-db.py
+++ b/ldtp/database-creation/create-db.py
@@ -133,7 +133,7 @@ try:
 	common.delete_test_database(backend)
 
 except LdtpExecutionError, msg:
-	log(msg, 'fail')
+	log(msg, 'cause')
 
 	# Print the exception to stdout because it does not seem to appear 
 	# in the log file: TODO: Fix that. murrayc.
diff --git a/regression_tests/Makefile.am b/regression_tests/Makefile.am
index c2ef0fd..66cf284 100644
--- a/regression_tests/Makefile.am
+++ b/regression_tests/Makefile.am
@@ -13,7 +13,7 @@ AM_CPPFLAGS = -I top_srcdir@/ -I top_srcdir@/glom $(GLOM_CFLAGS) $(GLOM_WARNING_
 noinst_PROGRAMS = test_parsing_time test_signal_reemit
 
 test_parsing_time_SOURCES = test_parsing_time.cc
-test_parsing_time_LDADD = $(GLOM_LIBS) $(top_builddir)/glom/libglom/libglom-1.0.la
+test_parsing_time_LDADD = $(GLOM_LIBS) $(top_builddir)/glom/libglom/libglom-1.12.la
 
 test_signal_reemit_SOURCES = test_signal_reemit.cc
 test_signal_reemit_LDADD = $(GLOM_LIBS) 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]