r18164 - gnucash/trunk/packaging/win32 - Build pgsql libdbi driver

Phil Longstaff plongstaff at code.gnucash.org
Mon Jun 29 17:10:22 EDT 2009


Author: plongstaff
Date: 2009-06-29 17:10:21 -0400 (Mon, 29 Jun 2009)
New Revision: 18164
Trac: http://svn.gnucash.org/trac/changeset/18164

Added:
   gnucash/trunk/packaging/win32/libdbi-drivers-dbd_pgsql.c.patch
Modified:
   gnucash/trunk/packaging/win32/defaults.sh
   gnucash/trunk/packaging/win32/dist.sh
   gnucash/trunk/packaging/win32/install.sh
Log:
Build pgsql libdbi driver


Modified: gnucash/trunk/packaging/win32/defaults.sh
===================================================================
--- gnucash/trunk/packaging/win32/defaults.sh	2009-06-28 22:54:47 UTC (rev 18163)
+++ gnucash/trunk/packaging/win32/defaults.sh	2009-06-29 21:10:21 UTC (rev 18164)
@@ -287,7 +287,8 @@
 set_default MYSQL_LIB_URL "http://mirror.csclub.uwaterloo.ca/mysql/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.1-win32.zip"
 set_default MYSQL_LIB_DIR $GLOBAL_DIR\\mysql
 set_default LIBMYSQL_DEF `pwd`/libmysql.def
-set_default PGSQL_LIB_DIR $GLOBAL_DIR\\pgsql
+set_default PGSQL_LIB_URL pgsql-win32.tar.gz
+set_default PGSQL_DIR $GLOBAL_DIR\\pgsql
 set_default LIBDBI_URL "http://downloads.sourceforge.net/libdbi/libdbi-0.8.3.tar.gz"
 set_default LIBDBI_DIR $GLOBAL_DIR\\libdbi
 set_default LIBDBI_PATCH `pwd`/libdbi-0.8.3.patch

Modified: gnucash/trunk/packaging/win32/dist.sh
===================================================================
--- gnucash/trunk/packaging/win32/dist.sh	2009-06-28 22:54:47 UTC (rev 18163)
+++ gnucash/trunk/packaging/win32/dist.sh	2009-06-29 21:10:21 UTC (rev 18164)
@@ -38,6 +38,7 @@
     _AQBANKING_UDIR=`unix_path $AQBANKING_DIR`
     _SQLITE3_UDIR=`unix_path ${SQLITE3_DIR}`
     _MYSQL_LIB_UDIR=`unix_path ${MYSQL_LIB_DIR}`
+    _PGSQL_UDIR=`unix_path ${PGSQL_DIR}`
     _LIBDBI_UDIR=`unix_path ${LIBDBI_DIR}`
     _LIBDBI_DRIVERS_UDIR=`unix_path ${LIBDBI_DRIVERS_DIR}`
     _LIBGDA_UDIR=`unix_path $LIBGDA_DIR`
@@ -195,8 +196,10 @@
     setup LibDBI
     cp -a ${_SQLITE3_UDIR}/bin/* ${DIST_UDIR}/bin
     cp -a ${_SQLITE3_UDIR}/lib/* ${DIST_UDIR}/lib
-	cp -a ${_MYSQL_LIB_UDIR}/bin/* ${DIST_UDIR}/bin
-	cp -a ${_MYSQL_LIB_UDIR}/lib/* ${DIST_UDIR}/lib
+    cp -a ${_MYSQL_LIB_UDIR}/bin/* ${DIST_UDIR}/bin
+    cp -a ${_MYSQL_LIB_UDIR}/lib/* ${DIST_UDIR}/lib
+    cp -a ${_PGSQL_UDIR}/bin/* ${DIST_UDIR}/bin
+    cp -a ${_PGSQL_UDIR}/lib/* ${DIST_UDIR}/lib
     cp -a ${_LIBDBI_UDIR}/bin/* ${DIST_UDIR}/bin
     cp -a ${_LIBDBI_UDIR}/lib/* ${DIST_UDIR}/lib
     mkdir ${DIST_UDIR}/lib/dbd

Modified: gnucash/trunk/packaging/win32/install.sh
===================================================================
--- gnucash/trunk/packaging/win32/install.sh	2009-06-28 22:54:47 UTC (rev 18163)
+++ gnucash/trunk/packaging/win32/install.sh	2009-06-29 21:10:21 UTC (rev 18164)
@@ -1041,6 +1041,7 @@
     setup LibDBI
     _SQLITE3_UDIR=`unix_path ${SQLITE3_DIR}`
     _MYSQL_LIB_UDIR=`unix_path ${MYSQL_LIB_DIR}`
+    _PGSQL_UDIR=`unix_path ${PGSQL_DIR}`
     _LIBDBI_UDIR=`unix_path ${LIBDBI_DIR}`
     _LIBDBI_DRIVERS_UDIR=`unix_path ${LIBDBI_DRIVERS_DIR}`
     add_to_env -I$_LIBDBI_UDIR/include LIBDBI_CPPFLAGS
@@ -1074,6 +1075,13 @@
         test -f ${_MYSQL_LIB_UDIR}/lib/libmysql.dll || die "mysql not installed correctly - libmysql.dll"
         test -f ${_MYSQL_LIB_UDIR}/lib/libmysqlclient.a || die "mysql not installed correctly - libmysqlclient.a"
     fi
+    if test -f ${_PSQL_LIB_UDIR}/lib/libpqsql.dll
+    then
+        echo "PGSQL library already installed.  skipping."
+    else
+        wget_unpacked $PGSQL_LIB_URL $DOWNLOAD_DIR $TMP_DIR
+        mv $TMP_UDIR/pgsql* $PGSQL_DIR
+    fi
     if test -f ${_LIBDBI_UDIR}/bin/libdbi-0.dll
     then
         echo "libdbi already installed.  skipping."
@@ -1093,8 +1101,9 @@
         qpopd
         test -f ${_LIBDBI_UDIR}/bin/libdbi-0.dll || die "libdbi not installed correctly"
     fi
-    if test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdsqlite3.dll &&
-       test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdmysql.dll
+    if test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdsqlite3.dll -a \
+            -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdmysql.dll -a \
+            -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdpgsql.dll
     then
         echo "libdbi drivers already installed.  skipping."
     else
@@ -1107,6 +1116,8 @@
                 patch -p0 < $LIBDBI_DRIVERS_PATCH2
             [ -n "$LIBDBI_DRIVERS_PATCH3" -a -f "$LIBDBI_DRIVERS_PATCH3" ] && \
                 patch -p0 < $LIBDBI_DRIVERS_PATCH3
+            [ -n "$LIBDBI_DRIVERS_PATCH4" -a -f "$LIBDBI_DRIVERS_PATCH4" ] && \
+                patch -p0 < $LIBDBI_DRIVERS_PATCH4
             LDFLAGS=-no-undefined ./configure ${HOST_XCOMPILE} \
                 --disable-docs \
                 --with-dbi-incdir=${_LIBDBI_UDIR}/include \
@@ -1115,12 +1126,15 @@
                 --with-sqlite3-dir=${_SQLITE3_UDIR} \
                 --with-mysql \
                 --with-mysql-dir=${_MYSQL_LIB_UDIR} \
+                --with-pgsql \
+                --with-pgsql-dir=${_PGSQL_UDIR} \
                 --prefix=${_LIBDBI_DRIVERS_UDIR}
             make
             make install
         qpopd
         test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdsqlite3.dll || die "libdbi sqlite3 driver not installed correctly"
         test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdmysql.dll || die "libdbi mysql driver not installed correctly"
+        test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdpgsql.dll || die "libdbi pgsql driver not installed correctly"
     fi
 }
 

Added: gnucash/trunk/packaging/win32/libdbi-drivers-dbd_pgsql.c.patch
===================================================================
--- gnucash/trunk/packaging/win32/libdbi-drivers-dbd_pgsql.c.patch	                        (rev 0)
+++ gnucash/trunk/packaging/win32/libdbi-drivers-dbd_pgsql.c.patch	2009-06-29 21:10:21 UTC (rev 18164)
@@ -0,0 +1,18 @@
+--- drivers/pgsql/dbd_pgsql.c	Sat Jan 26 12:39:50 2008
++++ drivers/pgsql/dbd_pgsql.c.new	Tue Jun  9 21:06:14 2009
+@@ -520,11 +520,11 @@
+   return db;
+ }
+ 
+-int dbd_geterror(dbi_conn_t *conn, int *errno, char **errstr) {
+-	/* put error number into errno, error string into errstr
+-	 * return 0 if error, 1 if errno filled, 2 if errstr filled, 3 if both errno and errstr filled */
++int dbd_geterror(dbi_conn_t *conn, int *err_no, char **errstr) {
++	/* put error number into err_no, error string into errstr
++	 * return 0 if error, 1 if err_no filled, 2 if errstr filled, 3 if both err_no and errstr filled */
+ 	
+-	*errno = 0;
++	*err_no = 0;
+ 	*errstr = strdup(PQerrorMessage((PGconn *)conn->connection));
+ 	
+ 	return 2;



More information about the gnucash-changes mailing list