gnucash-on-windows master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Jul 23 20:38:15 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash-on-windows/commit/70f88708 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/7f03c23a (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/1aef8740 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/955753fc (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/49eaaddb (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/de6a0669 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/bfd98fa8 (commit)
	 via  https://github.com/Gnucash/gnucash-on-windows/commit/74c4dbce (commit)
	from  https://github.com/Gnucash/gnucash-on-windows/commit/e21e9e3e (commit)



commit 70f887083e7eba4a26c2859b5609b222abe45568
Merge: e21e9e3 7f03c23
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 23 17:37:51 2017 -0700

    Merge branch 'mingw64'


commit 7f03c23aba4dbe31ca179eee489f9d923220f4dd
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 23 15:56:54 2017 -0700

    Parameterize jhbuildrc.in to create jhbuildrc with _basedir and _downloaddir set.

diff --git a/jhbuildrc.in b/jhbuildrc.in
index 3ac25aa..316e496 100644
--- a/jhbuildrc.in
+++ b/jhbuildrc.in
@@ -30,13 +30,15 @@ def add_to_path_var(var, path):
     else:
         os.environ[var] = os.environ[var] + ":" + path
 
-_config_dir = os.path.join('/c', 'gcdev64', 'src', 'gnucash-on-windows.git')
-_basedir = os.path.join('/c', 'gcdev64')
+_basedir = "@-BASE_DIR-@"
+_downloaddir = "@-DOWNLOAD_DIR-@"
+_config_dir = os.path.join(_basedir, 'src', 'gnucash-on-windows.git')
 prefix = os.path.join(_basedir, 'inst')
 checkoutroot = os.path.join(_basedir, 'src')
 buildroot = os.path.join(_basedir, 'build')
-tarballdir = os.path.join('/c', 'gcdev', 'downloads')
+tarballdir = os.path.join(_download_dir)
 moduleset = os.path.join(_config_dir, 'gnucash.modules')
+modules = ["meta-gnucash"]
 
 _mingw_includes = os.path.join(_basedir, 'msys2', 'mingw32', 'include')
 _mingw_libs = os.path.join(_basedir, 'msys2', 'mingw32', 'lib')
diff --git a/setup-mingw64.ps1 b/setup-mingw64.ps1
index a8fbcff..984d888 100644
--- a/setup-mingw64.ps1
+++ b/setup-mingw64.ps1
@@ -252,3 +252,12 @@ if (!(test-path -path "$target_dir\\src\\gnucash-on-windows.git")) {
   $proc = bash-command -command "git clone -b mingw64 https://github.com/gnucash/gnucash-on-windows.git $target_dir/src/gnucash-on-windows.git"
   $proc.waitForExit()
 }
+
+cat $target_dir\\src\\gnucash-on-windows.git\\jhbuildrc.in |
+ %{$_ -replace "@-BASE_DIR-@", "$target_dir"} |
+ %{$_ -replace "@-DOWNLOAD_DIR-@", "$download_dir"} > $target_dir\\src\\gnucash-on-windows.git\\jhbuildrc
+
+Write-Host @"
+Your build environment is now ready to use. Open an MSys2 shell from the start menu, cd to your target directory, and run
+jhbuild -f gnucash-on-windows.git/jhbuildrc build
+"@

commit 1aef8740c7aafe3246b74a8c9af00b5652882fa7
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 23 15:27:19 2017 -0700

    A few more dependencies...

diff --git a/setup-mingw64.ps1 b/setup-mingw64.ps1
index 0b33374..a8fbcff 100644
--- a/setup-mingw64.ps1
+++ b/setup-mingw64.ps1
@@ -198,14 +198,14 @@ $proc.WaitForExit()
 
 # Set up aliases for the parts of msys-devtools and mingw-w64-toolchain that
 # we need:
-$devel = "asciidoc autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.6 automake1.7 automake1.8 automake1.9 bison diffstat diffutils dos2unix file flex gawk gettext gettext-devel gperf grep groff intltool libtool m4 make man-db pacman pactoys-git patch patchutils perl pkg-config sed swig texinfo texinfo-tex wget xmlto git jhbuild-git"
+$devel = "asciidoc autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.6 automake1.7 automake1.8 automake1.9 bison diffstat diffutils dos2unix file flex gawk gettext gettext-devel gperf grep groff intltool libtool m4 make man-db pacman pactoys-git patch patchutils perl pkg-config sed swig texinfo texinfo-tex wget xmlto git jhbuild-git texinfo"
 
 $toolchain = "binutils crt-git gcc gcc-libs gdb headers-git libmangle-git libwinpthread-git make pkg-config tools-git winpthreads-git"
 
 
 # Note that webkitgtk3 will pull in gtk3 automatically; we need gtk2 as well to
 # support AQBanking.
-$deps = "webkitgtk3 gtk2 boost iso-codes shared-mime-info libmariadbclient postgresql libgnomecanvas ninja"
+$deps = "webkitgtk3 gtk2 boost iso-codes shared-mime-info libmariadbclient postgresql libgnomecanvas ninja ncurses"
 
 Write-Host @"
 

commit 955753fc96a51ce192fbe3233208ebfdbddcae93
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 23 15:26:13 2017 -0700

    Add patches necessary for building on mingw64.

diff --git a/gnucash.modules b/gnucash.modules
index 7c6b005..368210f 100644
--- a/gnucash.modules
+++ b/gnucash.modules
@@ -91,13 +91,14 @@
   </autotools>
 
   <autotools id="libatomic-ops"
-             autogen-template="/bin/bash -c 'pushd %(srcdir)s && ./%(autogen-sh)s && popd && %(srcdir)s/configure --prefix=%(prefix)s> %(autogenargs)s'">
+             autogen-template="/bin/bash -c 'pushd %(srcdir)s && ./%(autogen-sh)s && popd && %(srcdir)s/configure --prefix=%(prefix)s> %(autogenargs)s'"
+	     autogenargs="--enable-shared --disable-static">
     <branch repo="github" module="ivmai/libatomic_ops"
 	    revision="libatomic_ops-7_4_4"/>
   </autotools>
 
   <autotools id="bdw-gc" autogen-template="/bin/bash -c 'pushd %(srcdir)s && ./autogen.sh && automake -ac && popd && %(srcdir)s/configure --prefix %(prefix)s  %(autogenargs)s'"
-	     autogenargs="--enable-threads=pthreads">
+	     autogenargs="--enable-threads=pthreads --enable-shared --disable-static">
     <branch repo="github" module="ivmai/bdwgc"  revision="gc7_6_0" />
     <dependencies>
       <dep package="libatomic-ops"/>
@@ -114,10 +115,10 @@
   </autotools>
 
   <!-- Unfortunately in addition to needing a few patches this hangs when it tries to compile Scheme. -->
-  <autotools id="guile2" autogen-sh="autoreconf">
-    <branch repo="ftp.gnu.org" module="guile/guile-2.0.12.tar.gz"
-	    version="2.0.12">
-      <patch file="https://git.gnome.org/browse/gtk-osx/plain/patches/guile-clocktime.patch" strip="1"/>
+  <autotools id="guile2" autogen-sh="autoreconf" autogenargs="--without-threads">
+    <branch repo="ftp.gnu.org" module="guile/guile-2.0.14.tar.gz"
+	    version="2.0.14">
+      <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/patches/guile-2.0.14-mingw64-fixup.patch" strip="1"/>
     </branch>
     <dependencies>
       <dep package="libunistring"/>
@@ -209,7 +210,8 @@
 	     autogen-template='/bin/bash -c "pushd %(srcdir)s && ./autoinit.sh && popd && %(srcdir)s/configure --prefix %(prefix)s  %(autogenargs)s"'>
     <branch repo="sourceforge" module="openjade/OpenSP-1.5.2.tar.gz"
 	    version='1.5.2'>
-      <patch file="/c/gcdev/gnucash-on-windows.git/opensp-1.5.2.patch" strip='1'/>
+      <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/opensp-1.5.2.patch" strip='1'/>
+      <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/patches/OpenSP-1.5.2-non-posix-functions.patch" strip='1'/>
     </branch>
   </autotools>
 
@@ -254,17 +256,17 @@
 
   <autotools id="libdbi-drivers" autogen-sh='autoreconf'
 	     autogenargs='--disable-docs --with-sqlite3 --with-sqlite3-dir="/mingw32" --with-pgsql --with-pgsql-dir="/mingw32" --with-mysql --with-mysql-dir="/mingw32" '>
-    <branch repo="sourceforge" version="0.8.3-1"
+    <branch repo="sourceforge" version="0.8.3"
 	    module="libdbi-drivers/libdbi-drivers-0.8.3-1.tar.gz">
       <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/libdbi-drivers-errno.patch" strip="1"/>
+      <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/libdbi-drivers-linkage.patch" strip="1"/>
     </branch>
     <dependencies>
       <dep package="libdbi"/>
     </dependencies>
   </autotools>
 
-  <cmake id="googletest" cmakeargs="-DBUILD_GMOCK=OFF" skip-autogen="yes"
-	 skip-install="yes">
+  <cmake id="googletest" cmakeargs="-G 'MSYS Makefiles' -DBUILD_GMOCK=OFF">
     <branch module="google/googletest" repo="github" tag="release-1.8.0"/>
   </cmake>
 
@@ -272,7 +274,7 @@
 	      autogen-template="%(srcdir)s/%(autogen-sh)s && %(srcdir)s/configure -\-prefix %(prefix)s %(autogenargs)s"
 	      autogenargs="-\-enable-ofx -\-enable-aqbanking -\-enable-binreloc -\-enable-dbi -\-with-dbi-dbd-dir=$PREFIX/lib/dbd"-->
  <cmake id="gnucash"
-        cmakeargs="-G 'MSYS Makefiles' -DCMAKE_INSTALL_LIBDIR=lib  -DCMAKE_PREFIX_PATH=c:/gcdev64/msys2 -DPERL_EXECUTABLE=/usr/bin/perl -DGNC_DBD_DIR=$PREFIX/lib/dbd -DHTMLHELP_DIR=$PREFIX/hh -DGTEST_ROOT=$SRCROOT/googletest/googletest -DGMOCK_ROOT=$SRCROOT/googletest/googlemock">
+        cmakeargs="-G 'MSYS Makefiles' -DCMAKE_PREFIX_PATH=c:/gcdev64/msys2 -DPERL_EXECUTABLE=/usr/bin/perl -DGNC_DBD_DIR=$PREFIX/lib/dbd -DHTMLHELP_DIR=$PREFIX/hh -DGTEST_ROOT=$SRCROOT/googletest/googletest -DGMOCK_ROOT=$SRCROOT/googletest/googlemock">
    <branch repo="github" module="Gnucash/gnucash.git" revision="master"
 	   checkoutdir="gnucash-git"/>
     <dependencies>
@@ -281,7 +283,7 @@
       <dep package="libdbi-drivers"/>
       <!--dep package="shared-mime-info"/-->
       <!--dep package="iso-codes"/-->
-      <dep package="guile"/>
+      <dep package="guile2"/>
       <!--dep package="swig"/-->
       <dep package="boost"/>
       <dep package="googletest"/>
diff --git a/jhbuildrc b/jhbuildrc.in
similarity index 100%
rename from jhbuildrc
rename to jhbuildrc.in
diff --git a/patches/OpenSP-1.5.2-non-posix-functions.patch b/patches/OpenSP-1.5.2-non-posix-functions.patch
new file mode 100644
index 0000000..2d73dcb
--- /dev/null
+++ b/patches/OpenSP-1.5.2-non-posix-functions.patch
@@ -0,0 +1,33 @@
+diff --git a/sx/XmlOutputEventHandler.cxx~ b/sx/XmlOutputEventHandler.cxx
+index 387af89..d03fe5b 100644
+--- a/sx/XmlOutputEventHandler.cxx~
++++ b/sx/XmlOutputEventHandler.cxx
+@@ -1202,7 +1202,9 @@ void XmlOutputEventHandler::inputOpened(InputSource *in)
+           char realDirs[MAXPATHLEN];
+           char realOutputDir[MAXPATHLEN];
+           char *outputDir = strdup(outputDir_);
+-
++#ifdef __MINGW32__
++#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
++#endif
+           realpath((const char *)dirname(dirs), realDirs);
+           realpath((const char *)dirname(outputDir), realOutputDir);
+ 
+@@ -1469,7 +1471,7 @@ int XmlOutputEventHandler::maybeCreateDirectories (char *path)
+     *pp = '/';
+   }
+ 
+-#ifndef _MSC_VER
++#if ! defined (_MSC_VER) && ! defined (__MINGW32__)
+   struct stat statbuf;
+   pp = strrchr(path, '/');
+ 
+@@ -1483,6 +1485,8 @@ int XmlOutputEventHandler::maybeCreateDirectories (char *path)
+   }
+ 
+   ret = mkdir(path, statbuf.st_mode);
++#elif  defined (__MINGW32__)
++  ret = mkdir(path);
+ #else
+   ret=_mkdir(path);
+ #endif
diff --git a/patches/guile-2.0.14-mingw64-fixups.patch b/patches/guile-2.0.14-mingw64-fixups.patch
new file mode 100644
index 0000000..a0fb3a4
--- /dev/null
+++ b/patches/guile-2.0.14-mingw64-fixups.patch
@@ -0,0 +1,167 @@
+From aeebdcf73377d1682b508828db5de55cffe1870f Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls at ceridwen.us>
+Date: Sun, 23 Jul 2017 14:05:48 -0700
+Subject: [PATCH 2/3] guile-2.0.14 mingw64 fixups.
+
+---
+ libguile/deprecated.h   |  2 ++
+ libguile/iselect.h      |  4 ++--
+ libguile/load.c         | 39 +++++++++++++++++++++++++++++++++++----
+ libguile/null-threads.h |  3 ++-
+ libguile/posix-w32.h    |  1 +
+ libguile/stime.c        |  2 +-
+ 6 files changed, 43 insertions(+), 8 deletions(-)
+
+diff --git a/libguile/deprecated.h b/libguile/deprecated.h
+index 4d7819761..2d6f71c7d 100644
+--- a/libguile/deprecated.h
++++ b/libguile/deprecated.h
+@@ -742,11 +742,13 @@ SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
+ 
+ SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
+ SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
++#if HAVE_PTHREAD_SIGMASK
+ SCM_DEPRECATED int scm_internal_select (int fds,
+                                         fd_set *rfds,
+                                         fd_set *wfds,
+                                         fd_set *efds,
+                                         struct timeval *timeout);
++#endif
+ 
+ /* Deprecated because the cuserid call is deprecated.
+  */
+diff --git a/libguile/iselect.h b/libguile/iselect.h
+index 1272b8d27..c99ae8e85 100644
+--- a/libguile/iselect.h
++++ b/libguile/iselect.h
+@@ -27,7 +27,7 @@
+ 
+ /* Needed for FD_SET on some systems.  */
+ #include <sys/types.h>
+-
++#if HAVE_PTHREAD_SIGMASK
+ #include <sys/select.h>
+ 
+ SCM_API int scm_std_select (int fds,
+@@ -37,7 +37,7 @@ SCM_API int scm_std_select (int fds,
+ 			    struct timeval *timeout);
+ 
+ #define SELECT_TYPE fd_set
+-
++#endif
+ #endif  /* SCM_ISELECT_H */
+ 
+ /*
+diff --git a/libguile/load.c b/libguile/load.c
+index c2ee5093a..de9efeb7f 100644
+--- a/libguile/load.c
++++ b/libguile/load.c
+@@ -535,6 +535,19 @@ is_absolute_file_name (SCM filename)
+ #endif
+       )
+     return 1;
++#ifdef __MINGW32__
++  /* MSys passes paths around with e.g. C: replaced with /c. Guile finds
++     that indigestible, so check for it and if it's the case rewrite
++     it. */
++  if (filename_len >=3
++      && is_file_name_separator (scm_c_string_ref (filename, 0))
++      && is_drive_letter (scm_c_string_ref (filename, 1))
++      && is_file_name_separator (scm_c_string_ref (filename, 2)))
++    {
++      scm_c_string_set_x (filename, 0, scm_c_string_ref(filename, 1));
++      scm_c_string_set_x (filename, 1, SCM_MAKE_CHAR (':'));
++    }
++#endif
+   if (filename_len >= 3
+       && is_drive_letter (scm_c_string_ref (filename, 0))
+       && scm_is_eq (scm_c_string_ref (filename, 1), SCM_MAKE_CHAR (':'))
+@@ -723,9 +736,18 @@ load_thunk_from_path (SCM filename, SCM source_file_name,
+ 
+       buf.ptr = buf.buf;
+       stringbuf_cat_locale_string (&buf, dir);
+-	
++#ifdef __MINGW32__
++      /* Fiddle the drive letter if necessary */
++      if (is_file_name_separator (SCM_MAKE_CHAR (buf.buf[0]))
++	  && is_drive_letter (SCM_MAKE_CHAR (buf.buf[1]))
++	  && is_file_name_separator (SCM_MAKE_CHAR (buf.buf[2])))
++	{
++	  buf.buf[0] = buf.buf[1];
++	  buf.buf[1] = ':';
++	}
++#endif
+       /* Concatenate the path name and the filename. */
+-      
++
+       if (buf.ptr > buf.buf
+           && !is_file_name_separator (SCM_MAKE_CHAR (buf.ptr[-1])))
+ 	stringbuf_cat (&buf, FILE_NAME_SEPARATOR_STRING);
+@@ -877,9 +899,18 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts,
+ 
+       buf.ptr = buf.buf;
+       stringbuf_cat_locale_string (&buf, dir);
+-	
++#ifdef __MINGW32__
++      /* Fiddle the drive letter if necessary */
++      if (is_file_name_separator (SCM_MAKE_CHAR (buf.buf[0]))
++	  && is_drive_letter (SCM_MAKE_CHAR (buf.buf[1]))
++	  && is_file_name_separator (SCM_MAKE_CHAR (buf.buf[2])))
++	{
++	  buf.buf[0] = buf.buf[1];
++	  buf.buf[1] = ':';
++	}
++#endif
+       /* Concatenate the path name and the filename. */
+-      
++
+       if (buf.ptr > buf.buf
+           && !is_file_name_separator (SCM_MAKE_CHAR (buf.ptr[-1])))
+ 	stringbuf_cat (&buf, FILE_NAME_SEPARATOR_STRING);
+diff --git a/libguile/null-threads.h b/libguile/null-threads.h
+index dcb14e6a7..cfe06bbb5 100644
+--- a/libguile/null-threads.h
++++ b/libguile/null-threads.h
+@@ -82,12 +82,13 @@ scm_i_sched_yield (void)
+ 
+ /* Signals
+  */
++#if HAVE_PTHREAD_SIGMASK
+ static inline int
+ scm_i_pthread_sigmask (int how, const sigset_t *set, sigset_t *oldset)
+ {
+   return sigprocmask (how, set, oldset);
+ }
+-
++#endif
+ /* Mutexes
+  */
+ typedef enum {
+diff --git a/libguile/posix-w32.h b/libguile/posix-w32.h
+index f11a25e49..6040e05c8 100644
+--- a/libguile/posix-w32.h
++++ b/libguile/posix-w32.h
+@@ -21,6 +21,7 @@
+  * 02110-1301 USA
+  */
+ 
++#include <windows.h>
+ #include <string.h>
+ 
+ #define _UTSNAME_LENGTH 65
+diff --git a/libguile/stime.c b/libguile/stime.c
+index 7a139747f..7e4b7dfe3 100644
+--- a/libguile/stime.c
++++ b/libguile/stime.c
+@@ -122,7 +122,7 @@ get_internal_real_time_posix_timer (void)
+      ts.tv_nsec - posix_real_time_base.tv_nsec);
+ }
+ 
+-#if defined _POSIX_CPUTIME && defined CLOCK_PROCESS_CPUTIME_ID
++#if defined _POSIX_CPUTIME && defined CLOCK_PROCESS_CPUTIME_ID && !defined(WINPTHREAD_API)
+ /* You see, FreeBSD defines _POSIX_CPUTIME but not
+    CLOCK_PROCESS_CPUTIME_ID.  */
+ #define HAVE_POSIX_CPUTIME 1
+-- 
+2.12.1
+
diff --git a/patches/libdbi-0.9.0-mingw64.patch b/patches/libdbi-0.9.0-mingw64.patch
new file mode 100644
index 0000000..79a3239
--- /dev/null
+++ b/patches/libdbi-0.9.0-mingw64.patch
@@ -0,0 +1,64 @@
+diff --git a/src/dbd_helper.c~ b/src/dbd_helper.c
+index e783847..156fc34 100644
+--- a/src/dbd_helper.c~
++++ b/src/dbd_helper.c
+@@ -24,6 +24,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef __MINGW32__
++#define _POSIX_
++#endif
++
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <stddef.h>
+diff --git a/src/dbi_main.c~ b/src/dbi_main.c
+index 07b959b..348d114 100644
+--- a/src/dbi_main.c~
++++ b/src/dbi_main.c
+@@ -199,11 +199,18 @@ int dbi_initialize_r(const char *driverdir, dbi_inst *pInst) {
+ 
+ 		status = 0;
+ 		while (42) { /* yes, we all admire Douglas Adams */
++#ifdef HAVE_READDIR_R
+ 			driver_dirent = NULL;
+ 			status = readdir_r (dir, buffer, &driver_dirent);
+ 			if (status != 0 || driver_dirent == NULL) {
+ 			  break;
+ 			}
++#else
++			driver_dirent = readdir (dir);
++			if (driver_dirent == NULL)
++			  break;
++			memcpy (buffer, driver_dirent, buffer_size);
++#endif
+ 
+ 			driver = NULL;
+ 			snprintf(fullpath, FILENAME_MAX, "%s%s%s", effective_driverdir, DBI_PATH_SEPARATOR, driver_dirent->d_name);
+diff --git a/src/timegm.c~ b/src/timegm.c
+index a7d1bc0..f13f788 100644
+--- a/src/timegm.c~
++++ b/src/timegm.c
+@@ -25,6 +25,7 @@
+ #endif
+ 
+ #include <time.h>
++#include <string.h>
+ 
+ #ifndef HAVE_TIMEGM
+ 
+@@ -39,7 +40,13 @@ time_t timegm(struct tm *tm) {
+     temp_ltime = mktime(tm);
+   }
+ 
++#ifdef HAVE_GMTIME_R
+   gmtime_r(&temp_ltime, &temp_gm);
++#else
++  /* We're done with tm, might as well reuse it... */
++  tm = gmtime(&temp_ltime);
++  memcpy (&temp_gm, tm, sizeof(struct tm));
++#endif
+ 
+   return (time_t)(temp_ltime + (temp_ltime - mktime(&temp_gm)));
+ }
diff --git a/patches/libdbi-drivers-linkage.patch b/patches/libdbi-drivers-linkage.patch
new file mode 100644
index 0000000..8ae5f4b
--- /dev/null
+++ b/patches/libdbi-drivers-linkage.patch
@@ -0,0 +1,13 @@
+diff --git a/configure.in~ b/configure.in
+index 16bbf49..fa56dfe 100644
+--- a/configure.in~
++++ b/configure.in
+@@ -184,7 +184,7 @@ if test "$ac_libdbi" = "YES"; then
+    fi
+ 
+    AC_MSG_RESULT([yes: libs in $ac_dbi_libdir])
+-   LIBADD_LIBDBI="$LIBADD_LIBDBI -L$ac_dbi_libdir"
++   LIBADD_LIBDBI="-no-undefined $LIBADD_LIBDBI -L$ac_dbi_libdir"
+ 	
+    AC_SUBST(LIBADD_LIBDBI)
+ 

commit 49eaaddb59585f50ab942dfecf01a6d8ce3c7805
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jul 20 09:28:15 2017 -0700

    Rewrite setup-mingw64.ps1 to completely and correctly prepare the environment.

diff --git a/setup-mingw64.ps1 b/setup-mingw64.ps1
index 4ffbe32..0b33374 100644
--- a/setup-mingw64.ps1
+++ b/setup-mingw64.ps1
@@ -1,65 +1,189 @@
+# setup-mingw64.ps1: Powershell Script to create a MinGW64 Build Environment.
+# Copyright 2017 John Ralls <jralls at ceridwen.us>
+#
+# 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 at gnu.org
 
-Param([string]$target_dir = "c:\\gcdev64")
+<#
+.SYNOPSIS
+
+Prepares a MinGW-w64 development environment from scratch.
+
+.DESCRIPTION
+
+Prepares a development environment for building GnuCash with jhbuild
+in a MinGW-w64 (a.k.a. MSys2) environment. All required packages are
+installed and the gnucash-on-windows repository containing the other
+needed scripts is cloned into the target.
+
+You may need to allow running scripts on your computer and depending
+on where the target_dir is you may need to run the script with
+Administrator priviledges.
+
+.PARAMETER target_dir
+
+Optional. The path at which you wish to create the environment. If
+none is provided the environment will be created at C:\gcdev64.
+
+.PARAMETER download_dir
+
+Optional. A path to which to download installers. Defaults to
+target_dir\downloads.
+
+.PARAMETER x86_64
+
+Optional. A switch value.If true the toolchain will build x86_64
+binaries; if false it will build i686 binaries. Defaults to false.
+
+#>
+
+[CmdletBinding()]
+Param(
+	[Parameter()] [string]$target_dir = "c:\\gcdev64",
+	[Parameter()] [string]$download_dir = "$target_dir\\downloads",
+	[Parameter()] [switch]$x86_64
+)
 
 $progressPreference = 'silentlyContinue'
-$installer32 = "http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe"
-$archive32 = "http://repo.msys2.org/distrib/i686/msys2-base-i686-20161025.tar.xz"
-$installer64 = "http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe"
-$archive64 = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20161025.tar.xz"
+if ($x86_64) {
+    $mingw_prefix = "mingw64/mingw-w64-x86_64-"
+    $mingw_path = "/mingw64/x86_64-w64-mingw64"
+    $mingw_bin = "/mingw64/bin"
+}
+else {
+    $mingw_prefix = "mingw32/mingw-w64-i686-"
+    $mingw_path = "/mingw32/i686-w64-mingw32"
+    $mingw_bin = "/mingw32/bin"
+}
+
+if (!(test-path -path $target_dir)) {
+    new-item "$target_dir" -type directory
+}
+
+function make-pkgnames ([string]$prefix, [string]$items) {
+    $items.split(" ") | foreach-object {"$prefix$_"}
+}
+
+function Install-Package([string]$url, [string]$download_file,
+	  [string]$install_dir, [string]$setup_cmd, [string]$setup_args)
+{
+    if (!(test-path -path $download_file)) {
+	write-host "Downloading $download_file from $url"
+	invoke-webrequest -uri $url -outfile $download_file
+    }
+
+    write-host "Installing $download_dir\$setup_cmd $setup_args"
+    $psi = new-object "Diagnostics.ProcessStartInfo"
+    $psi.Filename = "$download_dir\$setup_cmd"
+    $psi.Arguments = "$setup_args"
+    $proc = [Diagnostics.Process]::Start($psi)
+    $proc.waitForExit()
+}
+
+
+function bash-command() {
+    param ([string]$command = "")
+    if (!(test-path -path $target_dir\msys2\usr\bin\bash.exe)) {
+	write-host "Shell program not found, aborting."
+	return
+    }
+#   write-host "Running bash command ""$command"""
+   $psi = new-object "Diagnostics.ProcessStartInfo"
+   $psi.Filename = "$target_dir\msys2\usr\bin\bash.exe"
+   $psi.Arguments =  "-c ""export PATH=/usr/bin; $command"""
+   [Diagnostics.Process]::Start($psi)
+}
+
+function make-unixpath([string]$path) {
+    $path -replace  "^([A-Z]):", '/$1' -replace "\\", '/'
+}
+
+# Install MSYS2 for the current machine's architechture.
 
-$download_dir = "c:\\gcdev\\downloads"
-$installer_file = "$download_dir\\msys2.exe"
-$archive_file = "$download_dir\\msys2-base.tar.xz"
-$installer = If ([IntPtr]::size -eq 4) {$installer32} Else {$installer64}
+if (!(test-path -path $target_dir\msys2\usr\bin\bash.exe)) {
+    $mingw64_installer32 = "http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe"
+    $mingw64_installer64 = "http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe"
 
-$mingw_setup = @"
+    $mingw64_installer_file = "$download_dir\msys2.exe"
+    $mingw64_installer = If ([IntPtr]::size -eq 4) {$mingw64_installer32} Else {$mingw64_installer64}
+    $msys_install_dir = (join-path $target_dir "msys2") -replace "\\", '/'
+    $msys_setup_args = @"
 function Controller() {}
 Controller.prototype.IntroductionPageCallback = function() {
     gui.clickButton(buttons.NextButton);
 }
 Controller.prototype.TargetDirectoryPageCallback = function() {
     var page = gui.pageWidgetByObjectName("TargetDirectoryPage");
-    page.TargetDirectoryLineEdit.setText("$target_dir\\msys2");
+    page.TargetDirectoryLineEdit.setText("$msys_install_dir");
     gui.clickButton(buttons.NextButton);
 }
 Controller.prototype.StartMenuDirectoryPageCallback = function() {
     gui.clickButton(buttons.NextButton);
 }
 Controller.prototype.FinishedPageCallback = function() {
-   var page = gui.pageWidgetByObjectName("FinishedPage");
-   page.RunItCheckBox.checked = false;
-   gui.clickButton(buttons.FinishButton);
+    var page = gui.pageWidgetByObjectName("FinishedPage");
+    page.RunItCheckBox.checked = false;
+    gui.clickButton(buttons.FinishButton);
 }
 "@
 
-if (!(test-path -path $installer_file)) {
-   Write-Host "Downloading $installer_file from $installer"
-   Invoke-WebRequest -URI $installer -OutFile $installer_file
+    $setup_script = "$target_dir\input.qs"
+    set-content -path $setup_script -value $msys_setup_args | out-null
+    install-package -url $mingw64_installer -download_file $mingw64_installer_file -install_dir "$target_dir/msys2" -setup_cmd "msys2.exe" -setup_args "--script $setup_script"
+#    remove-item $setup_script
 }
-if (!(test-path -path $target_dir)) {
-   New-Item $target_dir -type directory
+if (!(test-path -path $target_dir\msys2\usr\bin\bash.exe)) {
+    write-host "Failed to install MSys2, aborting."
+    exit
 }
 
-Set-Content -Path $target_dir\mingw64-setup.qs -Value $mingw_setup | Out-Null
-Set-Location -Path $target_dir
+# Install Html Help Workshop
 
-function bash-command() {
-   param ([string]$command = "")
-   $psi = new-object "Diagnostics.ProcessStartInfo"
-   $psi.Filename = "$target_dir\msys2\usr\bin\bash.exe"
-   $psi.Arguments =  "-c ""export PATH=/usr/bin; $command"""
-   return [Diagnostics.Process]::Start($psi)
+$html_help_workshop_url =  "http://download.microsoft.com/download/0/a/9/0a939ef6-e31c-430f-a3df-dfae7960d564/htmlhelp.exe"
+$html_help_workshop_installer = "htmlhelp.exe"
+
+$installed_hh = get-item -path "hkcu:\SOFTWARE\Microsoft\HTML Help Workshop" | foreach-object{$_.GetValue("InstallDir")}
+
+if (! (($installed_hh) -and (test-path -path $installed_hh))) {
+  install-package -url $html_help_workshop_url -download_file "$download_dir\\$html_help_workshop_installer" -install_dir ${env:ProgramFiles(x86)} -setup_cmd $html_help_installer
+}
+$hhctrl_ocx = "c:\Windows\System32\hhctrl.ocx"
+if (!(test-path -path $hhctrl_ocx)) {
+    write-host "Something's wrong with HTML Help Workshop, couldn't find $hhctrl_ocx."
+    exit
+}
+$hhctrl_ocx = make-unixpath -path $hhctrl_ocx
+
+
+# Install Inno Setup
+if (!(test-path -path ${env:ProgramFiles(x86)}\inno)) {
+    $inno_setup_url = "http://files.jrsoftware.org/is/5/innosetup-5.5.9-unicode.exe"
+    $inno_setup_installer = "innosetup-5.5.9-unicode.exe"
+    $inno_setup_args = " /verysilent /suppressmsgboxes /nocancel /norestart /dir=""${env:ProgramFiles(x86)}\inno"""
+   install-package -url $inno_setup_url -download_file "$download_dir\$inno_setup_installer" -install_dir ${env:ProgramFiles(x86)} -setup_cmd $inno_setup_installer -setup_args $inno_setup_args
 }
 
 #if MSys2 isn't already installed, install it.
 if (!(test-path -path $target_dir\msys2\usr\bin\bash.exe)) {
-   & $installer_file --script $target_dir\mingw64-setup.qs | Out-Null
    Write-Host @"
 Updating the new installation. A bash window will open. In that window accept the proposed installation and close the window when the update completes.
 
 There will be a second update.
 "@
-   $proc = bash-command("pacman -Syuu")
+   $proc = bash-command -command "pacman -Syuu"
    $proc.WaitForExit()
 }
 
@@ -69,25 +193,51 @@ Write-Host @"
 Updating the installation. Accept the proposed changes. If the window doesn't close on its own then close it and re-run the script when it finishes.
 "@
 
-$proc = bash-command("pacman -Syuu")
+$proc = bash-command -command "pacman -Syuu"
 $proc.WaitForExit()
 
 # Set up aliases for the parts of msys-devtools and mingw-w64-toolchain that
 # we need:
-$msys_devel = "msys/asciidoc msys/autoconf msys/autoconf2.13 msys/autogen msys/automake-wrapper msys/automake1.10 msys/automake1.11 msys/automake1.12 msys/automake1.13 msys/automake1.14 msys/automake1.15 msys/automake1.6 msys/automake1.7 msys/automake1.8 msys/automake1.9 msys/bison msys/diffstat msys/diffutils msys/dos2unix msys/file msys/flex msys/gawk msys/gdb msys/gettext msys/gettext-devel msys/gperf msys/grep msys/groff msys/intltool msys/libtool msys/m4 msys/make msys/man-db msys/pacman msys/pactoys-git msys/patch msys/patchutils msys/perl msys/pkg-config msys/sed msys/swig msys/texinfo msys/texinfo-tex msys/wget msys/xmlto"
+$devel = "asciidoc autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 automake1.6 automake1.7 automake1.8 automake1.9 bison diffstat diffutils dos2unix file flex gawk gettext gettext-devel gperf grep groff intltool libtool m4 make man-db pacman pactoys-git patch patchutils perl pkg-config sed swig texinfo texinfo-tex wget xmlto git jhbuild-git"
 
-$mingw32_toolchain = "mingw32/mingw-w64-i686-binutils mingw32/mingw-w64-i686-crt-git mingw32/mingw-w64-i686-gcc mingw32/mingw-w64-i686-gcc-libs mingw32/mingw-w64-i686-gdb mingw32/mingw-w64-i686-headers-git mingw32/mingw-w64-i686-libmangle-git mingw32/mingw-w64-i686-libwinpthread-git mingw32/mingw-w64-i686-make mingw32/mingw-w64-i686-pkg-config mingw32/mingw-w64-i686-tools-git mingw32/mingw-w64-i686-winpthreads-git"
+$toolchain = "binutils crt-git gcc gcc-libs gdb headers-git libmangle-git libwinpthread-git make pkg-config tools-git winpthreads-git"
 
-# Aliases to collect the other dependencies:
-$other_msys = "msys/git msys/jhbuild-git"
 
-$other_mingw = "mingw32/mingw-w64-i686-webkitgtk2 mingw32/mingw-w64-i686-boost mingw32/mingw-w64-i686-iso-codes mingw32/mingw-w64-i686-shared-mime-info mingw32/mingw-w64-i686-libmariaclient mingw32/mingw-w64-i686-postgresql  mingw32/mingw-w64-i686-libgnomecanvas mingw32/mingw-w64-i686-ninja"
+# Note that webkitgtk3 will pull in gtk3 automatically; we need gtk2 as well to
+# support AQBanking.
+$deps = "webkitgtk3 gtk2 boost iso-codes shared-mime-info libmariadbclient postgresql libgnomecanvas ninja"
 
 Write-Host @"
 
-Now we'll install the dependencies. Accept the installation as usual. About half-way through it will stop with a message about fontconfig. Just type "Return" at it and it will resume and complete the installation.
+Now we'll install the dependencies. Accept the installation as usual. About half-way through it will stop with a message about fontconfig. Just type "Return" at it and it will resume after a minute or two (be patient!) and complete the installation.
 "@
-$proc = bash-command("pacman -S $msys_devel $mingw32_toolchain $other_msys $other_mingw")
+
+$msys_devel = make-pkgnames -prefix "msys/" -items $devel
+$mingw_toolchain = make-pkgnames -prefix $mingw_prefix -items $toolchain
+$mingw_deps = make-pkgnames -prefix $mingw_prefix -items $deps
+
+$proc = bash-command -command "pacman -S $msys_devel"
+$proc.waitForExit()
+$proc = bash-command -command "pacman -S $mingw_toolchain"
+$proc.waitForExit()
+$proc = bash-command -command "pacman -S  $mingw_deps"
+$proc.waitForExit()
+
+Write-Host @"
+
+Next we'll install the HTML Help Workshop includes and libraries into our MinGW directory.
+"@
+
+if (!$installed_hh) {
+   $installed_hh = get-item -path "hkcu:\SOFTWARE\Microsoft\HTML Help Workshop" | foreach-object{$_.GetValue("InstallDir")}
+}
+$installed_hh = make-unixpath -path $installed_hh
+$proc = bash-command -command "cp $installed_hh/include/htmlhelp.h $mingw_path/include"
+$proc.waitForExit()
+
+$proc = bash-command -command "$mingw_bin/gendef $hhctrl_ocx - > $mingw_path/lib/htmlhelp.def 2>> /errors"
+$proc.waitForExit()
+$proc = bash-command -command "$mingw_bin/dlltool -k -d $mingw_path/lib/htmlhelp.def -l $mingw_path/lib/libhtmlhelp.a >> /errors 2>&1"
 $proc.waitForExit()
 
 Write-Host @"
@@ -99,6 +249,6 @@ if (!(test-path -path "$target_dir\\src")) {
   New-Item $target_dir\\src -type directory
 }
 if (!(test-path -path "$target_dir\\src\\gnucash-on-windows.git")) {
-  $proc = bash-command("git clone -b mingw64 https://github.com/gnucash/gnucash-on-windows.git $target_dir/src/gnucash-on-windows.git")
+  $proc = bash-command -command "git clone -b mingw64 https://github.com/gnucash/gnucash-on-windows.git $target_dir/src/gnucash-on-windows.git"
   $proc.waitForExit()
 }

commit de6a0669e55dfd7cd586674a926fe37b5ebe5256
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jul 20 09:26:43 2017 -0700

    Add guile path variables to jhbuild environment.

diff --git a/jhbuildrc b/jhbuildrc
index efe14a6..3ac25aa 100644
--- a/jhbuildrc
+++ b/jhbuildrc
@@ -49,6 +49,8 @@ add_to_path_var('PATH', os.path.join(_basedir, 'msys2', 'mingw32', 'bin'))
 
 os.environ['SRCROOT'] = checkoutroot
 os.environ['PREFIX'] = prefix
+#os.environ['GUILE_LOAD_PATH'] = os.path.join(prefix, 'share', 'guile', '2.0')
+#os.environ['GUILE_LOAD_BINARY_PATH'] = os.path.join(prefix, 'lib', 'guile', '2.0', 'ccache')
 autogenargs = "--build=i686-w64-mingw32"
 #autogenargs = 'CPPFLAGS="-I%s"' % _sys_includes
 

commit bfd98fa8b0ac022c3e1cee37b786912a8688fb37
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jul 20 09:25:49 2017 -0700

    Remove two emacs backup files.

diff --git a/libsoup-2.48.0-bad-symbol.patch~ b/libsoup-2.48.0-bad-symbol.patch~
deleted file mode 100644
index ab18c51..0000000
--- a/libsoup-2.48.0-bad-symbol.patch~
+++ /dev/null
@@ -1,10 +0,0 @@
---- libsoup/libsoup-2.4.sym	2014-10-29 22:37:54 -0700
-+++ libsoup/libsoup-2.4.sym~	2014-06-18 07:42:51 -0700
-@@ -348,6 +348,7 @@
- soup_server_get_async_context
- soup_server_get_listener
- soup_server_get_listeners
-+soup_server_get_gsocket
- soup_server_get_port
- soup_server_get_type
- soup_server_get_uris
diff --git a/libsoup-2.48.0-soup-server-reserved-word.patch~ b/libsoup-2.48.0-soup-server-reserved-word.patch~
deleted file mode 100644
index c0afe73..0000000
--- a/libsoup-2.48.0-soup-server-reserved-word.patch~
+++ /dev/null
@@ -1,11 +0,0 @@
---- libsoup/include/libsoup-2.4/libsoup/soup-server.h~	2014-10-29 22:51:10 -0700
-+++ libsoup/include/libsoup-2.4/libsoup/soup-server.h	2014-10-30 12:27:08 -0700
-@@ -80,7 +80,7 @@
- 
- SOUP_AVAILABLE_IN_2_48
- gboolean        soup_server_listen             (SoupServer               *server,
--					        GSocketAddress           *interface,
-+					        GSocketAddress           *iface,
- 					        SoupServerListenOptions   options,
- 					        GError                  **error);
- SOUP_AVAILABLE_IN_2_48

commit 74c4dbce3d28006951a164adbf1a9a14ca694477
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri May 26 14:30:36 2017 -0700

    Initial commit of mingw64 installation scripts.
    
    This installs or builds all dependencies except HTML Help Workshop, and builds the mingw64 branch of GnuCash.

diff --git a/.gitattributes b/.gitattributes
index d679374..345d215 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -23,12 +23,15 @@
 *.sh    text eol=lf
 *.svg   text eol=lf
 *.xsl   text eol=lf
+*.modules text eol=lf
+jhbuildrc text eol=lf
 
 # Files that should use CRLF at all times
 *.bat text eol=crlf
 *.cmd text eol=crlf
 *.isl text eol=crlf
 *.vbs text eol=crlf
+*.ps1 text eol=crlf
 
 gnucash.iss text eol=crlf
 gnucash.rc.in  text eol=crlf
diff --git a/gnucash.modules b/gnucash.modules
new file mode 100644
index 0000000..7c6b005
--- /dev/null
+++ b/gnucash.modules
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
+<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
+<moduleset>
+
+  <repository type='tarball' name='ftp.gnu.org'
+	      href="ftp://ftp.gnu.org/gnu/"/>
+  <repository type='tarball' name='sourceforge'
+	      href="http://downloads.sourceforge.net/"/>
+  <repository type="tarball" name="csail"
+	      href="http://groups.csail.mit.edu/mac/ftpdir/"/>
+  <repository type="tarball" name="csclub"
+	      href="http://mirror.csclub.uwaterloo.ca/mysql/Downloads/"/>
+  <repository type="tarball" name="gnucash.org"
+	      href="http://www.gnucash.org/pub/gnucash/sources/"/>
+  <repository type="git" name="git.gnucash.org"
+	      href="http://git.gnucash.org/"/>
+  <repository type="svn" name="aquamaniac"
+	      href="http://devel.aqbanking.de/svn/"/>
+  <repository type="git" name="github"
+	      href="git://github.com/"/>
+  <repository type="system" name="system"/>
+
+  <systemmodule id="webkitgtk-3.0">
+    <pkg-config>webkitgtk-3.0.pc</pkg-config>
+    <branch repo="system" version="2.4.11" />
+  </systemmodule>
+
+  <systemmodule id="shared-mime-info">
+    <pkg-config>shared-mime-info.pc</pkg-config>
+    <branch repo="system" version="1.4" />
+  </systemmodule>
+
+  <systemmodule id="gnutls">
+    <pkg-config>gnutls.pc</pkg-config>
+    <branch repo="system" version="3.5.10" />
+  </systemmodule>
+
+  <systemmodule id="openssl">
+    <pkg-config>openssl.pc</pkg-config>
+    <branch repo="system" version="1.0.2k" />
+  </systemmodule>
+
+  <systemmodule id="libffi">
+    <pkg-config>libffi.pc</pkg-config>
+    <branch repo="system" version="3.2.1" />
+  </systemmodule>
+
+  <systemmodule id="gmp">
+    <systemdependencies>
+      <dep type="c_include" name="gmp.h" />
+    </systemdependencies>
+    <branch repo="system" />
+  </systemmodule>
+
+  <systemmodule id="gcrypt">
+    <systemdependencies>
+      <dep type="c_include" name="gcrypt.h" />
+    </systemdependencies>
+    <branch repo="system" />
+  </systemmodule>
+
+  <systemmodule id="ltdl">
+    <systemdependencies>
+      <dep type="c_include" name="ltdl.h" />
+    </systemdependencies>
+    <branch repo="system" />
+  </systemmodule>
+
+  <systemmodule id="icu">
+    <pkg-config>icu-i18n.pc</pkg-config>
+    <branch repo="system" version="57.1" />
+  </systemmodule>
+
+  <systemmodule id="iso-codes">
+    <pkg-config>iso-codes.pc</pkg-config>
+    <branch repo="system" version="3.74" />
+  </systemmodule>
+
+  <systemmodule id="boost">
+    <systemdependencies>
+      <dep type="c_include" name="boost/regex.h" />
+    </systemdependencies>
+    <branch repo="system" />
+  </systemmodule>
+
+  <autotools id="libunistring" autogen-sh="configure">
+    <branch repo="ftp.gnu.org" module="libunistring/libunistring-0.9.7.tar.gz"
+	    version="0.9.7">
+    </branch>
+  </autotools>
+
+  <autotools id="libatomic-ops"
+             autogen-template="/bin/bash -c 'pushd %(srcdir)s && ./%(autogen-sh)s && popd && %(srcdir)s/configure --prefix=%(prefix)s> %(autogenargs)s'">
+    <branch repo="github" module="ivmai/libatomic_ops"
+	    revision="libatomic_ops-7_4_4"/>
+  </autotools>
+
+  <autotools id="bdw-gc" autogen-template="/bin/bash -c 'pushd %(srcdir)s && ./autogen.sh && automake -ac && popd && %(srcdir)s/configure --prefix %(prefix)s  %(autogenargs)s'"
+	     autogenargs="--enable-threads=pthreads">
+    <branch repo="github" module="ivmai/bdwgc"  revision="gc7_6_0" />
+    <dependencies>
+      <dep package="libatomic-ops"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="guile" autogen-sh="configure"
+	     autogenargs="--disable-error-on-warning">
+    <branch repo="ftp.gnu.org" module="guile/guile-1.8.8.tar.gz"
+	    version="1.8.8"/>
+    <dependencies>
+      <dep package="gmp"/>
+    </dependencies>
+  </autotools>
+
+  <!-- Unfortunately in addition to needing a few patches this hangs when it tries to compile Scheme. -->
+  <autotools id="guile2" autogen-sh="autoreconf">
+    <branch repo="ftp.gnu.org" module="guile/guile-2.0.12.tar.gz"
+	    version="2.0.12">
+      <patch file="https://git.gnome.org/browse/gtk-osx/plain/patches/guile-clocktime.patch" strip="1"/>
+    </branch>
+    <dependencies>
+      <dep package="libunistring"/>
+      <dep package="gmp"/>
+      <dep package="libffi"/>
+      <dep package="bdw-gc"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="libchipcard" autogen-sh="configure" autogenargs="--enable-local-install">
+    <branch module="gnucash/Dependencies/libchipcard-5.0.4.tar.gz" version="5.0.4"
+            repo="sourceforge">
+    </branch>
+    <dependencies>
+      <dep package="gcrypt"/>
+      <dep package="gnutls"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="gwenhywfar" autogen-sh="configure"
+	     autogenargs="--with-guis=gtk2 --enable-local-install --disable-binreloc --disable-ssl">
+    <branch module="gnucash/Dependencies/gwenhywfar-4.17.0.tar.gz" version="4.17.0"
+	    repo="sourceforge">
+    </branch>
+    <dependencies>
+      <dep package="gcrypt"/>
+      <dep package="gnutls"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="gwenhywfar-svn" autogen-template="make -fMakefile.cvs && %(srcdir)s/configure --prefix %(prefix)s --libdir %(libdir)s %(autogenargs)s"
+	     autogenargs="--with-guis=gtk2 --enable-local-install --disable-binreloc --disable-ssl">
+    <branch module="gwenhywfar" repo="aquamaniac"/>
+    <dependencies>
+      <dep package="gcrypt"/>
+      <dep package="gnutls"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="ktoblzcheck" autogen-sh="configure">
+    <branch module="ktoblzcheck/ktoblzcheck-1.47.tar.gz" version="1.47"
+	    repo="sourceforge"/>
+  </autotools>
+
+  <autotools id="xmlsec">
+    <branch module="lsh123/xmlsec" repo="github" tag="xmlsec-1_2_20"/>
+    <dependencies>
+      <dep package="openssl"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="aqbanking" autogen-sh="autoreconf" makeargs="-j1"
+	     autogenargs="--enable-local-install">
+    <branch module="gnucash/Dependencies/aqbanking-5.6.12.tar.gz" version="5.6.12"
+	    repo="sourceforge">
+    </branch>
+    <dependencies>
+      <dep package="gwenhywfar"/>
+      <dep package="gmp"/>
+      <dep package="ktoblzcheck"/>
+      <dep package="xmlsec"/>
+      <dep package="libchipcard"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="aqbanking-svn"
+	     autogenargs='--enable-local-install"'
+	     autogen-template="make -fMakefile.cvs && %(srcdir)s/configure --prefix %(prefix)s --libdir %(libdir)s %(autogenargs)s" >
+     <branch module="aqbanking" repo="aquamaniac" >
+    </branch>
+    <dependencies>
+      <dep package="libofx"/>
+      <dep package="gwenhywfar-svn"/>
+      <dep package="gmp"/>
+      <dep package="ktoblzcheck"/>
+      <dep package="xmlsec"/>
+      <dep package="libchipcard"/>
+    </dependencies>
+  </autotools>
+
+<!-- Note for cross-compilation: libtool, for reasons known only to
+     itself, ignores the CFLAGS and links libosp.5.0.0.la with the
+     native architecture. When jhbuild stops, start a shell and go
+     back and find the link step, copy and paste it, adding the
+     architecture flags, and fire away. Then you can exit the shell
+     and rerun build and it will work OK. -->
+  <autotools id="OpenSP"
+	     autogenargs="--disable-static --enable-shared --disable-doc-build --disable-nls"
+	     autogen-template='/bin/bash -c "pushd %(srcdir)s && ./autoinit.sh && popd && %(srcdir)s/configure --prefix %(prefix)s  %(autogenargs)s"'>
+    <branch repo="sourceforge" module="openjade/OpenSP-1.5.2.tar.gz"
+	    version='1.5.2'>
+      <patch file="/c/gcdev/gnucash-on-windows.git/opensp-1.5.2.patch" strip='1'/>
+    </branch>
+  </autotools>
+
+  <autotools id="libofx" autogen-sh='autoreconf'>
+    <branch repo="sourceforge" module="libofx/libofx-0.9.10.tar.gz"
+	    version="0.9.10"/>
+    <dependencies>
+      <dep package="OpenSP"/>
+    </dependencies>
+  </autotools>
+
+  <autotools id="pcre" autogenargs="--enable-unicode-properties"
+	     autogen-sh="configure">
+    <branch repo="sourceforge" module="pcre/pcre-8.32.tar.bz2"
+	    version="8.32"/>
+  </autotools>
+
+  <autotools id="swig" autogen-sh="configure">
+    <branch repo="sourceforge" module="swig/swig-2.0.11.tar.gz"
+	    version="2.0.11"/>
+    <dependencies>
+      <dep package="pcre"/>
+    </dependencies>
+  </autotools>
+
+
+  <cmake id="mysql">
+    <branch repo="csclub" module="Connector-C/mysql-connector-c-6.0.2.tar.gz"
+	    version="6.0.2" >
+    </branch>
+    <dependencies>
+      <dep package="cmake"/>
+    </dependencies>
+  </cmake>
+
+  <autotools id="libdbi" autogen-sh="autoreconf" autogenargs="--disable-docs">
+    <branch repo="sourceforge" module="libdbi/libdbi-0.8.4.tar.gz"
+	    version="0.8.4">
+      <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/libdbi-0.8.3.patch" strip="1"/>
+    </branch>
+  </autotools>
+
+  <autotools id="libdbi-drivers" autogen-sh='autoreconf'
+	     autogenargs='--disable-docs --with-sqlite3 --with-sqlite3-dir="/mingw32" --with-pgsql --with-pgsql-dir="/mingw32" --with-mysql --with-mysql-dir="/mingw32" '>
+    <branch repo="sourceforge" version="0.8.3-1"
+	    module="libdbi-drivers/libdbi-drivers-0.8.3-1.tar.gz">
+      <patch file="https://raw.githubusercontent.com/Gnucash/gnucash-on-windows/master/libdbi-drivers-errno.patch" strip="1"/>
+    </branch>
+    <dependencies>
+      <dep package="libdbi"/>
+    </dependencies>
+  </autotools>
+
+  <cmake id="googletest" cmakeargs="-DBUILD_GMOCK=OFF" skip-autogen="yes"
+	 skip-install="yes">
+    <branch module="google/googletest" repo="github" tag="release-1.8.0"/>
+  </cmake>
+
+   <!--autotools id="gnucash"
+	      autogen-template="%(srcdir)s/%(autogen-sh)s && %(srcdir)s/configure -\-prefix %(prefix)s %(autogenargs)s"
+	      autogenargs="-\-enable-ofx -\-enable-aqbanking -\-enable-binreloc -\-enable-dbi -\-with-dbi-dbd-dir=$PREFIX/lib/dbd"-->
+ <cmake id="gnucash"
+        cmakeargs="-G 'MSYS Makefiles' -DCMAKE_INSTALL_LIBDIR=lib  -DCMAKE_PREFIX_PATH=c:/gcdev64/msys2 -DPERL_EXECUTABLE=/usr/bin/perl -DGNC_DBD_DIR=$PREFIX/lib/dbd -DHTMLHELP_DIR=$PREFIX/hh -DGTEST_ROOT=$SRCROOT/googletest/googletest -DGMOCK_ROOT=$SRCROOT/googletest/googlemock">
+   <branch repo="github" module="Gnucash/gnucash.git" revision="master"
+	   checkoutdir="gnucash-git"/>
+    <dependencies>
+      <dep package="libofx"/>
+      <dep package="aqbanking"/>
+      <dep package="libdbi-drivers"/>
+      <!--dep package="shared-mime-info"/-->
+      <!--dep package="iso-codes"/-->
+      <dep package="guile"/>
+      <!--dep package="swig"/-->
+      <dep package="boost"/>
+      <dep package="googletest"/>
+    </dependencies>
+   <!--/autotools-->
+ </cmake>
+
+  <autotools id="gnucash-docs-git" autogenargs="--disable-scrollkeeper"
+	    autogen-template="%(srcdir)s/%(autogen-sh)s && %(srcdir)s/configure --prefix %(prefix)s %(autogenargs)s"
+	    makeargs=" html" makeinstallargs="install-html" >
+    <branch  repo="github" module="Gnucash/gnucash-docs.git" revision="master"
+	   checkoutdir="gnucash-docs-git"/>
+    <dependencies>
+      <!-- dep package="scrollkeeper"/ -->
+    </dependencies>
+  </autotools>
+
+  <autotools id="gnucash-docs" autogenargs="--disable-scrollkeeper"
+	    autogen-template="%(srcdir)s/%(autogen-sh)s && %(srcdir)s/configure --prefix %(prefix)s %(autogenargs)s"
+	    makeargs=" html" makeinstallargs="install-html" >
+    <branch  module="gnucash/gnucash-docs/gnucash-docs-2.6.16.tar.gz"
+	     version="2.6.16" repo="sourceforge"/>
+  </autotools>
+
+  <metamodule id="meta-gnucash">
+    <dependencies>
+      <dep package="gnucash"/>
+      <dep package="gnucash-docs"/>
+    </dependencies>
+  </metamodule>
+
+</moduleset>
diff --git a/jhbuildrc b/jhbuildrc
new file mode 100644
index 0000000..efe14a6
--- /dev/null
+++ b/jhbuildrc
@@ -0,0 +1,61 @@
+#-*- mode: python -*-
+def _popen(cmd_arg):
+    from subprocess import Popen, PIPE
+    devnull = open('/dev/null')
+    cmd = Popen(cmd_arg, stdout=PIPE, stderr=devnull, shell=True)
+    retval = cmd.stdout.read().strip()
+    err = cmd.wait()
+    cmd.stdout.close()
+    devnull.close()
+    if err:
+        raise RuntimeError, "Failed to close %s stream" % cmd_arg
+    return retval
+
+def environ_append(key, value, separator=' '):
+    old_value = os.environ.get(key)
+    if old_value is not None:
+        value = old_value + separator + value
+    os.environ[key] = value
+
+def append_autogenargs(module, args):
+    old_value = module_autogenargs.get(module, autogenargs)
+    module_autogenargs[module] = old_value + " " + args
+
+def remove_autogenargs(module, args):
+    arg_string = module_autogenargs.get(module, autogenargs)
+    module_autogenargs[module] = arg_string.replace(args, "")
+def add_to_path_var(var, path):
+    if not var in os.environ:
+        os.environ[var] = path
+    else:
+        os.environ[var] = os.environ[var] + ":" + path
+
+_config_dir = os.path.join('/c', 'gcdev64', 'src', 'gnucash-on-windows.git')
+_basedir = os.path.join('/c', 'gcdev64')
+prefix = os.path.join(_basedir, 'inst')
+checkoutroot = os.path.join(_basedir, 'src')
+buildroot = os.path.join(_basedir, 'build')
+tarballdir = os.path.join('/c', 'gcdev', 'downloads')
+moduleset = os.path.join(_config_dir, 'gnucash.modules')
+
+_mingw_includes = os.path.join(_basedir, 'msys2', 'mingw32', 'include')
+_mingw_libs = os.path.join(_basedir, 'msys2', 'mingw32', 'lib')
+_usr_include = os.path.join('/usr', 'include')
+_usr_lib = os.path.join('/usr', 'lib')
+environ_append('CPPFLAGS', '-I%s -I%s' % (_mingw_includes, _usr_include))
+environ_append('LDFLAGS', '-L%s -L%s' % (_mingw_libs, _usr_lib))
+add_to_path_var('PKG_CONFIG_PATH', os.path.join(_mingw_libs, 'pkgconfig'))
+add_to_path_var('PATH', os.path.join(_basedir, 'msys2', 'mingw32', 'bin'))
+
+os.environ['SRCROOT'] = checkoutroot
+os.environ['PREFIX'] = prefix
+autogenargs = "--build=i686-w64-mingw32"
+#autogenargs = 'CPPFLAGS="-I%s"' % _sys_includes
+
+append_autogenargs("libofx", "--with-opensp-includes=" + prefix + "/include/OpenSP --with-opensp-libs=" + prefix + "/lib")
+append_autogenargs("libdbi-drivers","--with-dbi-incdir=" + prefix + "/include --with-dbi-libdir=" + prefix + "/lib")
+module_makeargs["aqbanking"]="-j1"
+
+module_extra_env["gwenhywfar"]={'CPPFLAGS':_popen('pkg-config --cflags gtk+-2.0'), 'LDFLAGS':_popen('pkg-config --libs gtk+-2.0')}
+module_extra_env["gnucash"]={'ACLOCAL_FLAGS':'-I' + os.path.join('/mingw32', 'share', 'aclocal')}
+
diff --git a/opensp-1.5.2.patch b/opensp-1.5.2.patch
index 5a5ac6d..3271365 100644
--- a/opensp-1.5.2.patch
+++ b/opensp-1.5.2.patch
@@ -1,5 +1,5 @@
---- lib/Makefile.am~	Thu Dec 15 13:13:16 2005
-+++ lib/Makefile.am	Tue Feb  6 10:57:58 2007
+--- a/lib/Makefile.am	Thu Dec 15 13:13:16 2005
++++ b/lib/Makefile.am	Tue Feb  6 10:57:58 2007
 @@ -76,7 +76,9 @@
  	splibpch.h token.h app_inst.cxx arc_inst.cxx entmgr_inst.cxx \
  	parser_inst.cxx xentmgr_inst.cxx SubstTable.cxx \
@@ -11,3 +11,30 @@
  
  INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/generic
  
+--- a/lib/MessageReporter.cxx    2005-07-21 07:05:17.000000000 -0700
++++ b/lib/MessageReporter.cxx     2017-05-06 11:51:04.348011200 -0700
+@@ -13,7 +13,8 @@
+ #include "macros.h"
+
+ #include <string.h>
+-
++#include <iostream>
++#include <sstream>
+
+ #ifdef SP_NAMESPACE
+ namespace SP_NAMESPACE {
+@@ -123,8 +124,12 @@
+     os() << ':';
+   }
+   if (options_ & messageNumbers)
+-    os() << (unsigned long)message.type->module() << "." 
++    {
++      std::ostringstream ss;
++      ss << (void*)message.type->module();
++       os() << ss.str().c_str() << "."
+       << (unsigned long)message.type->number() << ":";
++    }
+   switch (message.type->severity()) {
+   case MessageType::info:
+     formatFragment(MessageReporterMessages::infoTag, os());
+
diff --git a/setup-mingw64.ps1 b/setup-mingw64.ps1
new file mode 100644
index 0000000..4ffbe32
--- /dev/null
+++ b/setup-mingw64.ps1
@@ -0,0 +1,104 @@
+
+Param([string]$target_dir = "c:\\gcdev64")
+
+$progressPreference = 'silentlyContinue'
+$installer32 = "http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe"
+$archive32 = "http://repo.msys2.org/distrib/i686/msys2-base-i686-20161025.tar.xz"
+$installer64 = "http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe"
+$archive64 = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20161025.tar.xz"
+
+$download_dir = "c:\\gcdev\\downloads"
+$installer_file = "$download_dir\\msys2.exe"
+$archive_file = "$download_dir\\msys2-base.tar.xz"
+$installer = If ([IntPtr]::size -eq 4) {$installer32} Else {$installer64}
+
+$mingw_setup = @"
+function Controller() {}
+Controller.prototype.IntroductionPageCallback = function() {
+    gui.clickButton(buttons.NextButton);
+}
+Controller.prototype.TargetDirectoryPageCallback = function() {
+    var page = gui.pageWidgetByObjectName("TargetDirectoryPage");
+    page.TargetDirectoryLineEdit.setText("$target_dir\\msys2");
+    gui.clickButton(buttons.NextButton);
+}
+Controller.prototype.StartMenuDirectoryPageCallback = function() {
+    gui.clickButton(buttons.NextButton);
+}
+Controller.prototype.FinishedPageCallback = function() {
+   var page = gui.pageWidgetByObjectName("FinishedPage");
+   page.RunItCheckBox.checked = false;
+   gui.clickButton(buttons.FinishButton);
+}
+"@
+
+if (!(test-path -path $installer_file)) {
+   Write-Host "Downloading $installer_file from $installer"
+   Invoke-WebRequest -URI $installer -OutFile $installer_file
+}
+if (!(test-path -path $target_dir)) {
+   New-Item $target_dir -type directory
+}
+
+Set-Content -Path $target_dir\mingw64-setup.qs -Value $mingw_setup | Out-Null
+Set-Location -Path $target_dir
+
+function bash-command() {
+   param ([string]$command = "")
+   $psi = new-object "Diagnostics.ProcessStartInfo"
+   $psi.Filename = "$target_dir\msys2\usr\bin\bash.exe"
+   $psi.Arguments =  "-c ""export PATH=/usr/bin; $command"""
+   return [Diagnostics.Process]::Start($psi)
+}
+
+#if MSys2 isn't already installed, install it.
+if (!(test-path -path $target_dir\msys2\usr\bin\bash.exe)) {
+   & $installer_file --script $target_dir\mingw64-setup.qs | Out-Null
+   Write-Host @"
+Updating the new installation. A bash window will open. In that window accept the proposed installation and close the window when the update completes.
+
+There will be a second update.
+"@
+   $proc = bash-command("pacman -Syuu")
+   $proc.WaitForExit()
+}
+
+#Update the system.
+Write-Host @"
+
+Updating the installation. Accept the proposed changes. If the window doesn't close on its own then close it and re-run the script when it finishes.
+"@
+
+$proc = bash-command("pacman -Syuu")
+$proc.WaitForExit()
+
+# Set up aliases for the parts of msys-devtools and mingw-w64-toolchain that
+# we need:
+$msys_devel = "msys/asciidoc msys/autoconf msys/autoconf2.13 msys/autogen msys/automake-wrapper msys/automake1.10 msys/automake1.11 msys/automake1.12 msys/automake1.13 msys/automake1.14 msys/automake1.15 msys/automake1.6 msys/automake1.7 msys/automake1.8 msys/automake1.9 msys/bison msys/diffstat msys/diffutils msys/dos2unix msys/file msys/flex msys/gawk msys/gdb msys/gettext msys/gettext-devel msys/gperf msys/grep msys/groff msys/intltool msys/libtool msys/m4 msys/make msys/man-db msys/pacman msys/pactoys-git msys/patch msys/patchutils msys/perl msys/pkg-config msys/sed msys/swig msys/texinfo msys/texinfo-tex msys/wget msys/xmlto"
+
+$mingw32_toolchain = "mingw32/mingw-w64-i686-binutils mingw32/mingw-w64-i686-crt-git mingw32/mingw-w64-i686-gcc mingw32/mingw-w64-i686-gcc-libs mingw32/mingw-w64-i686-gdb mingw32/mingw-w64-i686-headers-git mingw32/mingw-w64-i686-libmangle-git mingw32/mingw-w64-i686-libwinpthread-git mingw32/mingw-w64-i686-make mingw32/mingw-w64-i686-pkg-config mingw32/mingw-w64-i686-tools-git mingw32/mingw-w64-i686-winpthreads-git"
+
+# Aliases to collect the other dependencies:
+$other_msys = "msys/git msys/jhbuild-git"
+
+$other_mingw = "mingw32/mingw-w64-i686-webkitgtk2 mingw32/mingw-w64-i686-boost mingw32/mingw-w64-i686-iso-codes mingw32/mingw-w64-i686-shared-mime-info mingw32/mingw-w64-i686-libmariaclient mingw32/mingw-w64-i686-postgresql  mingw32/mingw-w64-i686-libgnomecanvas mingw32/mingw-w64-i686-ninja"
+
+Write-Host @"
+
+Now we'll install the dependencies. Accept the installation as usual. About half-way through it will stop with a message about fontconfig. Just type "Return" at it and it will resume and complete the installation.
+"@
+$proc = bash-command("pacman -S $msys_devel $mingw32_toolchain $other_msys $other_mingw")
+$proc.waitForExit()
+
+Write-Host @"
+
+Finally we'll clone the gnucash-on-windows repository into target-dir/src and you'll be ready to build GnuCash.
+"@
+
+if (!(test-path -path "$target_dir\\src")) {
+  New-Item $target_dir\\src -type directory
+}
+if (!(test-path -path "$target_dir\\src\\gnucash-on-windows.git")) {
+  $proc = bash-command("git clone -b mingw64 https://github.com/gnucash/gnucash-on-windows.git $target_dir/src/gnucash-on-windows.git")
+  $proc.waitForExit()
+}



Summary of changes:
 .gitattributes                                  |   3 +
 gnucash.modules                                 | 318 ++++++++++++++++++++++++
 jhbuildrc.in                                    |  65 +++++
 libsoup-2.48.0-bad-symbol.patch~                |  10 -
 libsoup-2.48.0-soup-server-reserved-word.patch~ |  11 -
 opensp-1.5.2.patch                              |  31 ++-
 patches/OpenSP-1.5.2-non-posix-functions.patch  |  33 +++
 patches/guile-2.0.14-mingw64-fixups.patch       | 167 +++++++++++++
 patches/libdbi-0.9.0-mingw64.patch              |  64 +++++
 patches/libdbi-drivers-linkage.patch            |  13 +
 setup-mingw64.ps1                               | 263 ++++++++++++++++++++
 11 files changed, 955 insertions(+), 23 deletions(-)
 create mode 100644 gnucash.modules
 create mode 100644 jhbuildrc.in
 delete mode 100644 libsoup-2.48.0-bad-symbol.patch~
 delete mode 100644 libsoup-2.48.0-soup-server-reserved-word.patch~
 create mode 100644 patches/OpenSP-1.5.2-non-posix-functions.patch
 create mode 100644 patches/guile-2.0.14-mingw64-fixups.patch
 create mode 100644 patches/libdbi-0.9.0-mingw64.patch
 create mode 100644 patches/libdbi-drivers-linkage.patch
 create mode 100644 setup-mingw64.ps1



More information about the gnucash-changes mailing list