[Patch v2 1/4] build: integrate building ruby bindings into notmuch build process
authorDavid Bremner <david@tethera.net>
Fri, 6 Mar 2015 21:57:50 +0000 (22:57 +0100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:16 +0000 (14:48 -0700)
02/c3d26e75846781e55271055213fdb0202e0438 [new file with mode: 0644]

diff --git a/02/c3d26e75846781e55271055213fdb0202e0438 b/02/c3d26e75846781e55271055213fdb0202e0438
new file mode 100644 (file)
index 0000000..9a302ee
--- /dev/null
@@ -0,0 +1,195 @@
+Return-Path: <bremner@tesseract.cs.unb.ca>\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 80AB1431FBC\r
+       for <notmuch@notmuchmail.org>; Fri,  6 Mar 2015 13:59:20 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+       tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 bpSRaYYFulie for <notmuch@notmuchmail.org>;\r
+       Fri,  6 Mar 2015 13:59:20 -0800 (PST)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+       [87.98.215.224])\r
+       (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id DFA9D431FAE\r
+       for <notmuch@notmuchmail.org>; Fri,  6 Mar 2015 13:59:19 -0800 (PST)\r
+Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
+       4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+       id 1YU0GT-0000RN-0u; Fri, 06 Mar 2015 21:58:37 +0000\r
+Received: (nullmailer pid 30535 invoked by uid 1000); Fri, 06 Mar 2015\r
+       21:57:57 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v2 1/4] build: integrate building ruby bindings into notmuch\r
+       build process\r
+Date: Fri,  6 Mar 2015 22:57:50 +0100\r
+Message-Id: <1425679073-30439-2-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1425679073-30439-1-git-send-email-david@tethera.net>\r
+References: <1420114600-28396-6-git-send-email-david@tethera.net>\r
+       <1425679073-30439-1-git-send-email-david@tethera.net>\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, 06 Mar 2015 21:59:20 -0000\r
+\r
+Because ruby generates a Makefile, we have to use recursive make.\r
+Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}\r
+in the parent directory.\r
+---\r
+ Makefile.local          |  2 +-\r
+ bindings/Makefile       |  7 +++++++\r
+ bindings/Makefile.local | 18 ++++++++++++++++++\r
+ bindings/ruby/README    |  8 ++++++++\r
+ configure               | 18 ++++++++++++++++++\r
+ debian/rules            |  1 -\r
+ 6 files changed, 52 insertions(+), 2 deletions(-)\r
+ create mode 100644 bindings/Makefile\r
+ create mode 100644 bindings/Makefile.local\r
+ create mode 100644 bindings/ruby/README\r
+\r
+diff --git a/Makefile.local b/Makefile.local\r
+index 81ee347..7204267 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -59,7 +59,7 @@ endif\r
+ FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)\r
\r
+ .PHONY: all\r
+-all: notmuch notmuch-shared build-man\r
++all: notmuch notmuch-shared build-man ruby-bindings\r
+ ifeq ($(MAKECMDGOALS),)\r
+ ifeq ($(shell cat .first-build-message 2>/dev/null),)\r
+       @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all\r
+diff --git a/bindings/Makefile b/bindings/Makefile\r
+new file mode 100644\r
+index 0000000..de492a7\r
+--- /dev/null\r
++++ b/bindings/Makefile\r
+@@ -0,0 +1,7 @@\r
++# See Makefile.local for the list of files to be compiled in this\r
++# directory.\r
++all:\r
++      $(MAKE) -C .. all\r
++\r
++.DEFAULT:\r
++      $(MAKE) -C .. $@\r
+diff --git a/bindings/Makefile.local b/bindings/Makefile.local\r
+new file mode 100644\r
+index 0000000..6ed1344\r
+--- /dev/null\r
++++ b/bindings/Makefile.local\r
+@@ -0,0 +1,18 @@\r
++# -*- makefile -*-\r
++\r
++dir := bindings\r
++\r
++# force the shared library to be build\r
++ruby-bindings: lib/libnotmuch.so\r
++ifeq ($(HAVE_RUBY_DEV),1)\r
++      cd $(dir)/ruby && ruby extconf.rb --vendor\r
++      $(MAKE) -C $(dir)/ruby\r
++else\r
++      @echo Missing dependency, skipping ruby bindings\r
++endif\r
++\r
++CLEAN += $(patsubst %,$(dir)/ruby/%, \\r
++      Makefile database.o directory.o filenames.o\\r
++      init.o message.o messages.o mkmf.log notmuch.so query.o \\r
++      status.o tags.o thread.o threads.o)\r
++\r
+diff --git a/bindings/ruby/README b/bindings/ruby/README\r
+new file mode 100644\r
+index 0000000..fe4ff89\r
+--- /dev/null\r
++++ b/bindings/ruby/README\r
+@@ -0,0 +1,8 @@\r
++To build the the notmuch ruby extension, run the following commands\r
++from the *top level* notmuch source directory:\r
++\r
++% ./configure\r
++% make ruby-bindings\r
++\r
++The generic documentation about building notmuch also applies.\r
++\r
+diff --git a/configure b/configure\r
+index 4af7ba9..3ca9bed 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"\r
\r
+ # For a non-srcdir configure invocation (such as ../configure), create\r
+ # the directory structure and copy Makefiles.\r
+@@ -443,6 +444,15 @@ else\r
+     have_doxygen=0\r
+ fi\r
\r
++printf "Checking for ruby development files... "\r
++if ruby -e "require 'mkmf'"> /dev/null 2>&1; then\r
++    printf "Yes.\n"\r
++    have_ruby_dev=1\r
++else\r
++    printf "No (skipping ruby bindings)\n"\r
++    have_ruby_dev=0\r
++fi\r
++\r
+ printf "Checking if sphinx is available and supports nroff output... "\r
+ if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then\r
+     printf "Yes.\n"\r
+@@ -858,6 +868,10 @@ HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}\r
+ # build its own version)\r
+ HAVE_GETLINE = ${have_getline}\r
\r
++# Are the ruby development files (and ruby) available? If not skip\r
++# building/testing ruby bindings.\r
++HAVE_RUBY_DEV = ${have_ruby_dev}\r
++\r
+ # Whether the strcasestr function is available (if not, then notmuch will\r
+ # build its own version)\r
+ HAVE_STRCASESTR = ${have_strcasestr}\r
+@@ -970,6 +984,10 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))\r
\r
+ # Name of python interpreter\r
+ NOTMUCH_PYTHON=${python}\r
++\r
++# Are the ruby development files (and ruby) available? If not skip\r
++# building/testing ruby bindings.\r
++NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}\r
+ EOF\r
\r
+ # Finally, after everything configured, inform the user how to continue.\r
+diff --git a/debian/rules b/debian/rules\r
+index 7a19445..ca85bc7 100755\r
+--- a/debian/rules\r
++++ b/debian/rules\r
+@@ -12,7 +12,6 @@ override_dh_auto_build:\r
+       dh_auto_build -- V=1\r
+       dh_auto_build --sourcedirectory bindings/python\r
+       cd bindings/python && $(python3_all) setup.py build\r
+-      cd bindings/ruby && ruby extconf.rb --vendor && make\r
+       $(MAKE) -C contrib/notmuch-mutt\r
\r
+ override_dh_auto_clean:\r
+-- \r
+2.1.4\r
+\r