unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/5] build: integrate building ruby bindings into notmuch build process
Date: Thu,  1 Jan 2015 13:16:36 +0100	[thread overview]
Message-ID: <1420114600-28396-2-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1420114600-28396-1-git-send-email-david@tethera.net>

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 | 18 ++++++++++++++++++
 bindings/ruby/README    |  8 ++++++++
 configure               | 18 ++++++++++++++++++
 debian/rules            |  1 -
 6 files changed, 52 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 81ee347..7204267 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..6ed1344
--- /dev/null
+++ b/bindings/Makefile.local
@@ -0,0 +1,18 @@
+# -*- makefile -*-
+
+dir := bindings
+
+# force the shared library to be build
+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/%, \
+	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..6bb8cb2
--- /dev/null
+++ b/bindings/ruby/README
@@ -0,0 +1,8 @@
+To build the the notmuch ruby extensions, 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 d14e7d1..7df3b29 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.
@@ -426,6 +427,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 hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then
     printf "Yes.\n"
@@ -848,6 +858,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}
@@ -958,6 +972,10 @@ NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 # Whether there's either sphinx or rst2man available for building
 # documentation
 NOTMUCH_HAVE_MAN=$((have_sphinx || have_rst2man))
+
+# 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 7a19445..ca85bc7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,7 +12,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.3

  reply	other threads:[~2015-01-01 12:17 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01 12:16 Build and test ruby bindings David Bremner
2015-01-01 12:16 ` David Bremner [this message]
2015-01-01 12:16 ` [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-01-01 12:16 ` [PATCH 3/5] bindings/ruby: gitignore *.o David Bremner
2015-01-01 15:53   ` David Bremner
2015-01-01 12:16 ` [PATCH 4/5] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-01-01 12:16 ` [PATCH 5/5] test: add initial ruby tests David Bremner
2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
2015-03-06 21:57     ` [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
2015-03-06 21:57     ` [Patch v2 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-03-06 21:57     ` [Patch v2 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-03-06 21:57     ` [Patch v2 4/4] test: add initial ruby tests David Bremner
2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
2015-06-13  6:37           ` David Bremner
2015-06-13 19:59             ` Jinwoo Lee
2015-06-13 20:46               ` Jinwoo Lee
2015-06-13 20:51                 ` Jinwoo Lee
2015-06-13 21:11                   ` David Bremner
2015-06-13 21:22                     ` Jinwoo Lee
2015-06-13 21:24                       ` Jinwoo Lee
2015-06-13 21:34                         ` Jinwoo Lee
2015-06-14  5:49                           ` David Bremner
2015-06-15  6:35             ` David Bremner
2015-06-01  7:09         ` [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-06-14  5:58           ` [PATCH] lib, ruby: " David Bremner
2015-06-14  6:20             ` Jinwoo Lee
2015-06-14  6:53               ` David Bremner
2015-06-14 15:16                 ` Jinwoo Lee
2015-06-14 18:34                   ` David Bremner
2015-06-15  3:56                     ` Jinwoo Lee
2015-06-15  9:20                       ` Tomi Ollila
2015-06-15 21:49                         ` Jinwoo Lee
2015-06-16 18:20                           ` Tomi Ollila
2015-06-16 23:43                             ` Jinwoo Lee
2015-06-17  0:15                               ` Jinwoo Lee
2015-06-17  6:23                               ` David Bremner
2015-06-17  6:39                                 ` Jinwoo Lee
2015-06-17 11:16                                 ` Tomi Ollila
2015-06-01  7:09         ` [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-06-14  6:26           ` [PATCH] " David Bremner
2015-06-01  7:09         ` [patch v3 4/4] test: add initial ruby tests David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420114600-28396-2-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).