r17473 - gnucash/trunk/packaging/win32 - Add support to build trunk with libdbi and dbi backend on win32/mingw

Phil Longstaff plongstaff at cvs.gnucash.org
Sun Aug 17 12:38:32 EDT 2008


Author: plongstaff
Date: 2008-08-17 12:38:31 -0400 (Sun, 17 Aug 2008)
New Revision: 17473
Trac: http://svn.gnucash.org/trac/changeset/17473

Added:
   gnucash/trunk/packaging/win32/libdbi-0.8.3.patch
   gnucash/trunk/packaging/win32/libdbi-drivers-Makefile.in.patch
   gnucash/trunk/packaging/win32/libdbi-drivers-dbd_sqlite3.c.patch
Modified:
   gnucash/trunk/packaging/win32/defaults.sh
   gnucash/trunk/packaging/win32/install.sh
Log:
Add support to build trunk with libdbi and dbi backend on win32/mingw



Modified: gnucash/trunk/packaging/win32/defaults.sh
===================================================================
--- gnucash/trunk/packaging/win32/defaults.sh	2008-08-15 17:04:36 UTC (rev 17472)
+++ gnucash/trunk/packaging/win32/defaults.sh	2008-08-17 16:38:31 UTC (rev 17473)
@@ -267,6 +267,16 @@
 set_default LIBGDA_PATCH `pwd`/libgda-3.1.2-patch.diff
 set_default LIBGDA_PATCH2 `pwd`/libgda-3.1.2-patch2.diff
 
+set_default SQLITE3_URL "http://sqlite.org/sqlite-amalgamation-3.6.1.tar.gz"
+set_default SQLITE3_DIR $GLOBAL_DIR\\sqlite3
+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
+set_default LIBDBI_DRIVERS_URL "http://downloads.sourceforge.net/libdbi-drivers/libdbi-drivers-0.8.3-1.tar.gz"
+set_default LIBDBI_DRIVERS_DIR $GLOBAL_DIR\\libdbi-drivers
+set_default LIBDBI_DRIVERS_PATCH `pwd`/libdbi-drivers-dbd_sqlite3.c.patch
+set_default LIBDBI_DRIVERS_PATCH2 `pwd`/libdbi-drivers-Makefile.in.patch
+
 set_default DOCBOOK_XSL_URL "$SF_MIRROR/docbook/docbook-xsl-1.72.0.zip"
 set_default UPDATE_DOCS yes
 set_default DOCS_REV "HEAD"
@@ -310,7 +320,7 @@
 add_step inst_gwenhywfar
 add_step inst_ktoblzcheck
 add_step inst_aqbanking
-add_step inst_libgda
+add_step inst_libdbi
 ##
 if [ "$CROSS_COMPILE" != "yes" ]; then
  add_step inst_inno

Modified: gnucash/trunk/packaging/win32/install.sh
===================================================================
--- gnucash/trunk/packaging/win32/install.sh	2008-08-15 17:04:36 UTC (rev 17472)
+++ gnucash/trunk/packaging/win32/install.sh	2008-08-17 16:38:31 UTC (rev 17473)
@@ -23,6 +23,8 @@
 register_env_var HH_CPPFLAGS " "
 register_env_var HH_LDFLAGS " "
 register_env_var INTLTOOL_PERL " "
+register_env_var LIBDBI_CPPFLAGS " "
+register_env_var LIBDBI_LDFLAGS " "
 register_env_var KTOBLZCHECK_CPPFLAGS " "
 register_env_var KTOBLZCHECK_LDFLAGS " "
 register_env_var PATH ":"
@@ -929,6 +931,69 @@
     fi
 }
 
+function inst_libdbi() {
+    setup LibDBI
+    _SQLITE3_UDIR=`unix_path ${SQLITE3_DIR}`
+    _LIBDBI_UDIR=`unix_path ${LIBDBI_DIR}`
+    _LIBDBI_DRIVERS_UDIR=`unix_path ${LIBDBI_DRIVERS_DIR}`
+    add_to_env -I$_LIBDBI_UDIR/include LIBDBI_CPPFLAGS
+    add_to_env -L$_LIBDBI_UDIR/lib LIBDBI_LDFLAGS
+    if test -f ${_SQLITE3_UDIR}/bin/libsqlite3-0.dll
+    then
+        echo "SQLite3 already installed.  skipping."
+    else
+        wget_unpacked $SQLITE3_URL $DOWNLOAD_DIR $TMP_DIR
+        assert_one_dir $TMP_UDIR/sqlite-*
+        qpushd $TMP_UDIR/sqlite-*
+	    ./configure \
+	        --prefix=${_SQLITE3_UDIR}
+	    make
+	    make install
+	qpopd
+        test -f ${_SQLITE3_UDIR}/bin/libsqlite3-0.dll || die "SQLite3 not installed correctly"
+    fi
+    if test -f ${_LIBDBI_UDIR}/bin/libdbi-0.dll
+    then
+        echo "libdbi already installed.  skipping."
+    else
+        wget_unpacked $LIBDBI_URL $DOWNLOAD_DIR $TMP_DIR
+        assert_one_dir $TMP_UDIR/libdbi-0*
+        qpushd $TMP_UDIR/libdbi-0*
+            [ -n "$LIBDBI_PATCH" -a -f "$LIBDBI_PATCH" ] && \
+                patch -p0 < $LIBDBI_PATCH
+	    ./configure \
+	        --disable-docs \
+	    	--prefix=${_LIBDBI_UDIR}
+	    make
+	    make install
+        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
+    then
+        echo "libdbi drivers already installed.  skipping."
+    else
+        wget_unpacked $LIBDBI_DRIVERS_URL $DOWNLOAD_DIR $TMP_DIR
+        assert_one_dir $TMP_UDIR/libdbi-drivers-*
+        qpushd $TMP_UDIR/libdbi-drivers*
+            [ -n "$LIBDBI_DRIVERS_PATCH" -a -f "$LIBDBI_DRIVERS_PATCH" ] && \
+                patch -p0 < $LIBDBI_DRIVERS_PATCH
+            [ -n "$LIBDBI_DRIVERS_PATCH2" -a -f "$LIBDBI_DRIVERS_PATCH2" ] && \
+                patch -p0 < $LIBDBI_DRIVERS_PATCH2
+	    ./configure \
+	        --disable-docs \
+		--with-dbi-incdir=${_LIBDBI_UDIR}/include \
+		--with-dbi-libdir=${_LIBDBI_UDIR}/lib \
+		--with-sqlite3 \
+		--with-sqlite3-dir=${_SQLITE3_UDIR} \
+	    	--prefix=${_LIBDBI_DRIVERS_UDIR}
+	    make
+	    make install
+        qpopd
+        test -f ${_LIBDBI_DRIVERS_UDIR}/lib/dbd/libdbdsqlite3.dll || die "libdbi drivers not installed correctly"
+    fi
+}
+
 function inst_libgda() {
     setup LibGDA
     _LIBGDA_UDIR=`unix_path ${LIBGDA_DIR}`
@@ -1002,12 +1067,13 @@
             --prefix=$_INSTALL_WFSDIR \
             --enable-debug \
             --enable-schemas-install=no \
+	    --enable-dbi \
             ${LIBOFX_OPTIONS} \
             ${AQBANKING_OPTIONS} \
             --enable-binreloc \
             --enable-locale-specific-tax \
-            CPPFLAGS="${AUTOTOOLS_CPPFLAGS} ${REGEX_CPPFLAGS} ${GNOME_CPPFLAGS} ${GUILE_CPPFLAGS} ${KTOBLZCHECK_CPPFLAGS} ${HH_CPPFLAGS} -D_WIN32" \
-            LDFLAGS="${AUTOTOOLS_LDFLAGS} ${REGEX_LDFLAGS} ${GNOME_LDFLAGS} ${GUILE_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${HH_LDFLAGS}" \
+            CPPFLAGS="${AUTOTOOLS_CPPFLAGS} ${REGEX_CPPFLAGS} ${GNOME_CPPFLAGS} ${GUILE_CPPFLAGS} ${LIBDBI_CPPFLAGS} ${KTOBLZCHECK_CPPFLAGS} ${HH_CPPFLAGS} -D_WIN32" \
+            LDFLAGS="${AUTOTOOLS_LDFLAGS} ${REGEX_LDFLAGS} ${GNOME_LDFLAGS} ${GUILE_LDFLAGS} ${LIBDBI_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${HH_LDFLAGS}" \
             PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
 
         # Windows DLLs don't need relinking
@@ -1062,11 +1128,12 @@
     # Create a startup script that works without the msys shell
     qpushd $_INSTALL_UDIR/bin
         echo "setlocal" > gnucash.bat
-        echo "set PATH=${INSTALL_DIR}\\bin;${INSTALL_DIR}\\lib;${INSTALL_DIR}\\lib\\gnucash;${GOFFICE_DIR}\\bin;${LIBGSF_DIR}\\bin;${PCRE_DIR}\\bin;${GNOME_DIR}\\bin;${LIBXML2_DIR}\\bin;${GUILE_DIR}\\bin;${REGEX_DIR}\\bin;${AUTOTOOLS_DIR}\\bin;${AQBANKING_PATH};${LIBOFX_DIR}\\bin;${OPENSP_DIR}\\bin;${LIBGDA_DIR}\\bin;%PATH%" > gnucash.bat
+        echo "set PATH=${INSTALL_DIR}\\bin;${INSTALL_DIR}\\lib;${INSTALL_DIR}\\lib\\gnucash;${GOFFICE_DIR}\\bin;${LIBGSF_DIR}\\bin;${PCRE_DIR}\\bin;${GNOME_DIR}\\bin;${LIBXML2_DIR}\\bin;${GUILE_DIR}\\bin;${REGEX_DIR}\\bin;${AUTOTOOLS_DIR}\\bin;${AQBANKING_PATH};${LIBOFX_DIR}\\bin;${OPENSP_DIR}\\bin;${LIBDBI_DIR}\\bin;${SQLITE3_DIR}\\bin;%PATH%" > gnucash.bat
         echo "set GUILE_WARN_DEPRECATED=no" >> gnucash.bat
         echo "set GNC_MODULE_PATH=${INSTALL_DIR}\\lib\\gnucash" >> gnucash.bat
         echo "set GUILE_LOAD_PATH=${INSTALL_DIR}\\share\\gnucash\\guile-modules;${INSTALL_DIR}\\share\\gnucash\\scm;%GUILE_LOAD_PATH%" >> gnucash.bat
         echo "set LTDL_LIBRARY_PATH=${INSTALL_DIR}\\lib" >> gnucash.bat
+	echo "set GNC_DBD_DIR=${LIBDBI_DRIVERS_DIR}\\lib\\dbd" >> gnucash.bat
         echo "start gnucash-bin %*" >> gnucash.bat
     qpopd
 }

Added: gnucash/trunk/packaging/win32/libdbi-0.8.3.patch
===================================================================
--- gnucash/trunk/packaging/win32/libdbi-0.8.3.patch	                        (rev 0)
+++ gnucash/trunk/packaging/win32/libdbi-0.8.3.patch	2008-08-17 16:38:31 UTC (rev 17473)
@@ -0,0 +1,26 @@
+Index: dbd.h
+===================================================================
+RCS file: /cvsroot/libdbi/libdbi/include/dbi/dbd.h,v
+retrieving revision 1.29
+diff -u -r1.29 dbd.h
+--- include/dbi/dbd.h	15 Aug 2005 19:18:18 -0000	1.29
++++ include/dbi/dbd.h	16 Aug 2008 20:20:33 -0000
+@@ -52,7 +52,7 @@
+ size_t dbd_quote_binary(dbi_conn_t *conn, const unsigned char *orig, size_t from_length, unsigned char **ptr_dest);
+ size_t dbd_conn_quote_string(dbi_conn_t *conn, const char *orig, char *dest);
+ const char *dbd_select_db(dbi_conn_t *conn, const char *db);
+-int dbd_geterror(dbi_conn_t *conn, int *errno, char **errstr);
++int dbd_geterror(dbi_conn_t *conn, int *err_no, char **errstr);
+ unsigned long long dbd_get_seq_last(dbi_conn_t *conn, const char *sequence);
+ unsigned long long dbd_get_seq_next(dbi_conn_t *conn, const char *sequence);
+ int dbd_ping(dbi_conn_t *conn);
+@@ -63,7 +63,7 @@
+ void _dbd_result_add_field(dbi_result_t *result, unsigned int fieldidx, char *name, unsigned short type, unsigned int attribs);
+ dbi_row_t *_dbd_row_allocate(unsigned int numfields);
+ void _dbd_row_finalize(dbi_result_t *result, dbi_row_t *row, unsigned long long rowidx);
+-void _dbd_internal_error_handler(dbi_conn_t *conn, const char *errmsg, const int errno);
++void _dbd_internal_error_handler(dbi_conn_t *conn, const char *errmsg, const int err_no);
+ dbi_result_t *_dbd_result_create_from_stringarray(dbi_conn_t *conn, unsigned long long numrows_matched, const char **stringarray);
+ void _dbd_register_driver_cap(dbi_driver_t *driver, const char *capname, int value);
+ void _dbd_register_conn_cap(dbi_conn_t *conn, const char *capname, int value);
+


Property changes on: gnucash/trunk/packaging/win32/libdbi-0.8.3.patch
___________________________________________________________________
Name: svn:executable
   + *

Added: gnucash/trunk/packaging/win32/libdbi-drivers-Makefile.in.patch
===================================================================
--- gnucash/trunk/packaging/win32/libdbi-drivers-Makefile.in.patch	                        (rev 0)
+++ gnucash/trunk/packaging/win32/libdbi-drivers-Makefile.in.patch	2008-08-17 16:38:31 UTC (rev 17473)
@@ -0,0 +1,11 @@
+--- drivers/sqlite3/Makefile.in.save	Mon Mar  3 12:41:56 2008
++++ drivers/sqlite3/Makefile.in	Sat Aug 16 17:10:11 2008
+@@ -264,7 +264,7 @@
+ @HAVE_SQLITE3_TRUE at sqlite3_sources = dbd_sqlite3.c
+ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/include @DBI_INCLUDE@ @SQLITE3_INCLUDE@
+ lib_LTLIBRARIES = $(sqlite3_ltlibs)
+-libdbdsqlite3_la_LDFLAGS = $(sqlite3_ldflags) @SQLITE3_LDFLAGS@ @SQLITE3_LIBS@ @LIBADD_LIBDBI@
++libdbdsqlite3_la_LDFLAGS = $(sqlite3_ldflags) @SQLITE3_LDFLAGS@ @SQLITE3_LIBS@ @LIBADD_LIBDBI@ -no-undefined
+ libdbdsqlite3_la_SOURCES = $(sqlite3_sources)
+ libdbdsqlite3_la_DEPENDENCIES = dbd_sqlite3.h
+ EXTRA_DIST = dbd_sqlite3.c dbd_sqlite3.h AUTHORS TODO README dbd_sqlite3.sgml dbd_sqlite3.pdf dbd_sqlite3/*


Property changes on: gnucash/trunk/packaging/win32/libdbi-drivers-Makefile.in.patch
___________________________________________________________________
Name: svn:executable
   + *

Added: gnucash/trunk/packaging/win32/libdbi-drivers-dbd_sqlite3.c.patch
===================================================================
--- gnucash/trunk/packaging/win32/libdbi-drivers-dbd_sqlite3.c.patch	                        (rev 0)
+++ gnucash/trunk/packaging/win32/libdbi-drivers-dbd_sqlite3.c.patch	2008-08-17 16:38:31 UTC (rev 17473)
@@ -0,0 +1,24 @@
+Index: dbd_sqlite3.c
+===================================================================
+RCS file: /cvsroot/libdbi-drivers/libdbi-drivers/drivers/sqlite3/dbd_sqlite3.c,v
+retrieving revision 1.31
+diff -u -r1.31 dbd_sqlite3.c
+--- drivers/sqlite3/dbd_sqlite3.c	13 Aug 2008 22:56:03 -0000	1.31
++++ drivers/sqlite3/dbd_sqlite3.c	16 Aug 2008 20:23:23 -0000
+@@ -1369,11 +1369,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 = sqlite3_errcode((sqlite3 *)conn->connection);
++  *err_no = sqlite3_errcode((sqlite3 *)conn->connection);
+   *errstr = strdup((char*)sqlite3_errmsg((sqlite3 *)conn->connection));
+   return 3;
+ }
+


Property changes on: gnucash/trunk/packaging/win32/libdbi-drivers-dbd_sqlite3.c.patch
___________________________________________________________________
Name: svn:executable
   + *



More information about the gnucash-changes mailing list