Re: Filesystem functionality used by notmuch
[notmuch-archives.git] / 6d / 96f6511b80db85a19767e4c53b98322ab30e2a
1 Return-Path: <bremner@tesseract.cs.unb.ca>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1EF68429E47\r
6         for <notmuch@notmuchmail.org>; Thu,  1 Jan 2015 04:17:21 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id Z2e6cZjDifqx for <notmuch@notmuchmail.org>;\r
16         Thu,  1 Jan 2015 04:17:18 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 87792429E42\r
21         for <notmuch@notmuchmail.org>; Thu,  1 Jan 2015 04:17:13 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Y6egh-00053u-Nw; Thu, 01 Jan 2015 08:17:11 -0400\r
25 Received: (nullmailer pid 28809 invoked by uid 1000); Thu, 01 Jan 2015\r
26         12:16:50 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH 1/5] build: integrate building ruby bindings into notmuch\r
30         build process\r
31 Date: Thu,  1 Jan 2015 13:16:36 +0100\r
32 Message-Id: <1420114600-28396-2-git-send-email-david@tethera.net>\r
33 X-Mailer: git-send-email 2.1.3\r
34 In-Reply-To: <1420114600-28396-1-git-send-email-david@tethera.net>\r
35 References: <1420114600-28396-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Thu, 01 Jan 2015 12:17:21 -0000\r
49 \r
50 Because ruby generates a Makefile, we have to use recursive make.\r
51 Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}\r
52 in the parent directory.\r
53 ---\r
54  Makefile.local          |  2 +-\r
55  bindings/Makefile       |  7 +++++++\r
56  bindings/Makefile.local | 18 ++++++++++++++++++\r
57  bindings/ruby/README    |  8 ++++++++\r
58  configure               | 18 ++++++++++++++++++\r
59  debian/rules            |  1 -\r
60  6 files changed, 52 insertions(+), 2 deletions(-)\r
61  create mode 100644 bindings/Makefile\r
62  create mode 100644 bindings/Makefile.local\r
63  create mode 100644 bindings/ruby/README\r
64 \r
65 diff --git a/Makefile.local b/Makefile.local\r
66 index 81ee347..7204267 100644\r
67 --- a/Makefile.local\r
68 +++ b/Makefile.local\r
69 @@ -59,7 +59,7 @@ endif\r
70  FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)\r
71  \r
72  .PHONY: all\r
73 -all: notmuch notmuch-shared build-man\r
74 +all: notmuch notmuch-shared build-man ruby-bindings\r
75  ifeq ($(MAKECMDGOALS),)\r
76  ifeq ($(shell cat .first-build-message 2>/dev/null),)\r
77         @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all\r
78 diff --git a/bindings/Makefile b/bindings/Makefile\r
79 new file mode 100644\r
80 index 0000000..de492a7\r
81 --- /dev/null\r
82 +++ b/bindings/Makefile\r
83 @@ -0,0 +1,7 @@\r
84 +# See Makefile.local for the list of files to be compiled in this\r
85 +# directory.\r
86 +all:\r
87 +       $(MAKE) -C .. all\r
88 +\r
89 +.DEFAULT:\r
90 +       $(MAKE) -C .. $@\r
91 diff --git a/bindings/Makefile.local b/bindings/Makefile.local\r
92 new file mode 100644\r
93 index 0000000..6ed1344\r
94 --- /dev/null\r
95 +++ b/bindings/Makefile.local\r
96 @@ -0,0 +1,18 @@\r
97 +# -*- makefile -*-\r
98 +\r
99 +dir := bindings\r
100 +\r
101 +# force the shared library to be build\r
102 +ruby-bindings: lib/libnotmuch.so\r
103 +ifeq ($(HAVE_RUBY_DEV),1)\r
104 +       cd $(dir)/ruby && ruby extconf.rb --vendor\r
105 +       $(MAKE) -C $(dir)/ruby\r
106 +else\r
107 +       @echo Missing dependency, skipping ruby bindings\r
108 +endif\r
109 +\r
110 +CLEAN += $(patsubst %,$(dir)/ruby/%, \\r
111 +       Makefile database.o directory.o filenames.o\\r
112 +       init.o message.o messages.o mkmf.log notmuch.so query.o \\r
113 +       status.o tags.o thread.o threads.o)\r
114 +\r
115 diff --git a/bindings/ruby/README b/bindings/ruby/README\r
116 new file mode 100644\r
117 index 0000000..6bb8cb2\r
118 --- /dev/null\r
119 +++ b/bindings/ruby/README\r
120 @@ -0,0 +1,8 @@\r
121 +To build the the notmuch ruby extensions, run the following commands\r
122 +from the *top level* notmuch source directory:\r
123 +\r
124 +% ./configure\r
125 +% make ruby-bindings\r
126 +\r
127 +The generic documentation about building notmuch also applies.\r
128 +\r
129 diff --git a/configure b/configure\r
130 index d14e7d1..7df3b29 100755\r
131 --- a/configure\r
132 +++ b/configure\r
133 @@ -21,6 +21,7 @@ srcdir=$(dirname "$0")\r
134  \r
135  subdirs="util compat lib parse-time-string completion doc emacs"\r
136  subdirs="${subdirs} performance-test test test/test-databases"\r
137 +subdirs="${subdirs} bindings"\r
138  \r
139  # For a non-srcdir configure invocation (such as ../configure), create\r
140  # the directory structure and copy Makefiles.\r
141 @@ -426,6 +427,15 @@ else\r
142      have_doxygen=0\r
143  fi\r
144  \r
145 +printf "Checking for ruby development files... "\r
146 +if ruby -e "require 'mkmf'"> /dev/null 2>&1; then\r
147 +    printf "Yes.\n"\r
148 +    have_ruby_dev=1\r
149 +else\r
150 +    printf "No (skipping ruby bindings)\n"\r
151 +    have_ruby_dev=0\r
152 +fi\r
153 +\r
154  printf "Checking if sphinx is available and supports nroff output... "\r
155  if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then\r
156      printf "Yes.\n"\r
157 @@ -848,6 +858,10 @@ HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}\r
158  # build its own version)\r
159  HAVE_GETLINE = ${have_getline}\r
160  \r
161 +# Are the ruby development files (and ruby) available? If not skip\r
162 +# building/testing ruby bindings.\r
163 +HAVE_RUBY_DEV = ${have_ruby_dev}\r
164 +\r
165  # Whether the strcasestr function is available (if not, then notmuch will\r
166  # build its own version)\r
167  HAVE_STRCASESTR = ${have_strcasestr}\r
168 @@ -958,6 +972,10 @@ NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}\r
169  # Whether there's either sphinx or rst2man available for building\r
170  # documentation\r
171  NOTMUCH_HAVE_MAN=$((have_sphinx || have_rst2man))\r
172 +\r
173 +# Are the ruby development files (and ruby) available? If not skip\r
174 +# building/testing ruby bindings.\r
175 +NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}\r
176  EOF\r
177  \r
178  # Finally, after everything configured, inform the user how to continue.\r
179 diff --git a/debian/rules b/debian/rules\r
180 index 7a19445..ca85bc7 100755\r
181 --- a/debian/rules\r
182 +++ b/debian/rules\r
183 @@ -12,7 +12,6 @@ override_dh_auto_build:\r
184         dh_auto_build -- V=1\r
185         dh_auto_build --sourcedirectory bindings/python\r
186         cd bindings/python && $(python3_all) setup.py build\r
187 -       cd bindings/ruby && ruby extconf.rb --vendor && make\r
188         $(MAKE) -C contrib/notmuch-mutt\r
189  \r
190  override_dh_auto_clean:\r
191 -- \r
192 2.1.3\r
193 \r