[Libreoffice] PostgreSQL-SDBC in LO: build system help

Norbert Thiebaud nthiebaud at gmail.com
Thu Nov 17 01:22:33 PST 2011


Hi Lionel,

On Wed, Nov 16, 2011 at 4:22 PM, Lionel Elie Mamane <lionel at mamane.lu> wrote:
> I'd like some help from a LO build system "expert" to make
> postgresql-sdbc well-behaved in this other and build-related respects:

attache a patch that make building it conditional.

few questions/remarks (mostly on the form, rather than on substance...
I only glanced at the commits)

Is there a reason why did you not push it as a feature branch on our own git ?

5a2b8cba519bb9d34d3a28a51adcda334147096f:
Humm, not sure you can do that, but even if you could, removing SISSL
is not a good idea since that is what allow that code to be merged in
libreoffice (which is MPL/LGPLv3+)


nitpick: f1127d15dfa2cf03cb4a0c79bc2ddf332b8d6093 and later:

@@ -1,42 +1,42 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; eval:(c-set-style "bsd"); tab-width: 4;
indent-tabs-mode: nil; c-basic-offset: 4 -*- */

please don't do that. I have a style set to what works for me, it is
no nice to try to force another on me.
(note that I'm actually fine with the bsd-style you picked there...
but that is not the point)

that tagline line was meant to force only the 'mandatory part' : no
tabs and indent of 4.


Norbert
-------------- next part --------------
From 401a9fe32c707b066dc8ab084b13cb3bc845a225 Mon Sep 17 00:00:00 2001
From: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Thu, 17 Nov 2011 03:18:49 -0600
Subject: [PATCH] make postgresql-sdbc connectivity optional

---
 configure.in                                       |   34 +++++++++++++-------
 connectivity/source/drivers/postgresql/makefile.mk |    5 +++
 set_soenv.in                                       |    1 +
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/configure.in b/configure.in
index d586b46..e75548b 100644
--- a/configure.in
+++ b/configure.in
@@ -359,6 +359,11 @@ AC_ARG_ENABLE(ext-pdfimport,
         [Disable the PDF Import extension.])
 )
 
+AC_ARG_ENABLE(ext-postgresql-sdbc,
+    AS_HELP_STRING([--enable-ext-postgresql-sdbc],
+        [Enable the build of the PostgreSQL sdbc extension.])
+)
+
 AC_ARG_ENABLE(ext-presenter-console,
     AS_HELP_STRING([--disable-ext-presenter-console],
         [Disable the Presenter Console extension.])
@@ -5358,19 +5363,24 @@ fi
 dnl ===================================================================
 dnl Check for PostgreSQL stuff
 dnl ===================================================================
-AC_PATH_PROG(PGCONFIG, pg_config)
-if test -z "$PGCONFIG"; then
-    AC_MSG_ERROR([pg_config needed])
-fi
-save_CFLAGS=$CFLAGS
-save_LIBS=$LIBS
-CFLAGS="-I`pg_config --includedir`"
-AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
-AC_CHECK_LIB(pq, PQconnectdbParams, [],
-    [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
-CFLAGS=$save_CFLAGS
-LIBS=$save_LIBS
-SYSTEM_POSTGRESQL=YES # only option atm :-)
+
+if test "x$enable_ext_postgresql_sdbc" = "xyes"; then
+    AC_PATH_PROG(PGCONFIG, pg_config)
+    if test -z "$PGCONFIG"; then
+        AC_MSG_ERROR([pg_config needed])
+    fi
+    save_CFLAGS=$CFLAGS
+    save_LIBS=$LIBS
+    CFLAGS="-I`pg_config --includedir`"
+    AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
+    AC_CHECK_LIB(pq, PQconnectdbParams, [],
+        [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
+    CFLAGS=$save_CFLAGS
+    LIBS=$save_LIBS
+    BUILD_POSTGRESQL_SDBC=YES
+    SYSTEM_POSTGRESQL=YES # only option atm :-)
+fi
+AC_SUBST(BUILD_POSTGRESQL_SDBC)
 AC_SUBST(SYSTEM_POSTGRESQL)
 
 dnl ===================================================================
diff --git a/connectivity/source/drivers/postgresql/makefile.mk b/connectivity/source/drivers/postgresql/makefile.mk
index 43b4d5d..8c8c022 100644
--- a/connectivity/source/drivers/postgresql/makefile.mk
+++ b/connectivity/source/drivers/postgresql/makefile.mk
@@ -36,6 +36,9 @@ NO_DEFAULT_STL=TRUE
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  settings.mk
+
+.IF "$(BUILD_POSTGRESQL_SDBC)" == "YES"
+
 .IF "$(SYSTEM_POSTGRESQL)" != "YES"
 .INCLUDE :  $(SOLARINCDIR)$/postgresql/postgresql-version.mk
 .ENDIF
@@ -145,6 +148,8 @@ SLOFILES=       $(LIB1OBJFILES) $(LIB2OBJFILES)
 DRIVERNAME=postgresql-sdbc-$(PQ_SDBC_VERSION).oxt
 ALLTAR : $(DLLDEST)$/$(DRIVERNAME)
 
+.ENDIF # BUILD_POSTGRESQL_SDBC
+
 # --- Targets ------------------------------------------------------
 .INCLUDE :  target.mk
 
diff --git a/set_soenv.in b/set_soenv.in
index 8538419..78bc704 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -2002,6 +2002,7 @@ ToFile( "XINERAMA_LINK",     "@XINERAMA_LINK@",    "e" );
 ToFile( "SYSTEM_REDLAND",    "@SYSTEM_REDLAND@",   "e" );
 ToFile( "REDLAND_CFLAGS",    "@REDLAND_CFLAGS@",   "e" );
 ToFile( "REDLAND_LIBS",      "@REDLAND_LIBS@",     "e" );
+ToFile( "BUILD_POSTGRESQL_SDBC",   "@BUILD_POSTGRESQL_SDBC@", "e" );
 ToFile( "SYSTEM_POSTGRESQL", "@SYSTEM_POSTGRESQL@", "e" );
 ToFile( "SYSTEM_HUNSPELL",   "@SYSTEM_HUNSPELL@",  "e" );
 ToFile( "HUNSPELL_CFLAGS",   "@HUNSPELL_CFLAGS@",  "e" );
-- 
1.7.3.4


More information about the LibreOffice mailing list