Difference between revisions of "MacOS/Quartz"

From GnuCash
Jump to: navigation, search
(Complete rewrite: Now an almost automatic process using provided jhbuild moduleset)
Line 1: Line 1:
This page describes the process by which I was able to get GnuCash 2.1.1 running with the Gtk+ on Mac OS X libraries. These libraries build on top of Apple's Quartz graphics/windowing system, making the resulting GnuCash application entirely independent of X11. This means also that the resulting GnuCash executable runs as its own independent application in the Mac OS X sense. For example, it gets its own entry in the Dock, rather than being subsumed into the X11 entry. Note, however, this is a lengthy process that involves compiling many source code distributions of various packages, some of which need minor edits (I haven't had a chance to make proper patchfiles). See [[MacOSXInstallation]] for the summary of other methods of installing GnuCash on the Mac, which use X11 but are much more straightforward.
+
==Overview==
 +
GnuCash can be built to run more or less natively on OSX -- meaning without X11. Better yet, the build is almost automatic.
  
=== Overview ===
+
To pull this off, you'll need Developer Tools installed. The instructions which follow assume that you're comfortable building programs from the command line and editing text files.
  
The sequence of steps here
+
I've succeeded in building this under various incarnations of Leopard while perfecting the modulesets, always on a Mac Pro... but it ought to work on any Mac running Tiger or Leopard.
worked for me one time on a G4 Power PC running Mac OS X 10.4. I'm trying to automate this process using MacPorts so
 
that I can reproduce it, won't have to do it again by hand, and can upgrade practically as newer versions of the components are released. (If that gets to a workable
 
state, I'll update these instructions.)
 
  
January 2008: I (jralls) have successfully run this on a MacPro with 10.5 (Leopard), with a few changes because of new dependencies. I've taken out all but one of the version numbers (for guile, see below) because what's the point of going through all of this with old versions? What's more, GTK+ Mac now builds with an automated tool (jhbuild) which retrieves latest-and-greatest versions, many via subversion from development trees, so trying to use older versions will cause trouble. http://a.sotirov.net/2008/building-gnucash-on-mac-osx/ provides a much simpler way to build an XWindows version of gnucash, albeit without support for quotes or ofx.  
+
The default configuration builds in your home folder. On my system, I build in /usr/local/src/gnome and install to /usr/local/gtk. If you want to do that, uncomment the checkoutroot and prefix lines in .jhbuildrc-custom, then create the folders up front and give yourself ownership. If you don't know how to do that, then you should probably leave it the way it is.
  
 +
==Preliminaries==
  
Before you begin, there are a
+
Go to http://developer.imendio.com/projects/gtk-macosx/build-instructions and follow the instructions. '''''Don't run jhbuild build yet!'''''
few important caveats: First, a number of the modifications below are
 
only for the sake of getting GnuCash to run. They're not appropriate
 
for using these packages with other software. That's why it's
 
important to keep this installation segregated from other software on
 
your computer.  Second, as the Gtk+ on Mac OS X describes itself, it's
 
a work in progress and not ready for general use. There are likely
 
unknown bugs lurking.  I would not recommend this build for use with
 
any really important data.  That being said, I have found the
 
usability over the past few days to be fine, I think it looks nicer
 
than the X11 version, and it's nice not to have to invoke X11.
 
Anyhow, here goes:
 
  
=== Basic Gtk+ build ===
+
If you have set <tt>$MACOSX_DEPLOYMENT_TARGET</tt> to something other than your running version of OSX, you may get an error during jhbuld bootstrap.
  
Update January 2008:
+
You may get an error about <tt>$PREFIX/inst/man/man1/cjpeg.1</tt> not existing. What this really means is that install wasn't set to make the directory, so select '[4] start shell" and mkdir -p $PREFIX/inst/man/man1, quit the shell, and select '[1] rerun stage install'.
  
The instructions for building gtk for OSX are here: http://developer.imendio.com/projects/gtk-macosx/build-instructions
+
Paste the code from [[#Customize jhbuildrc]] into a file named ".jhbuildrc-custom" in your home folder.
 +
Do likewise for [[#Gnucash Moduleset]], with a filename "gnucash.modules".
  
You'll need Subversion if you don't already have it; if you have Leopard, it's already there.
+
==Building==
  
Note that the default install location for jhbuild is <code>/opt/gtk</code>, which is OK unless you have MacPorts. You can override it in <code>~/.jhbuildrc-custom</code>. If you do, replace <code>/opt/gtk</code> with whatever you choose in the <code>--prefix=</code> arguments below. If you don't, make sure that you have a <code>/opt</code> directory and that you have write permission for it.
+
Once all of the preliminaries are complete, do:
 +
<tt>
 +
$> jhbuild build
 +
</tt>
  
I encountered a problem with jhbuild making gmp and guile; my solution is here: http://developer.imendio.com/node/167
+
You'll get a few errors:
It appears, though, that they've been removed from jhbuild, so you shouldn't have to worry about it.
 
  
Be sure to do the rest of your building inside the shell created by
+
'''libgnomeprint''' has a defective configure.ac which fails when libm isn't found. I've filed a bug report (Bug 540837) with a patch, but a similar bug report (Bug 471730) has been sitting for a year, so there's no telling when the developers will get around to fixing this (and libgnomeprint is deprecated anyway). Here's the patch:
<code>
 
jhbuild shell
 
</code>
 
  
Otherwise you'll need to set a bunch of environment variables at various stages.
+
<pre>
 +
--- configure.in        2008-07-03 14:18:44.000000000 -0700
 +
+++ configure.in.mod    2008-07-03 14:17:11.000000000 -0700
 +
@@ -148,9 +148,17 @@
 +
dnl Checking for libm
 +
dnl =================================
 +
AC_CHECK_LIBM
 +
-if test "x$LIBM" = "x"; then
 +
-      AC_MSG_ERROR(You need -lm(mathematic library) for this version of libgnomeprint.)
 +
-fi
 +
+case $host in
 +
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
 +
+  # These system don't have libm, or don't need it
 +
+  ;;
 +
+*)
 +
+  if test "x$LIBM" = "x"; then
 +
+      AC_MSG_ERROR(You need -lm(mathematic library) for this version of
 +
+libgnomeprint.)
 +
+  fi
 +
+  ;;
 +
+esac
 +
LDFLAGS="$LDFLAGS $LIBM"
 +
 +
dnl =================================
 +
</pre>
 +
 
 +
Select '[4] start shell', apply the patch (you probably will need to use <tt>patch -l</tt>) , quit the shell, and select "[6] go to stage configure"
  
The old instructions, with gtk-osx-build. There's a note about this at the bottom of the build-instructions page: It's deprecated, but they have a link to further instructions.
+
'''goffice''' will complain about a misconfiguration of gtk-doc. It doesn't matter, so select "[2] ignore error".
  
<ol>
+
'''libgnomeui''' Another configure.in bug (Bug 535958). The patch:
<li>Install git and subversion from MacPorts or Fink.</li>
+
<pre>
<li>Create a fresh new user account (e.g. "gtkbuild") ''without'' the MacPorts or Fink environment variables and path, and link just the git/subversion executables into a directory added to gtkbuild's PATH.</li>
+
Index: configure.in
<li>Follow the instructions to build gtk+ at http://developer.imendio.com/projects/gtk-macosx/build-instructions:
+
===================================================================
<ol>
+
--- configure.in       (revision 5608)
  <li> First do the "bootstrap" </li>
+
+++ configure.in        (working copy)
  <li> Then the "core" </li>
+
@@ -116,7 +116,7 @@
  <li> And then build all of the modules in the "Extra:" list printed when you execute <code>gtk-osx-build help</code>, one by one in the order on that list.</li>
+
    gnome_keyring_requirement="gnome-keyring-1 >= gnome_keyring_required_version"
</ol>
+
    GNOME_KEYRING="gnome-keyring-1"
<li> Execute <code>gtx-osx-build shell</code> to get the proper environment, and execute all further commands in the resulting shell.</li>
 
</ol>
 
  
=== GnuCash's many other requirements ===
+
-    if test x$GNOME_HAVE_X11 != xyes ; then
Next is a long series of download-configure-build-install cycles to get all of the packages GnuCash depends on.  For each one, I give the package name and version, a URL to download from, and a configure command.  If there are no other instructions, you download the tarball from the given URL, extract it (e.g. <code>tar -zxvf <tarball filename></code>,  cd into the top level directory extracted, execute the configure command, and then execute <code>make</code> and then <code>make install</code>. The "standard configure" command listed in many cases below is <code>./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib</code> (probably in many cases not all of these options are necessary or even operational, it's just convenient to have one command that can be used in as many cases as possible.) Note that there's nothing magic about /opt/gtk; you can use anything you want for a prefix (but you should stay away from places used by OSX, Fink, or MacPorts). If you leave off the prefix, most of these packages will default to installing in /usr/local.
+
+    if test x$have_x != xdisabled && test x$GNOME_HAVE_X11 != xyes ; then
 +
        AC_MSG_ERROR([libX11 not found])
 +
    fi
 +
    ;;
  
(Jan 2008)
 
As built by jhbuild, pango is missing freetype (libpangoft2), which is needed by libgnomecanvas. It's present in /usr/X11 in at least Tiger and Leopard (if you installed X11), or you can build it over (which is probably easier).
 
  
To build it from within jhbuild, add
 
<pre>
 
modules = [ 'meta-gtk-osx-bootstrap', 'meta-gtk-osx-core' , 'meta-gtk-osx-freetype' ]
 
 
</pre>
 
</pre>
to your .jhbuildrc-custom before running jhbuild build.
 
  
To use the installed version, issue
+
Select "[4] start shell", apply the patch, quit the shell, and select "[1] rerun configure"
<pre>
 
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/X11/lib/pkgconfig
 
</pre>
 
from inside the jhbuild shell and rebuild pango (i.e., cd to srcdir/pango and do <code>make && make install</code>).
 
  
Next get, build, and install the following additional libraries. GNOME means http://ftp.gnome.org/pub/GNOME/platform. You'll go down three levels, to major-version/version/sources, with major-version being something like 2.20 and version being like 2.20.1. SOURCES means http://ftp.gnome.org/pub/gnome/sources. In general you'll want the latest versions because jhbuild retrieves its sources directly from svn.
+
'''slib''' will fail because it wants to install to /usr/local, and you'd have to be building with root authority for that to work. We don't want to install there anyway, so select "[4] start shell" and:
<ol>
+
<tt>
  <li>readline, ftp://ftp.gnu.org/pub/gnu/readline, <code>./configure --prefix=/opt/gtk</code>. Yes, there's a libreadline already in the system libraries, but it's not gnu readline and it won't work. Note the patches subdirectory for the version you get. If you're building readline 5.2 on Leopard, you'll need at least patch 52-012, but you'll probably want to apply them all just on principle.</li>
+
$> mkdir $PREFIX/lib/slib
  <li>guile 1.6.8, ftp://ftp.gnu.org/pub/gnu/guile, standard configure. Guile 1.8 may be installed by jhbuild as part of GTK+ Mac, but for some reason it doesn't play well with gnucash. In particular, gnucash uses the construct <code>(map&nbsp;(lambda&nbsp;(foo)&nbsp;(bar)))</code>, which is perfectly valid Scheme -- but guile 1.8 doesn't recognize <code>map</code> as a function name. To be safe, go to the source directory where jhbuild built guile (if it did) and run <code>make uninstall</code> <em>before installing guile-1.6.8</em></li>
+
$> cp *.scm $PREFIX/lib/slib/
  <li>Download slib3a4 from  http://swiss.csail.mit.edu/~jaffer/SLIB.html and unzip it. You then need to link the top-level directory created by the unzipping into the guile library directory:
+
$> cp guile.init $PREFIX/lib/slib
<pre>
+
$> cd $PREFIX/share/guile/1.6/
ln -s <slib directory> /opt/gtk/share/guile/1.6
+
$> ln -s ../../../lib/slib .
mkdir /opt/gtk/share/guile/site
+
$> $PREFIX/bin/guile
</pre>
 
If you prefer, you can skip the symbolic link and instead export SCHEME_LIBRARY_PATH=<slib&nbsp;directory>.<br>
 
Start guile and run the following lisp commands:
 
<pre>
 
$guile
 
 
guile> (use-modules (ice-9 slib))
 
guile> (use-modules (ice-9 slib))
 
guile> (require 'new-catalog)
 
guile> (require 'new-catalog)
 
guile> (quit)
 
guile> (quit)
</pre>  
+
</tt>
Slib is now ready to use.</li>
+
Quit the shell and select "[2] ignore error and continue to done".
  <li>libIDL, GNOME, standard configure</li>
+
 
  <li>ORBit2, GNOME, standard configure</li>
+
You'll have to stop the build (control-c will do it) after the gnucash tarball unpacks to apply the following patch. '''''Make sure to do it before configure finishes!'''''
  <li>GConf, GNOME, <code>./configure --prefix=/opt/gtk --enable-static --enable-shared --disable-scrollkeeper --disable-xlib</code> (note the --enable-static here)</li>
+
Select "[4] start shell", apply the patch, exit the shell, and select "[1]" rerun configure'''.
  <li>OpenSP, http://sourceforge.net/projects/openjade, (Don't bother with OpenJade, it's NOT required and can be a pain to build)<code>./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-doc-build</code></li>
+
 
  <li>libofx, http://libofx.sourceforge.net, <code>./configure --prefix=/opt/gtk --disable-static --enable-shared --with-opensp-includes=/opt/gtk/include/OpenSP --with-opensp-libs=/opt/gtk/lib/</code></li>
+
Here's the patch:
  <li>popt, http://rpm.net.in/mirror/rpm-4.4.x, <code>./configure --prefix=/opt/gtk --disable-static --enable-shared</code></li>
 
  <li>audiofile, GNOME, <code>./configure --prefix=/opt/gtk --disable-static --enable-shared</code></li>
 
  <li>esound, GNOME, <code>./configure --prefix=/opt/gtk --disable-static --enable-shared</code></li>
 
  <li>dbus and dbus-glib, http://www.freedesktop.org/wiki/Software/dbus/, for each one: <code>./configure --prefix=/opt/gtk --disable-static --enable-shared </code></li>
 
  <li>libart_lgpl, GNOME, standard configure (Jan 2008)</li>
 
  <li>libglade, GNOME, standard configure (Jan 2008)</li>
 
  <li>libgnomecanvas, GNOME, standard configure (Jan 2008)</li>
 
  <li>gnome-mime-data, gnome-vfs, libbonobo, libgnome, libbonoboui,  from GNOME, standard configure for each one.</li>
 
  <li>libgpg-error and libgcrypt, http://www.gnupg.org/download/index.en.html, standard configure. (Jan 2008)</li>
 
  <li>libtasn1, http://josefsson.org/gnutls/releases/libtasn1/, standard configure (Jan 2008)</li>
 
  <li>gnome-keyring, GNOME, standard configure</li>
 
  <li>Download and extract libgnomeui from GNOME<br>Under 2.18 the following was necessary:<br> In the libgnomeui directory: Comment out the following section of the configure script at line 23836:
 
 
<pre>
 
<pre>
#    if test x$GNOME_HAVE_X11 != xyes ; then
+
--- configure  2008-05-31 16:07:04.000000000 -0700
#        { { echo "$as_me:$LINENO: error: libX11 not found" >&5
+
+++ configure  2008-04-27 03:21:24.000000000 -0700
#echo "$as_me: error: libX11 not found" >&2;}
+
@@ -23798,7 +23798,7 @@
{ (exit 1); exit 1; }; }
+
# These are unavailable on windows/mingw32
#    fi
+
 +
 +
-for ac_header in X11/Xlib.h glob.h
 +
+for ac_header in glob.h
 +
do
 +
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 +
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
 
</pre>
 
</pre>
comment out line 845 of libgnomeui/gnome-ui-init.c:
+
 
 +
 
 +
==Running from the commandline==
 +
There's a few more things to fix before we can run GnuCash. GnuCash uses dbus to find its configuration data. First we need to fix up dbus's config file. Open $PREFIX/etc/dbus-1/session.conf in your editor. Quite near the top you'll see a line that looks something like
 
<pre>
 
<pre>
        /* XUngrabServer (GDK_DISPLAY ()); */
+
<listen>unix:tmpdir=/var/folders/8Z/8ZMrxptP2RW3+U+8ZNMZY++++TI/-Tmp-/</listen>
 
</pre>
 
</pre>
But it wasn't for 2.21. <br>
+
That's a perfectly valid temp directory... but dbus itself can't handle those +s, so change the spec to <code>unix:tmpdir=$PREFIX/tmp</code> and save the file.  
<code>./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib --without-x</code>, and make and make install.
+
 
  </li>
+
:Run <tt>$PREFIX/bin/dbus-uuidgen --ensure=$PREFIX/var/lib/dbus/machine-id</tt>
  <li>libgnomecups, SOURCES/libgnomecups, standard configure</li>
+
 
  <li>Download and extract libgnomeprint-2.18.0 from GNOME<br>Then, in the libgnomeprint directory, edit configure: You need the following line just after the "GLIB_GENMARSHAL" block; it was missing altogether in 2.18.1, and was just <code>LIBM=</code> in 2.18.3.
+
:Rename <code>$PREFIX/lib/libjpeg.dylib, $PREFIX/lib/libtiff.dylib</code>, and <code>$PREFIX/lib/libpng.dylib</code> to something else (I use names like <code>$PREFIX/lib/libjpeg.dylib.hidden</code>).
 +
 
 +
:Replace <code>$PREFIX/bin/gnucash</code> with the code from [[#GnuCash Start Script (commandline)]].
 +
 
 +
Now you're ready to try it out:
 +
<tt>
 +
$> $PREFIX/bin/gnucash
 +
</tt>
 +
 
 +
==Making a Bundle==
 +
So far so good, but you don't really want to have to open a Terminal window every time you want to use GnuCash, now do you? Of course not. You want a nice icon in your Applications folder (and maybe in the Dock) to click on when you run GnuCash. Here's how to do this:
 +
 
 +
:Install the bundler from http://developer.imendio.com/projects/gtk-macosx/creating-app-bundles.
 +
:I like to create a subfolder called gnucash-bundler and keep everything in there, but you don't have to.
 +
:Paste the contents of [[#GnuCash Bundle Description]] into a file called "gnucash.bundle", [[#Gnucash Info.Plist]] into "Info.Plist", and [[#Gnucash Start Script (Bundler)]] into "gnucash-launcher", all in the same folder.
 +
:Look through both files and adjust the paths to match your installation.
 +
:make gnucash-launcher executable (<tt>chmod +x gnucash-launcher</tt>)
 +
:execute <tt>jhbuild shell</tt> to set up the environment for the bundler
 +
:while in the shell, execute <tt> ige-mac-bundler gnucash.bundle</tt>.
 +
 
 +
And your bundle should be ready to go.
 +
Try <tt>GnuCash.app/Contents/MacOSX/GnuCash</tt> from the command-line so that you can see any error messages. If that works, try <tt>open GnuCash.app</tt>. If that works, then you can move GnuCash.app to your Applications folder and it's ready to use.
 +
 
 +
==Files==
 +
===Customize jhbuildrc===
 +
Paste this into .jhbuildrc-custom in your home folder:
 
<pre>
 
<pre>
  LIBM=" "
+
# -*- mode: python -*-
 +
 
 +
#You can override the build and install directories by uncommenting
 +
#and editing the next two lines. Be sure to create these directories
 +
#and change their ownership to you before you try to build!
 +
#checkoutroot = '/usr/local/src/gnome'
 +
#prefix = '/usr/local/gtk'
 +
 
 +
autogenargs='--disable-static --enable-shared --disable-gtk-doc --disable-docs --disable-scrollkeeper --disable-xlib'
 +
 
 +
module_autogenargs={}
 +
module_autogenargs["gconf"]="--enable-static --enable-shared --disable-scrollkeeper --disable-xlib"
 +
module_autogenargs["libofx"]="--with-opensp-includes=" + prefix + "/include/OpenSP --with-opensp-libs=" + prefix + "/lib"
 +
module_autogenargs["libgnomeui"]="--disable-static --enable-shared --disable-scrollkeeper --disable-xlib --without-x"
 +
 
 +
module_makeargs = {}
 +
module_makeargs["perl-xml-parser"]="EXPATLIBPATH=" + prefix + "/lib EXPATINCPATH=${prefix}/include "
 +
 
 +
 
 +
path = prefix + '/bin/install-check'
 +
if os.path.exists(path):
 +
    os.environ['INSTALL'] = path
 +
#Comment this out if you want to build with your default sdk; make a
 +
#similar function (it's in .jhbuildrc) if you want to set a different
 +
#sdk altogether.
 +
#setup_sdk_10_4()
 +
 
 +
 
 +
moduleset = os.path.expanduser("~/gnucash.modules")
 +
 
 +
modules = ['meta-gtk-osx-bootstrap', 'meta-gtk-osx-core', 'meta-gtk-osx-freetype', 'gnucash']
 +
 
 +
build_policy = "updated-deps"
 
</pre>
 
</pre>
And then <code>./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib --disable-gtk-doc</code>.<br>
+
 
Next you need to change line 945 of libgnomeprint/Makefile from:
+
===Gnucash Moduleset===
 +
Paste the following into a file named gnucash.modules in your home folder:
 
<pre>
 
<pre>
$(FLEX_PATH) -P_gnome_print_filter_parse_yy $^
+
<?xml version="1.0" encoding="utf-8"?>
 +
<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
 +
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
 +
<moduleset>
 +
  <repository type="svn" name="svn.gnome.org" default="yes"
 +
      href="http://svn.gnome.org/svn/"/>
 +
  <repository type="tarball" name="kernel.org"
 +
      href="http://www.kernel.org/pub/linux/"/>
 +
  <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="cvs" name="slib.savannah.gnu.org"
 +
      cvsroot=":pserver:anonymous@cvs.savannah.gnu.org:/sources/slib"
 +
      password=""/>
 +
  <repository type="tarball" name="gnucash.org"
 +
      href="http://www.gnucash.org/pub/gnucash/sources/stable/"/>
 +
 
 +
 
 +
 
 +
  <include
 +
      href="http://people.imendio.com/richard/gtk-osx-build/modulesets/gtk-osx.modules"/>
 +
 
 +
 
 +
  <tarball id='readline' autogen-sh='configure'>
 +
    <source href='ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz'/>
 +
      <patches>
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-001' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-002' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-003' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-004' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-005' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-006' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-007' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-008' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-009' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-010' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-011' strip='2' />
 +
<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-012' strip='2' />
 +
      </patches>
 +
  </tarball>
 +
 
 +
  <autotools id="OpenSP" autogen-sh='configure'
 +
    autogenargs="--disable-static --enable-shared --disable-doc-build">
 +
    <branch repo="sourceforge" module="openjade/OpenSP-1.5.2.tar.gz"
 +
    version='1.5.2'/>>
 +
  </autotools>
 +
 
 +
  <autotools id="libofx" autogen-sh='configure'>
 +
    <branch repo="sourceforge" module="libofx/libofx-0.9.0.tar.gz"
 +
    version='0.9.0'/>
 +
    <dependencies>
 +
      <dep package='guile-1.6'/>
 +
      <dep package="OpenSP"/>
 +
    </dependencies>
 +
  </autotools>
 +
 
 +
  <autotools id="guile-1.6" autogen-sh="configure"
 +
    autogenargs="--disable-static --enable-shared
 +
  --disable-scrollkeeper --disable-xlib">
 +
    <branch repo="ftp.gnu.org" module="guile/guile-1.6.8.tar.gz"
 +
    version="1.6.7" size="3114052" />
 +
    <dependencies>
 +
      <dep package='readline'/>
 +
    </dependencies>
 +
  </autotools>
 +
 
 +
  <autotools id="Slib" skip-autogen="true">
 +
    <branch repo="slib.savannah.gnu.org"
 +
    module="slib"/>
 +
    <dependencies>
 +
      <dep package="guile-1.6"/>
 +
    </dependencies>
 +
  </autotools>
 +
 
 +
  <autotools id="gnucash" autogen-sh="configure"
 +
    autogenargs="--enable-ofx">
 +
    <branch module="gnucash-2.2.5.tar.gz" version="2.2.5"
 +
    repo="gnucash.org"/>
 +
 +
    <dependencies>
 +
      <dep package="goffice"/>
 +
      <dep package="libofx"/>
 +
      <dep package="gtkhtml"/>
 +
      <dep package="Slib"/>
 +
    </dependencies>
 +
 
 +
  </autotools>
 +
 
 +
</moduleset>
 
</pre>
 
</pre>
to
+
 
 +
===GnuCash Start Script (commandline)===
 +
Replace $PREFIX/bin/gnucash with this:
 
<pre>
 
<pre>
$(FLEX_PATH) -P_gnome_print_filter_parse_yy parse.l
+
PREFIX="~/gtk/inst/" #You'll have to fix this up if you changed it
</pre> and finally do make and make install. </li>
+
export PREFIX
  <li>libgsf, SOURCES/libgsf, standard configure</li>
+
PATH="$PREFIX/bin:${PATH}"
  <li>pcre, ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, <code>./configure --prefix=/opt/gtk --disable-static --enable-shared --enable-utf8</code></li>
+
export PATH
  <li>libgoffice, SOURCES/goffice, standard configure</li>
+
 
  <li>icon-naming-utils, http://tango.freedesktop.org/Tango_Icon_Library (Jan 2008)</li>
+
GUILE_WARN_DEPRECATED="no"
  <li>gnome-icon-theme, SOURCES/gnome-icon-theme, standard configure (Jan 2008)</li>
+
export GUILE_WARN_DEPRECATED
  <li>Download and extract gtkhtml from SOURCES/gtkhtml<br>Then, execute the configure command <code>GAIL_CFLAGS=" " GAIL_LIBS=" " ./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-xlib</code>;
+
 
The following was required for 3.15 but not for 3.17.90:
+
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
<ul>
+
    eval `dbus-launch --sh-syntax --exit-with-session --config-file=$PREFIX/etc/dbus-1/session.conf`
<li>Delete line 260 of Makefile:
+
fi
<pre>
+
 
a11y \
+
GNC_MODULE_PATH="$PREFIX/lib/gnucash:${GNC_MODULE_PATH}"
</pre></li>
+
 
<li>Delete ../a11y/gtkhtml-a11y.la from line 66 of src/Makefile, yielding
+
EXTRA_PATH="${EXTRA_PATH}:$PREFIX/share/gnucash/guile-modules"
<pre>
+
EXTRA_PATH="${EXTRA_PATH}:$PREFIX/share/gnucash/scm"
$(am__DEPENDENCIES_1) \
+
GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"
</pre></li>
 
<li>Delete ../a11y/gtkhtml-a11y.la from line 569 of src/Makefile, yielding
 
<pre>
 
libgtkhtml_3_14_la_LIBADD = $(GTKHTML_LIBS) $(GAIL_LIBS) $(REGEX_LIBS)
 
</pre></li>
 
<li>Comment out line 3170 of src/gtkhtml.c:
 
<pre>
 
/* gtk_html_accessibility_init ();  */
 
</pre> and finally make and make install.</li></ul></li>
 
</ol>
 
  
<p>Note: While building the various gnome libraries I (jralls) encountered numerous uses of G_GNUC_FUNCTION and G_GNUC_PRETTY_FUNCTION. These should be replaced with __FUNCTION__ and __PRETTY_FUNCTION__; the original defines are in glib-2.0/glib/gmacros.h (which define them as empty for gcc 3.0 and later), but there isn't always an include chain leading back there.</p>
+
EXTRA_LIBS="${GNC_MODULE_PATH}"
 +
EXTRA_LIBS="${EXTRA_LIBS}:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/"
 +
EXTRA_LIBS="${EXTRA_LIBS}:$PREFIX/lib"
 +
EXTRA_LIBS="${EXTRA_LIBS}:$PREFIX/lib/gnucash"
  
=== GnuCash ===
+
LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
 +
DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"
  
Finally you're ready for GnuCash itself: Downloaded and extract gnucash from gnucash.org.
+
export GNC_MODULE_PATH
 +
export GUILE_LOAD_PATH
 +
export LD_LIBRARY_PATH
 +
export DYLD_LIBRARY_PATH
  
Edit configure and replace:
+
exec gnucash-bin "$@"
<pre>
 
-for ac_header in X11/Xlib.h glob.h
 
+for ac_header in glob.h
 
 
</pre>
 
</pre>
Where this line is will depend on what version of gnucash you have.
+
===Gnucash Start Script (Bundler)===
The original version of this page suggested defining the environment variable
+
If you're going to use the bundler, paste this file into your bundle directory named gnucash-launcher; to run from the command line, put this in $PREFIX/bin/gnucash.
 
<pre>
 
<pre>
  SCHEME_LIBRARY_PATH=/opt/gtk/share/guile/1.6/slib
+
#!/bin/sh
 +
 
 +
if test "x$IGE_DEBUG_LAUNCHER" != x; then
 +
    set -x
 +
fi
 +
 
 +
if test "x$IGE_DEBUG_GDB" != x; then
 +
    EXEC="gdb --args"
 +
else
 +
    EXEC=exec
 +
fi
 +
 
 +
name="`basename $0`"
 +
tmp="`pwd`/$0"
 +
tmp=`dirname "$tmp"`
 +
tmp=`dirname "$tmp"`
 +
bundle=`dirname "$tmp"`
 +
bundle_contents="$bundle"/Contents
 +
bundle_res="$bundle_contents"/Resources
 +
bundle_lib="$bundle_res"/lib
 +
bundle_bin="$bundle_res"/bin
 +
bundle_data="$bundle_res"/share
 +
bundle_etc="$bundle_res"/etc
 +
 
 +
export DYLD_LIBRARY_PATH="$bundle_lib"
 +
export XDG_CONFIG_DIRS="$bundle_etc"/xdg
 +
export XDG_DATA_DIRS="$bundle_data"
 +
export GTK_DATA_PREFIX="$bundle_data"
 +
export GTK_EXE_PREFIX="$bundle_res"
 +
export GTK_PATH="$bundle_res"
 +
 
 +
export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
 +
export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
 +
export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
 +
export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
 +
 
 +
# We need a UTF-8 locale.
 +
export LANG="`grep \`defaults read .GlobalPreferences AppleCollationOrder 2>&1\`_ /usr/share/locale/locale.alias  | tail -n1 | sed 's/\./ /' | awk '{print $2}'`.UTF-8"
 +
 
 +
if test -f "$bundle_lib/charset.alias"; then
 +
    export CHARSETALIASDIR="$bundle_lib"
 +
fi
 +
 
 +
# Extra arguments can be added in environment.sh.
 +
EXTRA_ARGS="--config-path $bundle_etc/gnucash --share-path $bundle_data/gnucash --debug"
 +
 
 +
if test -f "$bundle_res/environment.sh"; then
 +
  source "$bundle_res/environment.sh"
 +
fi
 +
 
 +
# Strip out the argument added by the OS.
 +
if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
 +
    shift 1
 +
fi
 +
 
 +
PFX=${bundle_res}
 +
export PFX
 +
PATH="${PFX}/bin:${PATH}"
 +
export PATH
 +
 
 +
GUILE_WARN_DEPRECATED="no"
 +
export GUILE_WARN_DEPRECATED
 +
 
 +
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
 +
    eval `dbus-launch --sh-syntax --exit-with-session --config-file=$bundle_res/etc/dbus-1/session.conf`
 +
fi
 +
 
 +
GNC_MODULE_PATH="${PFX}/lib/gnucash:${GNC_MODULE_PATH}"
 +
 
 +
EXTRA_PATH="${EXTRA_PATH}:${PFX}/share/gnucash/guile-modules"
 +
EXTRA_PATH="${EXTRA_PATH}:${PFX}/share/gnucash/scm"
 +
GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"
 +
 
 +
EXTRA_LIBS="${GNC_MODULE_PATH}"
 +
EXTRA_LIBS="${EXTRA_LIBS}:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/"
 +
EXTRA_LIBS="${EXTRA_LIBS}:${PFX}/lib"
 +
EXTRA_LIBS="${EXTRA_LIBS}:${PFX}/lib/gnucash"
 +
 
 +
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EXTRA_LIBS}:"
 +
DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${EXTRA_LIBS}"
 +
 
 +
export GNC_MODULE_PATH
 +
export GUILE_LOAD_PATH
 +
export LD_LIBRARY_PATH
 +
export DYLD_LIBRARY_PATH
 +
 
 +
$EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS
 
</pre>
 
</pre>
but this isn't necessary if that's where you put (or linked) slib. If you put it somewhere else then you will need to define and export SCHEME_LIBRARY_PATH pointing to the slib directory.
+
 
For building gnucash 2.2.3 under Leopard, I made the following changes before building:
+
===GnuCash Info.Plist===
<ol>
+
This is the Info.Plist required of all App Bundles. Paste into "Info.Plist" in the bundle directory.
<li>In src/engine/SplitP.h,
 
 
<pre>
 
<pre>
@@ -149,7 +149,7 @@
+
<?xml version="1.0" encoding="UTF-8"?>
Split * xaccSplitClone (const Split *s);
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+
<plist version="1.0">
Split *xaccDupeSplit (const Split *s);
+
<dict>
-G_INLINE_FUNC void mark_split (Split *s);
+
<key>CFBundleDevelopmentRegion</key>
+void mark_split (Split *s);
+
<string>English</string>
+
<key>CFBundleExecutable</key>
void xaccSplitVoid(Split *split);
+
<string>GnuCash</string>
void xaccSplitUnvoid(Split *split);
+
<key>CFBundleGetInfoString</key>
 +
<string>GnuCash version 2.2.5 © 2007 Free Software Foundation</string>
 +
<key>CFBundleIconFile</key>
 +
<string>gnucash.icns</string>
 +
<key>CFBundleIdentifier</key>
 +
<string>org.gnucash.GnuCash</string>
 +
<key>CFBundleInfoDictionaryVersion</key>
 +
<string>6.0</string>
 +
<key>CFBundleLongVersionString</key>
 +
<string>2.2.5 © 2007 Free Software Foundation</string>
 +
<key>CFBundleName</key>
 +
<string>GnuCash</string>
 +
<key>CFBundlePackageType</key>
 +
<string>APPL</string>
 +
<key>CFBundleShortVersionString</key>
 +
<string>2.2.5</string>
 +
<key>CFBundleSignature</key>
 +
<string>????</string>
 +
<key>CFBundleVersion</key>
 +
<string>2.2.5</string>
 +
<key>CSResourcesFileMapped</key>
 +
<true/>
 +
<key>LSRequiresCarbon</key>
 +
<true/>
 +
<key>NSHumanReadableCopyright</key>
 +
<string>Copyright 2007 Free Software Foundation</string>
 +
</dict>
 +
</plist>
 +
 
 
</pre>
 
</pre>
Needed because gcc-4.0.2 in Leopard inlines this into Split.c, but not into Transaction.c -- nor does it create a function in the library, leading to a link error (symbol not found: _mark_split)</li>
 
  
<li>In src/bin/gnucash.in,
+
===GnuCash Bundle Description===
 +
This one configures the bundler to create the app bundle. Paste it into the bundler directory and name it 'gnucash.bundle':
 
<pre>
 
<pre>
@@ -12,9 +12,10 @@
+
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
EXTRA_PATH="${EXTRA_PATH}@-PATH_SEPARATOR-@@-GNC_SCM_INSTALL_DIR-@"
+
<app-bundle>
GUILE_LOAD_PATH="${EXTRA_PATH}@-PATH_SEPARATOR-@${GUILE_LOAD_PATH}"
+
 
+
  <meta>
-EXTRA_LIBS="${GNC_MODULE_PATH}"
+
    <!-- Where to pick up the GTK+ installation, icon themes,
-EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-GNC_LIB_INSTALLDIR-@"
+
        etc. Note that "${env:PREFIX}" is evaluated to the value of
-EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-GNC_PKGLIB_INSTALLDIR-@"
+
        the environment variable PREFIX, and likewise with HOME. You
+EXTRA_LIBS="${GNC_MODULE_PATH}:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/:/usr/local/gtk/lib"
+
        can define additional prefixes and refer to them in paths
+#EXTRA_LIBS="${GNC_MODULE_PATH}"
+
        throughout this file on the form "${prefix:name}". This is
+#EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-GNC_LIB_INSTALLDIR-@"
+
        useful for installing certain libraries or even the
+#EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-GNC_PKGLIB_INSTALLDIR-@"
+
        application itself separately.
+
    -->
LD_LIBRARY_PATH="${EXTRA_LIBS}@-PATH_SEPARATOR-@${LD_LIBRARY_PATH}"
+
    <prefix name="default">${env:PREFIX}</prefix>
DYLD_LIBRARY_PATH="${EXTRA_LIBS}@-PATH_SEPARATOR-@${DYLD_LIBRARY_PATH}"
+
 
</pre>
+
    <!-- The project directory is the default location of the created
 +
        app. If you leave out the path, the current directory is
 +
        used.
 +
    -->
 +
    <destination overwrite="yes">${env:HOME}/gnucash-bundler</destination>
 +
 
 +
    <image>
 +
      <!-- Not implemented yet (DMG image). -->
 +
    </image>
 +
    <run-install-name-tool/>
 +
 
 +
    <!-- Optionally specify a launcher script to use. If the
 +
        application sets up everything needed itself, like
 +
        environment variable, linker paths, etc, a launcher script is
 +
        not needed. If the source path is left out, the default
 +
        script will be used.
 +
    -->
 +
    <launcher-script>${project}/gnucash-launcher</launcher-script>
 +
 
 +
    <!-- Not implemented: Optional runtime, could be python or mono
 +
        for example.
 +
    -->
 +
    <!--runtime copy="yes">/usr/bin/python</runtime-->
 +
  </meta>
 +
 
 +
  <!-- The special macro "${project}" refers to the directory where
 +
      this bundle file is located. The application name and bundle
 +
      identifier are taken from the plist file.
 +
  -->
 +
  <plist>${project}/Info.plist</plist>
 +
 
 +
  <main-binary>${prefix}/bin/gnucash-bin</main-binary>
 +
 
 +
  <!-- Copy in GTK+ and Pango modules. Note the use of the
 +
      "${pkg:module:variable}" macro, which evaluates to a pkg-config
 +
      variable in the specified module. Note that any libraries that
 +
      binaries link to are also copied in automatically.
 +
  -->
 +
  <binary>
 +
    ${prefix}/lib/gtk-2.0/${pkg:gtk+-2.0:gtk_binary_version}/loaders/*.so
 +
  </binary>
 +
  <binary>
 +
    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/pango-basic-fc.so
 +
  </binary>
 +
 
 +
  <binary>
 +
    ${prefix}/lib/GConf/2/*.so
 +
  </binary>
 +
 
 +
  <binary>
 +
    ${prefix}/lib/gnucash
 +
  </binary>
 +
  <binary>
 +
    ${prefix}/libexec
 +
  </binary>
 +
 
 +
  <binary>
 +
    ${prefix}/bin/dbus-launch
 +
  </binary>
 +
 
 +
  <binary>
 +
    ${prefix}/bin/dbus-daemon
 +
  </binary>
 +
 
 +
  <!-- Data to copy in, usually Glade/UI files, images, sounds files
 +
      etc. The destination inside the bundle can be specified if the
 +
      files should end up at a different location, by using the
 +
      "dest" property. The destination must then start with the macro
 +
      "${bundle}", which refers to the bundle root directory.
 +
  -->
 +
  <data>
 +
    ${prefix}/share/gnucash
 +
  </data>
 +
 
 +
  <data>
 +
    ${prefix}/share/guile
 +
  </data>
 +
 
 +
  <data>
 +
    ${prefix}/share/gnome
 +
  </data>
 +
 
 +
  <!--data dest="${bundle}/Contents/Resources/slib"-->
 +
  <data>
 +
    ${prefix}/lib/slib
 +
  </data>
  
This has the same effect as the libextra dance in the original mod above, which is making sure that the ImageIO framework gets access to its own libJPEG.dylib, and that the rest of gnucash can find its gnc and guile libraries.</li></ol>  
+
  <data dest="${bundle}/Contents/Resources">
 +
    ${prefix}/share/gnucash/pixmaps/gnucash.icns
 +
  </data>
  
Now run configure:
+
  <data dest='${bundle}/Contents/Resources/lib/'>
<pre>
+
    ${prefix}/lib/*.la
./configure --prefix=/opt/gtk --disable-static --enable-shared --disable-scrollkeeper --disable-gtk-docs --enable-ofx --disable-xlib
+
  </data>
</pre>  
 
followed by make && make install
 
  
The original version of this page (for gnucash 2.1.1 and Tiger) had the following procedure <em>after</em> installing:
+
  <data dest='${bundle}/Contents/Resources/var/lib/dbus/machine-id'>
<pre>
+
    ${prefix}/var/lib/dbus/machine-id
  mkdir /opt/gtk/libextra
+
  </data>
  cd /opt/gtk/libextra
 
  ln -s ../lib/libgnc* ../lib/libguile* .
 
</pre>
 
Edit /opt/gtk/bin/gnucash as follows:  replace line 20, which is:
 
<pre>
 
DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"
 
</pre>
 
with the following two lines:
 
<pre>
 
DYLD_LIBRARY_PATH="/opt/gtk/lib/gnucash:/opt/gtk/libextra:${DYLD_LIBRARY_PATH}"
 
SCHEME_LIBRARY_PATH=/opt/gtk/share/guile/1.6/slib
 
</pre> and insert the following line:
 
<pre>
 
export SCHEME_LIBRARY_PATH
 
</pre> between:
 
<pre>
 
export DYLD_LIBRARY_PATH
 
</pre> and:
 
<pre>
 
exec gnucash-bin "$@"
 
</pre>
 
  
 +
  <data dest='${bundle}/Contents/Resources/etc/dbus-1/'>
 +
    ${prefix}/etc/dbus-1/
 +
  </data>
  
Now cross your fingers and try running it -- you can execute <code>gnucash</code> from any shell, and the application should come up right within Aqua. One difference in the startup is worth noting here: under X11, a window pops up with a progress bar showing the loading of the data file, and then the main Gnucash screen comes up (with Accounts, etc.) Under Quartz at least at the moment, the progress bar never appears so you just have to be patient while your file is loaded.
 
  
As of January 2008, the splash screen now appears and the progress bar for the file load works.
+
  <!-- Icon themes to copy. The "icons" property can be either of
 +
      "auto", "all", or "none". All or none should be
 +
      self-explanatory, while auto means that the script will try to
 +
      figure out which icons are needed. This is done by getting all
 +
      the strings from all copied binaries, and matching them against
 +
      icon names. To be safe, you should use "all". "none" is useful
 +
      if you want just the index.theme file but no icons, mostly
 +
      needed for the "hicolor" base theme.
 +
  -->
 +
  <!-- icon-theme icons="auto"/>
 +
    Tango
 +
  </icon-theme -->
  
Good luck!
+
</app-bundle>
 +
</pre>

Revision as of 22:42, 8 July 2008

Overview

GnuCash can be built to run more or less natively on OSX -- meaning without X11. Better yet, the build is almost automatic.

To pull this off, you'll need Developer Tools installed. The instructions which follow assume that you're comfortable building programs from the command line and editing text files.

I've succeeded in building this under various incarnations of Leopard while perfecting the modulesets, always on a Mac Pro... but it ought to work on any Mac running Tiger or Leopard.

The default configuration builds in your home folder. On my system, I build in /usr/local/src/gnome and install to /usr/local/gtk. If you want to do that, uncomment the checkoutroot and prefix lines in .jhbuildrc-custom, then create the folders up front and give yourself ownership. If you don't know how to do that, then you should probably leave it the way it is.

Preliminaries

Go to http://developer.imendio.com/projects/gtk-macosx/build-instructions and follow the instructions. Don't run jhbuild build yet!

If you have set $MACOSX_DEPLOYMENT_TARGET to something other than your running version of OSX, you may get an error during jhbuld bootstrap.

You may get an error about $PREFIX/inst/man/man1/cjpeg.1 not existing. What this really means is that install wasn't set to make the directory, so select '[4] start shell" and mkdir -p $PREFIX/inst/man/man1, quit the shell, and select '[1] rerun stage install'.

Paste the code from #Customize jhbuildrc into a file named ".jhbuildrc-custom" in your home folder. Do likewise for #Gnucash Moduleset, with a filename "gnucash.modules".

Building

Once all of the preliminaries are complete, do: $> jhbuild build

You'll get a few errors:

libgnomeprint has a defective configure.ac which fails when libm isn't found. I've filed a bug report (Bug 540837) with a patch, but a similar bug report (Bug 471730) has been sitting for a year, so there's no telling when the developers will get around to fixing this (and libgnomeprint is deprecated anyway). Here's the patch:

--- configure.in        2008-07-03 14:18:44.000000000 -0700
+++ configure.in.mod    2008-07-03 14:17:11.000000000 -0700
@@ -148,9 +148,17 @@
 dnl Checking for libm
 dnl =================================
 AC_CHECK_LIBM
-if test "x$LIBM" = "x"; then
-       AC_MSG_ERROR(You need -lm(mathematic library) for this version of libgnomeprint.)
-fi
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*)
+  if test "x$LIBM" = "x"; then
+       AC_MSG_ERROR(You need -lm(mathematic library) for this version of
+libgnomeprint.)
+  fi
+  ;;
+esac
 LDFLAGS="$LDFLAGS $LIBM"
 
 dnl =================================

Select '[4] start shell', apply the patch (you probably will need to use patch -l) , quit the shell, and select "[6] go to stage configure"

goffice will complain about a misconfiguration of gtk-doc. It doesn't matter, so select "[2] ignore error".

libgnomeui Another configure.in bug (Bug 535958). The patch:

Index: configure.in
===================================================================
--- configure.in        (revision 5608)
+++ configure.in        (working copy)
@@ -116,7 +116,7 @@
     gnome_keyring_requirement="gnome-keyring-1 >= gnome_keyring_required_version"
     GNOME_KEYRING="gnome-keyring-1"

-    if test x$GNOME_HAVE_X11 != xyes ; then
+    if test x$have_x != xdisabled && test x$GNOME_HAVE_X11 != xyes ; then
         AC_MSG_ERROR([libX11 not found])
     fi
     ;;


Select "[4] start shell", apply the patch, quit the shell, and select "[1] rerun configure"

slib will fail because it wants to install to /usr/local, and you'd have to be building with root authority for that to work. We don't want to install there anyway, so select "[4] start shell" and: $> mkdir $PREFIX/lib/slib $> cp *.scm $PREFIX/lib/slib/ $> cp guile.init $PREFIX/lib/slib $> cd $PREFIX/share/guile/1.6/ $> ln -s ../../../lib/slib . $> $PREFIX/bin/guile guile> (use-modules (ice-9 slib)) guile> (require 'new-catalog) guile> (quit) Quit the shell and select "[2] ignore error and continue to done".

You'll have to stop the build (control-c will do it) after the gnucash tarball unpacks to apply the following patch. Make sure to do it before configure finishes! Select "[4] start shell", apply the patch, exit the shell, and select "[1]" rerun configure.

Here's the patch:

--- configure   2008-05-31 16:07:04.000000000 -0700
+++ configure   2008-04-27 03:21:24.000000000 -0700
@@ -23798,7 +23798,7 @@
 # These are unavailable on windows/mingw32
 
 
-for ac_header in X11/Xlib.h glob.h
+for ac_header in glob.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then


Running from the commandline

There's a few more things to fix before we can run GnuCash. GnuCash uses dbus to find its configuration data. First we need to fix up dbus's config file. Open $PREFIX/etc/dbus-1/session.conf in your editor. Quite near the top you'll see a line that looks something like

 <listen>unix:tmpdir=/var/folders/8Z/8ZMrxptP2RW3+U+8ZNMZY++++TI/-Tmp-/</listen>

That's a perfectly valid temp directory... but dbus itself can't handle those +s, so change the spec to unix:tmpdir=$PREFIX/tmp and save the file.

Run $PREFIX/bin/dbus-uuidgen --ensure=$PREFIX/var/lib/dbus/machine-id
Rename $PREFIX/lib/libjpeg.dylib, $PREFIX/lib/libtiff.dylib, and $PREFIX/lib/libpng.dylib to something else (I use names like $PREFIX/lib/libjpeg.dylib.hidden).
Replace $PREFIX/bin/gnucash with the code from #GnuCash Start Script (commandline).

Now you're ready to try it out: $> $PREFIX/bin/gnucash

Making a Bundle

So far so good, but you don't really want to have to open a Terminal window every time you want to use GnuCash, now do you? Of course not. You want a nice icon in your Applications folder (and maybe in the Dock) to click on when you run GnuCash. Here's how to do this:

Install the bundler from http://developer.imendio.com/projects/gtk-macosx/creating-app-bundles.
I like to create a subfolder called gnucash-bundler and keep everything in there, but you don't have to.
Paste the contents of #GnuCash Bundle Description into a file called "gnucash.bundle", #Gnucash Info.Plist into "Info.Plist", and #Gnucash Start Script (Bundler) into "gnucash-launcher", all in the same folder.
Look through both files and adjust the paths to match your installation.
make gnucash-launcher executable (chmod +x gnucash-launcher)
execute jhbuild shell to set up the environment for the bundler
while in the shell, execute ige-mac-bundler gnucash.bundle.

And your bundle should be ready to go. Try GnuCash.app/Contents/MacOSX/GnuCash from the command-line so that you can see any error messages. If that works, try open GnuCash.app. If that works, then you can move GnuCash.app to your Applications folder and it's ready to use.

Files

Customize jhbuildrc

Paste this into .jhbuildrc-custom in your home folder:

# -*- mode: python -*-

#You can override the build and install directories by uncommenting
#and editing the next two lines. Be sure to create these directories
#and change their ownership to you before you try to build!
#checkoutroot = '/usr/local/src/gnome' 
#prefix = '/usr/local/gtk'

autogenargs='--disable-static --enable-shared --disable-gtk-doc --disable-docs --disable-scrollkeeper --disable-xlib'

module_autogenargs={}
module_autogenargs["gconf"]="--enable-static --enable-shared --disable-scrollkeeper --disable-xlib"
module_autogenargs["libofx"]="--with-opensp-includes=" + prefix + "/include/OpenSP --with-opensp-libs=" + prefix + "/lib"
module_autogenargs["libgnomeui"]="--disable-static --enable-shared --disable-scrollkeeper --disable-xlib --without-x"

module_makeargs = {}
module_makeargs["perl-xml-parser"]="EXPATLIBPATH=" + prefix + "/lib EXPATINCPATH=${prefix}/include "


path = prefix + '/bin/install-check'
if os.path.exists(path):
    os.environ['INSTALL'] = path
#Comment this out if you want to build with your default sdk; make a
#similar function (it's in .jhbuildrc) if you want to set a different
#sdk altogether. 
#setup_sdk_10_4()


moduleset = os.path.expanduser("~/gnucash.modules")

modules = ['meta-gtk-osx-bootstrap', 'meta-gtk-osx-core', 'meta-gtk-osx-freetype', 'gnucash']

build_policy = "updated-deps"

Gnucash Moduleset

Paste the following into a file named gnucash.modules in your home folder:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
  <repository type="svn" name="svn.gnome.org" default="yes" 
	      href="http://svn.gnome.org/svn/"/>
  <repository type="tarball" name="kernel.org"
      href="http://www.kernel.org/pub/linux/"/>
  <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="cvs" name="slib.savannah.gnu.org"
	      cvsroot=":pserver:anonymous@cvs.savannah.gnu.org:/sources/slib"
	      password=""/>
  <repository type="tarball" name="gnucash.org"
	      href="http://www.gnucash.org/pub/gnucash/sources/stable/"/>



  <include 
      href="http://people.imendio.com/richard/gtk-osx-build/modulesets/gtk-osx.modules"/>


  <tarball id='readline' autogen-sh='configure'>
    <source href='ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz'/>
      <patches>
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-001' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-002' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-003' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-004' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-005' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-006' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-007' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-008' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-009' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-010' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-011' strip='2' />
	<patch file='ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-012' strip='2' />
      </patches>
  </tarball>

  <autotools id="OpenSP" autogen-sh='configure'
	     autogenargs="--disable-static --enable-shared --disable-doc-build">
    <branch repo="sourceforge" module="openjade/OpenSP-1.5.2.tar.gz" 
	    version='1.5.2'/>>
  </autotools>

  <autotools id="libofx" autogen-sh='configure'>
    <branch repo="sourceforge" module="libofx/libofx-0.9.0.tar.gz"
	    version='0.9.0'/>
    <dependencies>
      <dep package='guile-1.6'/>
      <dep package="OpenSP"/>
    </dependencies>
  </autotools>

  <autotools id="guile-1.6" autogen-sh="configure"
	     autogenargs="--disable-static --enable-shared 
			  --disable-scrollkeeper --disable-xlib">
    <branch repo="ftp.gnu.org" module="guile/guile-1.6.8.tar.gz" 
	    version="1.6.7" size="3114052" />
    <dependencies>
      <dep package='readline'/>
    </dependencies>
  </autotools>

  <autotools id="Slib" skip-autogen="true">
    <branch repo="slib.savannah.gnu.org"
	    module="slib"/>
    <dependencies>
      <dep package="guile-1.6"/>
    </dependencies>
  </autotools>

  <autotools id="gnucash" autogen-sh="configure"
	     autogenargs="--enable-ofx">
    <branch module="gnucash-2.2.5.tar.gz" version="2.2.5"
	    repo="gnucash.org"/>
	
    <dependencies>
      <dep package="goffice"/>
      <dep package="libofx"/>
      <dep package="gtkhtml"/>
      <dep package="Slib"/>
    </dependencies>

  </autotools>

</moduleset>

GnuCash Start Script (commandline)

Replace $PREFIX/bin/gnucash with this:

PREFIX="~/gtk/inst/" #You'll have to fix this up if you changed it
export PREFIX
PATH="$PREFIX/bin:${PATH}"
export PATH

GUILE_WARN_DEPRECATED="no"
export GUILE_WARN_DEPRECATED

if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
    eval `dbus-launch --sh-syntax --exit-with-session --config-file=$PREFIX/etc/dbus-1/session.conf`
fi

GNC_MODULE_PATH="$PREFIX/lib/gnucash:${GNC_MODULE_PATH}"

EXTRA_PATH="${EXTRA_PATH}:$PREFIX/share/gnucash/guile-modules"
EXTRA_PATH="${EXTRA_PATH}:$PREFIX/share/gnucash/scm"
GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"

EXTRA_LIBS="${GNC_MODULE_PATH}"
EXTRA_LIBS="${EXTRA_LIBS}:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/"
EXTRA_LIBS="${EXTRA_LIBS}:$PREFIX/lib"
EXTRA_LIBS="${EXTRA_LIBS}:$PREFIX/lib/gnucash"

LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"

export GNC_MODULE_PATH
export GUILE_LOAD_PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH

exec gnucash-bin "$@"

Gnucash Start Script (Bundler)

If you're going to use the bundler, paste this file into your bundle directory named gnucash-launcher; to run from the command line, put this in $PREFIX/bin/gnucash.

#!/bin/sh

if test "x$IGE_DEBUG_LAUNCHER" != x; then
    set -x
fi

if test "x$IGE_DEBUG_GDB" != x; then
    EXEC="gdb --args"
else
    EXEC=exec
fi

name="`basename $0`"
tmp="`pwd`/$0"
tmp=`dirname "$tmp"`
tmp=`dirname "$tmp"`
bundle=`dirname "$tmp"`
bundle_contents="$bundle"/Contents
bundle_res="$bundle_contents"/Resources
bundle_lib="$bundle_res"/lib
bundle_bin="$bundle_res"/bin
bundle_data="$bundle_res"/share
bundle_etc="$bundle_res"/etc

export DYLD_LIBRARY_PATH="$bundle_lib"
export XDG_CONFIG_DIRS="$bundle_etc"/xdg
export XDG_DATA_DIRS="$bundle_data"
export GTK_DATA_PREFIX="$bundle_data"
export GTK_EXE_PREFIX="$bundle_res"
export GTK_PATH="$bundle_res"

export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
export PANGO_RC_FILE="$bundle_etc/pango/pangorc"

# We need a UTF-8 locale.
export LANG="`grep \`defaults read .GlobalPreferences AppleCollationOrder 2>&1\`_ /usr/share/locale/locale.alias  | tail -n1 | sed 's/\./ /' | awk '{print $2}'`.UTF-8"

if test -f "$bundle_lib/charset.alias"; then
    export CHARSETALIASDIR="$bundle_lib"
fi

# Extra arguments can be added in environment.sh.
EXTRA_ARGS="--config-path $bundle_etc/gnucash --share-path $bundle_data/gnucash --debug"

if test -f "$bundle_res/environment.sh"; then
  source "$bundle_res/environment.sh"
fi

# Strip out the argument added by the OS.
if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
    shift 1
fi

PFX=${bundle_res}
export PFX
PATH="${PFX}/bin:${PATH}"
export PATH

GUILE_WARN_DEPRECATED="no"
export GUILE_WARN_DEPRECATED

if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
    eval `dbus-launch --sh-syntax --exit-with-session --config-file=$bundle_res/etc/dbus-1/session.conf`
fi

GNC_MODULE_PATH="${PFX}/lib/gnucash:${GNC_MODULE_PATH}"

EXTRA_PATH="${EXTRA_PATH}:${PFX}/share/gnucash/guile-modules"
EXTRA_PATH="${EXTRA_PATH}:${PFX}/share/gnucash/scm"
GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"

EXTRA_LIBS="${GNC_MODULE_PATH}"
EXTRA_LIBS="${EXTRA_LIBS}:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/"
EXTRA_LIBS="${EXTRA_LIBS}:${PFX}/lib"
EXTRA_LIBS="${EXTRA_LIBS}:${PFX}/lib/gnucash"

LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EXTRA_LIBS}:"
DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${EXTRA_LIBS}"

export GNC_MODULE_PATH
export GUILE_LOAD_PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH

$EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS

GnuCash Info.Plist

This is the Info.Plist required of all App Bundles. Paste into "Info.Plist" in the bundle directory.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>GnuCash</string>
	<key>CFBundleGetInfoString</key>
	<string>GnuCash version 2.2.5 © 2007 Free Software Foundation</string>
	<key>CFBundleIconFile</key>
	<string>gnucash.icns</string>
	<key>CFBundleIdentifier</key>
	<string>org.gnucash.GnuCash</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleLongVersionString</key>
	<string>2.2.5 © 2007 Free Software Foundation</string>
	<key>CFBundleName</key>
	<string>GnuCash</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>2.2.5</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>2.2.5</string>
	<key>CSResourcesFileMapped</key>
	<true/>
	<key>LSRequiresCarbon</key>
	<true/>
	<key>NSHumanReadableCopyright</key>
	<string>Copyright 2007 Free Software Foundation</string>
</dict>
</plist>

GnuCash Bundle Description

This one configures the bundler to create the app bundle. Paste it into the bundler directory and name it 'gnucash.bundle':

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<app-bundle>

  <meta>
    <!-- Where to pick up the GTK+ installation, icon themes,
         etc. Note that "${env:PREFIX}" is evaluated to the value of
         the environment variable PREFIX, and likewise with HOME. You
         can define additional prefixes and refer to them in paths
         throughout this file on the form "${prefix:name}". This is
         useful for installing certain libraries or even the
         application itself separately.
    -->
    <prefix name="default">${env:PREFIX}</prefix>

    <!-- The project directory is the default location of the created
         app. If you leave out the path, the current directory is
         used.
    -->
    <destination overwrite="yes">${env:HOME}/gnucash-bundler</destination>

    <image>
      <!-- Not implemented yet (DMG image). -->
    </image>
    <run-install-name-tool/>

    <!-- Optionally specify a launcher script to use. If the
         application sets up everything needed itself, like
         environment variable, linker paths, etc, a launcher script is
         not needed. If the source path is left out, the default
         script will be used.
    -->
    <launcher-script>${project}/gnucash-launcher</launcher-script>

    <!-- Not implemented: Optional runtime, could be python or mono
         for example.
    -->
    <!--runtime copy="yes">/usr/bin/python</runtime-->
  </meta>

  <!-- The special macro "${project}" refers to the directory where
       this bundle file is located. The application name and bundle
       identifier are taken from the plist file.
  -->
  <plist>${project}/Info.plist</plist>

  <main-binary>${prefix}/bin/gnucash-bin</main-binary>

  <!-- Copy in GTK+ and Pango modules. Note the use of the
       "${pkg:module:variable}" macro, which evaluates to a pkg-config
       variable in the specified module. Note that any libraries that
       binaries link to are also copied in automatically. 
  -->
  <binary>
    ${prefix}/lib/gtk-2.0/${pkg:gtk+-2.0:gtk_binary_version}/loaders/*.so
  </binary>
  <binary>
    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/pango-basic-fc.so
  </binary>

  <binary>
    ${prefix}/lib/GConf/2/*.so
  </binary>

  <binary>
    ${prefix}/lib/gnucash
  </binary>
  <binary>
    ${prefix}/libexec
  </binary>

  <binary>
    ${prefix}/bin/dbus-launch
  </binary>

  <binary>
    ${prefix}/bin/dbus-daemon
  </binary>

  <!-- Data to copy in, usually Glade/UI files, images, sounds files
       etc. The destination inside the bundle can be specified if the
       files should end up at a different location, by using the
       "dest" property. The destination must then start with the macro
       "${bundle}", which refers to the bundle root directory.
  -->
  <data>
    ${prefix}/share/gnucash
  </data>

  <data>
    ${prefix}/share/guile
  </data>

  <data>
    ${prefix}/share/gnome
  </data>

  <!--data dest="${bundle}/Contents/Resources/slib"-->
  <data>
    ${prefix}/lib/slib
  </data>

  <data dest="${bundle}/Contents/Resources">
    ${prefix}/share/gnucash/pixmaps/gnucash.icns
  </data>

  <data dest='${bundle}/Contents/Resources/lib/'>
    ${prefix}/lib/*.la
  </data>

  <data dest='${bundle}/Contents/Resources/var/lib/dbus/machine-id'>
    ${prefix}/var/lib/dbus/machine-id
  </data>

  <data dest='${bundle}/Contents/Resources/etc/dbus-1/'>
    ${prefix}/etc/dbus-1/
  </data>


  <!-- Icon themes to copy. The "icons" property can be either of
       "auto", "all", or "none". All or none should be
       self-explanatory, while auto means that the script will try to
       figure out which icons are needed. This is done by getting all
       the strings from all copied binaries, and matching them against
       icon names. To be safe, you should use "all". "none" is useful
       if you want just the index.theme file but no icons, mostly
       needed for the "hicolor" base theme.
  -->
  <!-- icon-theme icons="auto"/>
    Tango
  </icon-theme -->

</app-bundle>