From: David Bremner Date: Mon, 1 Jun 2015 07:08:59 +0000 (+0200) Subject: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6b4976921912eddbfc885b9c3fc39de45fac6372;p=notmuch-archives.git [patch v3 1/4] build: integrate building ruby bindings into notmuch build process --- diff --git a/bf/eb7dcbf3f543e7736bda0407bcc774694c1232 b/bf/eb7dcbf3f543e7736bda0407bcc774694c1232 new file mode 100644 index 000000000..04facff2e --- /dev/null +++ b/bf/eb7dcbf3f543e7736bda0407bcc774694c1232 @@ -0,0 +1,194 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 05C7C6DE1995 + for ; Mon, 1 Jun 2015 00:11:28 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.26 +X-Spam-Level: +X-Spam-Status: No, score=0.26 tagged_above=-999 required=5 tests=[AWL=0.250, + T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id A18Pd7zox95V for ; + Mon, 1 Jun 2015 00:11:26 -0700 (PDT) +Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net + [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id 306BE6DE1833 + for ; Mon, 1 Jun 2015 00:11:26 -0700 (PDT) +Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim + 4.80) (envelope-from ) + id 1YzJrw-0007PG-M0; Mon, 01 Jun 2015 07:10:44 +0000 +Received: (nullmailer pid 2449 invoked by uid 1000); Mon, 01 Jun 2015 + 07:09:06 -0000 +From: David Bremner +To: David Bremner , notmuch@notmuchmail.org +Subject: [patch v3 1/4] build: integrate building ruby bindings into notmuch + build process +Date: Mon, 1 Jun 2015 09:08:59 +0200 +Message-Id: <1433142542-2307-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1433142542-2307-1-git-send-email-david@tethera.net> +References: <1425679073-30439-5-git-send-email-david@tethera.net> + <1433142542-2307-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 01 Jun 2015 07:11:28 -0000 + +Because ruby generates a Makefile, we have to use recursive make. +Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local} +in the parent directory. +--- + Makefile.local | 2 +- + bindings/Makefile | 7 +++++++ + bindings/Makefile.local | 19 +++++++++++++++++++ + bindings/ruby/README | 8 ++++++++ + configure | 18 ++++++++++++++++++ + debian/rules | 1 - + 6 files changed, 53 insertions(+), 2 deletions(-) + create mode 100644 bindings/Makefile + create mode 100644 bindings/Makefile.local + create mode 100644 bindings/ruby/README + +diff --git a/Makefile.local b/Makefile.local +index 6d54742..61a9c4c 100644 +--- a/Makefile.local ++++ b/Makefile.local +@@ -59,7 +59,7 @@ endif + FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS) + + .PHONY: all +-all: notmuch notmuch-shared build-man ++all: notmuch notmuch-shared build-man ruby-bindings + ifeq ($(MAKECMDGOALS),) + ifeq ($(shell cat .first-build-message 2>/dev/null),) + @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all +diff --git a/bindings/Makefile b/bindings/Makefile +new file mode 100644 +index 0000000..de492a7 +--- /dev/null ++++ b/bindings/Makefile +@@ -0,0 +1,7 @@ ++# See Makefile.local for the list of files to be compiled in this ++# directory. ++all: ++ $(MAKE) -C .. all ++ ++.DEFAULT: ++ $(MAKE) -C .. $@ +diff --git a/bindings/Makefile.local b/bindings/Makefile.local +new file mode 100644 +index 0000000..e0b0bf0 +--- /dev/null ++++ b/bindings/Makefile.local +@@ -0,0 +1,19 @@ ++# -*- makefile -*- ++ ++dir := bindings ++ ++# force the shared library to be built ++ruby-bindings: lib/libnotmuch.so ++ifeq ($(HAVE_RUBY_DEV),1) ++ cd $(dir)/ruby && ruby extconf.rb --vendor ++ $(MAKE) -C $(dir)/ruby ++else ++ @echo Missing dependency, skipping ruby bindings ++endif ++ ++CLEAN += $(patsubst %,$(dir)/ruby/%, \ ++ .RUBYARCHDIR.time \ ++ Makefile database.o directory.o filenames.o\ ++ init.o message.o messages.o mkmf.log notmuch.so query.o \ ++ status.o tags.o thread.o threads.o) ++ +diff --git a/bindings/ruby/README b/bindings/ruby/README +new file mode 100644 +index 0000000..fe4ff89 +--- /dev/null ++++ b/bindings/ruby/README +@@ -0,0 +1,8 @@ ++To build the the notmuch ruby extension, run the following commands ++from the *top level* notmuch source directory: ++ ++% ./configure ++% make ruby-bindings ++ ++The generic documentation about building notmuch also applies. ++ +diff --git a/configure b/configure +index 2065fcd..5a862b1 100755 +--- a/configure ++++ b/configure +@@ -21,6 +21,7 @@ srcdir=$(dirname "$0") + + subdirs="util compat lib parse-time-string completion doc emacs" + subdirs="${subdirs} performance-test test test/test-databases" ++subdirs="${subdirs} bindings" + + # For a non-srcdir configure invocation (such as ../configure), create + # the directory structure and copy Makefiles. +@@ -473,6 +474,15 @@ else + have_doxygen=0 + fi + ++printf "Checking for ruby development files... " ++if ruby -e "require 'mkmf'"> /dev/null 2>&1; then ++ printf "Yes.\n" ++ have_ruby_dev=1 ++else ++ printf "No (skipping ruby bindings)\n" ++ have_ruby_dev=0 ++fi ++ + printf "Checking if sphinx is available and supports nroff output... " + if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then + printf "Yes.\n" +@@ -886,6 +896,10 @@ HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name} + # build its own version) + HAVE_GETLINE = ${have_getline} + ++# Are the ruby development files (and ruby) available? If not skip ++# building/testing ruby bindings. ++HAVE_RUBY_DEV = ${have_ruby_dev} ++ + # Whether the strcasestr function is available (if not, then notmuch will + # build its own version) + HAVE_STRCASESTR = ${have_strcasestr} +@@ -998,6 +1012,10 @@ NOTMUCH_HAVE_MAN=$((have_sphinx)) + + # Name of python interpreter + NOTMUCH_PYTHON=${python} ++ ++# Are the ruby development files (and ruby) available? If not skip ++# building/testing ruby bindings. ++NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev} + EOF + + # Finally, after everything configured, inform the user how to continue. +diff --git a/debian/rules b/debian/rules +index 56378ec..04f0062 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -19,7 +19,6 @@ override_dh_auto_build: + dh_auto_build -- V=1 + dh_auto_build --sourcedirectory bindings/python + cd bindings/python && $(python3_all) setup.py build +- cd bindings/ruby && ruby extconf.rb --vendor && make + $(MAKE) -C contrib/notmuch-mutt + + override_dh_auto_clean: +-- +2.1.4 +