notmuch 0.9~rc1 install on OS X Lion using homebrew

Toni Janz toni at forlackofawittyname.com
Sun Oct 2 14:29:55 PDT 2011


tldr; I got notmuch running on OS X 10.7.1 (Lion) and have posted the
homebrew formulas below.

If you are on OS X and don't know what Homebrew is then http://mxcl.github.com/homebrew/
may be worth your time.

I thought I'd post on this list in the hopes that some other people find
it useful and ends up saving them time.


Short Dependency Version Summary:
talloc: 2.0.7
gmime:  2.4.24
xapian: 1.2.7 
notmuch: 0.9~rc1

The Homebrew formulas for these are below

Talloc caused my problems because OS X can't deal with relative pathing
so I changed the formula to include an "--disable-rpath" to configure.

Gmime caused me problems with homebrew because the current formula in
homebrew git compiles it with "--disable-dependancy-checking" which
leads to the error below.

dyld: Symbol not found: _url_addrspec_end
  Referenced from: /usr/local/Cellar/gmime/2.4.24/lib/libgmime-2.4.2.dylib
  Expected in: flat namespace
 in /usr/local/Cellar/gmime/2.4.24/lib/libgmime-2.4.2.dylib
[1]    66350 trace trap  ./notmuch-shared


The formulas begin below. (I may go ahead and submit them to the
homebrew repo as well, but I figure having this in the mailing archive
shouldn't hurt).

Now, I'm posting it here because "It Works For Me", and "It *might* work
for you"--but, again, YMMV. 


## begin homebrew formula for 0.9~rc1 (current Head and subject to change)
require 'formula'

class Notmuch < Formula
  head 'git://notmuchmail.org/git/notmuch'
  homepage 'http://notmuchmail.org'
  md5 '983cd907a7bf5ee0d12ebfb54cff784f'

  depends_on 'xapian'
  depends_on 'talloc'
  depends_on 'gmime'

  def install
    system "./configure", "--prefix=#{prefix}"

    # notmuch requires a newer emacs than macosx provides. So we either
    # disable the emacs bindings or make notmuch depend on the homebrew
    # emacs package.
    # And there is a race condition in the makefile, so we have to either
    # deparallelize the process or run make and make install separately.

    system "make HAVE_EMACS=0"
    system "make install HAVE_EMACS=0"
  end
end


## Begin homebrew formula for gmime 2.4.24
require 'formula'

class Gmime < Formula
  homepage 'http://spruce.sourceforge.net/gmime/'
  url 'ftp://ftp.gnome.org/pub/GNOME/sources/gmime/2.4/gmime-2.4.24.tar.bz2'
  sha256 'e1255dc565416b65e6f8e7b207074b86d955897169eb19a975e90b34ae660c14'

  depends_on 'pkg-config' => :build
  depends_on 'glib'

  def install
    system "./configure", "--prefix=#{prefix}",
                          "--enable-largefile",
                          "--disable-mono"
    system "make install"
  end
end

## Begin Homebrew formula for talloc
require 'formula'

class Talloc < Formula
  url 'http://www.samba.org/ftp/talloc/talloc-2.0.7.tar.gz'
  homepage 'http://talloc.samba.org/'
  md5 'dbfb3146f4cc47054e13b8a2988299f9'


  def install
    system "./configure", "--prefix=#{prefix}", "--disable-rpath"
    # See https://bugzilla.samba.org/show_bug.cgi?id=7000
    # It seems that the patch included there is not enough
    inreplace 'Makefile', 'SONAMEFLAG = #', 'SONAMEFLAG = -install_name'

    system "make install"
  end
end


## Begin homebrew formula for Xapian
require 'formula'

class XapianBindings < Formula
  url 'http://oligarchy.co.uk/xapian/1.2.7/xapian-bindings-1.2.7.tar.gz'
  homepage 'http://xapian.org'
  md5 '44b83efe4b025c3b5ea3eff4e0f17a9a'
end

class Xapian < Formula
  url 'http://oligarchy.co.uk/xapian/1.2.7/xapian-core-1.2.7.tar.gz'
  homepage 'http://xapian.org'
  md5 '6684eb7a990b9cedf4257f41bfddb584'

  def options
    [
      ["--ruby", "Ruby bindings"],
      ["--python", "Python bindings"],
      ["--php", "PHP bindings"],
      ["--java", "Java bindings"],
    ]
  end

  def skip_clean? path
    path.extname == '.la'
  end

  def build_any_bindings?
    ARGV.include? '--ruby' or ARGV.include? '--python' or ARGV.include? '--java' or ARGV.include? '--php'
  end

  def arg_for_lang lang
    (ARGV.include? "--#{lang}") ? "--with-#{lang}" : "--without-#{lang}"
  end

  def install
    ENV.O3 # takes forever otherwise

    system "./configure", "--prefix=#{prefix}", "--disable-assertions",
                          "--disable-dependency-tracking"
    system "make install"

    if build_any_bindings?
      XapianBindings.new.brew do
        args = [
          "XAPIAN_CONFIG=#{bin}/xapian-config",
          "--prefix=#{prefix}",
          "--disable-debug",
          "--disable-dependency-tracking",
          "--without-csharp",
          "--without-tcl"
        ]

        args << arg_for_lang('ruby')
        args << arg_for_lang('java')

        if ARGV.include? '--python'
          python_lib = lib + "python"
          ENV.append 'PYTHONPATH', python_lib
          python_lib.mkpath
          ENV['OVERRIDE_MACOSX_DEPLOYMENT_TARGET'] = '10.4'
          ENV['PYTHON_LIB'] = "#{python_lib}"
          args << "--with-python"
        else
          args << "--without-python"
        end

        if ARGV.include? '--php'
          extension_dir = lib+'php/extensions'
          extension_dir.mkpath
          args << "--with-php PHP_EXTENSION_DIR=#{extension_dir}"
        else
          args << "--without-php"
        end

        system "./configure", *args
        system "make install"
      end
    end
  end

  def caveats
    s = ""
    if ARGV.include? "--python"
      s += <<-EOS.undent
        The Python bindings won't function until you amend your PYTHONPATH like so:
          export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH
      EOS
    end
  end
end

-- 
 __
(oO) 
/||\...   Toni 



More information about the notmuch mailing list