--- /dev/null
+Return-Path: <felipe.contreras@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1A38A431FD0\r
+ for <notmuch@notmuchmail.org>; Fri, 23 May 2014 03:45:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id gf7BtOAXzUkf for <notmuch@notmuchmail.org>;\r
+ Fri, 23 May 2014 03:45:51 -0700 (PDT)\r
+Received: from mail-ob0-f170.google.com (mail-ob0-f170.google.com\r
+ [209.85.214.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 24939431FC4\r
+ for <notmuch@notmuchmail.org>; Fri, 23 May 2014 03:45:50 -0700 (PDT)\r
+Received: by mail-ob0-f170.google.com with SMTP id uy5so5156871obc.15\r
+ for <notmuch@notmuchmail.org>; Fri, 23 May 2014 03:45:49 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=YOeG9VXKwV0EKaXSe98Kd+vL9DXgloEni278dpjGgzE=;\r
+ b=ynrtrAdU+HeILdItPO4trNHuu/d7UIYqeErtk55lUeI464OnUA1helwq70c7oPsxnT\r
+ BmJbs4CC9PUgTnJN309hef3xSircUDXY36sWUWTkC5YirQPcMYjRILAqgWsj4S62i7mE\r
+ OVVF5kCVDw+362Q0MmUoJNxWBYXrjZhI17mHIDT/x3+6H5kpBIcf/XkCYTYlaQmlfZCR\r
+ VvFFVshwKdjjhyUGDJDC/Nkc1X+l/Qaabzm7ojefJae0Ay+K4rZuptPw++skD6zwRAUn\r
+ hvhA/s6qrBvldg6btPa9UEOT1sD6kYzmsJmqjirupVPUQpgCUVTpq0uorfzfRwVoEngw\r
+ TGAg==\r
+X-Received: by 10.60.92.170 with SMTP id cn10mr1991765oeb.76.1400841949764;\r
+ Fri, 23 May 2014 03:45:49 -0700 (PDT)\r
+Received: from localhost (189-211-224-40.static.axtel.net. [189.211.224.40])\r
+ by mx.google.com with ESMTPSA id\r
+ zv18sm4857197obb.27.2014.05.23.03.45.48 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Fri, 23 May 2014 03:45:49 -0700 (PDT)\r
+From: Felipe Contreras <felipe.contreras@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] build: add support to build Ruby bindings\r
+Date: Fri, 23 May 2014 05:34:26 -0500\r
+Message-Id: <1400841267-12807-3-git-send-email-felipe.contreras@gmail.com>\r
+X-Mailer: git-send-email 1.9.3+fc1~5~gfaddd51\r
+In-Reply-To: <1400841267-12807-1-git-send-email-felipe.contreras@gmail.com>\r
+References: <1400841267-12807-1-git-send-email-felipe.contreras@gmail.com>\r
+Cc: Ali Polatel <alip@exherbo.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 23 May 2014 10:45:55 -0000\r
+\r
+So there's no need for the user to manually do that.\r
+\r
+Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\r
+---\r
+ bindings/ruby/Makefile.local | 21 +++++++++++++++++++++\r
+ bindings/ruby/extconf.rb | 14 ++------------\r
+ configure | 21 +++++++++++++++++++++\r
+ 3 files changed, 44 insertions(+), 12 deletions(-)\r
+ create mode 100644 bindings/ruby/Makefile.local\r
+\r
+diff --git a/bindings/ruby/Makefile.local b/bindings/ruby/Makefile.local\r
+new file mode 100644\r
+index 0000000..8b1837c\r
+--- /dev/null\r
++++ b/bindings/ruby/Makefile.local\r
+@@ -0,0 +1,21 @@\r
++dir := bindings/ruby\r
++\r
++ifeq ($(WITH_RUBY),1)\r
++all: $(dir)/notmuch.so\r
++install: install-ruby\r
++clean: clean-ruby\r
++endif\r
++\r
++$(dir)/Makefile: $(dir)/extconf.rb\r
++ @ruby -C $(dir) extconf.rb --vendor\r
++\r
++$(dir)/notmuch.so: | $(dir)/Makefile lib/libnotmuch.so\r
++ @$(MAKE) -C $(dir) notmuch.so\r
++\r
++install-ruby: | $(dir)/Makefile\r
++ @$(MAKE) -C $(dir) install prefix=$(DESTDIR)/$(prefix)\r
++\r
++clean-ruby: | $(dir)/Makefile\r
++ $(MAKE) -C $(dir) clean\r
++\r
++.PHONY: install-ruby\r
+diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb\r
+index 6160db2..abd67fc 100644\r
+--- a/bindings/ruby/extconf.rb\r
++++ b/bindings/ruby/extconf.rb\r
+@@ -13,18 +13,8 @@ $INCFLAGS = "-I#{dir} #{$INCFLAGS}"\r
+ # make sure there are no undefined symbols\r
+ $LDFLAGS += ' -Wl,--no-undefined'\r
+ \r
+-def have_local_library(lib, path, func, headers = nil)\r
+- checking_for checking_message(func, lib) do\r
+- lib = File.join(path, lib)\r
+- if try_func(func, lib, headers)\r
+- $LOCAL_LIBS += lib\r
+- end\r
+- end\r
+-end\r
+-\r
+-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')\r
+- exit 1\r
+-end\r
++# library\r
++$LOCAL_LIBS += "#{dir}/libnotmuch.so"\r
+ \r
+ # Create Makefile\r
+ dir_config('notmuch')\r
+diff --git a/configure b/configure\r
+index 9bde2eb..3bdf6d7 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -21,6 +21,7 @@ srcdir=$(dirname "$0")\r
+ \r
+ subdirs="util compat lib parse-time-string completion doc emacs"\r
+ subdirs="${subdirs} performance-test test test/test-databases"\r
++subdirs="${subdirs} bindings/ruby"\r
+ \r
+ # For a non-srcdir configure invocation (such as ../configure), create\r
+ # the directory structure and copy Makefiles.\r
+@@ -65,6 +66,7 @@ LIBDIR=\r
+ WITH_EMACS=1\r
+ WITH_BASH=1\r
+ WITH_ZSH=1\r
++WITH_RUBY=1\r
+ \r
+ # Compatible GMime versions (with constraints).\r
+ # If using GMime 2.6, we need to have a version >= 2.6.5 to avoid a\r
+@@ -212,6 +214,14 @@ for option; do\r
+ elif [ "${option#*=}" = '2.6' ]; then\r
+ WITH_GMIME_VERSIONS=$GMIME_26_VERSION\r
+ fi\r
++ elif [ "${option%%=*}" = '--with-ruby' ]; then\r
++ if [ "${option#*=}" = 'no' ]; then\r
++ WITH_RUBY=0\r
++ else\r
++ WITH_RUBY=1\r
++ fi\r
++ elif [ "${option}" = '--without-ruby' ] ; then\r
++ WITH_RUBY=0\r
+ elif [ "${option%%=*}" = '--build' ] ; then\r
+ true\r
+ elif [ "${option%%=*}" = '--host' ] ; then\r
+@@ -383,6 +393,14 @@ else\r
+ WITH_BASH=0\r
+ fi\r
+ \r
++printf "Checking for ruby... "\r
++if pkg-config --exists ruby-2.1; then\r
++ printf "Yes.\n"\r
++else\r
++ printf "No (will not install Ruby bindings).\n"\r
++ WITH_RUBY=0\r
++fi\r
++\r
+ if [ -z "${EMACSLISPDIR}" ]; then\r
+ if pkg-config --exists emacs; then\r
+ EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)\r
+@@ -906,6 +924,9 @@ WITH_BASH = ${WITH_BASH}\r
+ # Support for zsh completion\r
+ WITH_ZSH = ${WITH_ZSH}\r
+ \r
++# Support for Ruby\r
++WITH_RUBY = ${WITH_RUBY}\r
++\r
+ # Combined flags for compiling and linking against all of the above\r
+ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\\r
+ -DHAVE_CANONICALIZE_FILE_NAME=\$(HAVE_CANONICALIZE_FILE_NAME) \\\r
+-- \r
+1.9.3+fc1~5~gfaddd51\r
+\r