--- /dev/null
+Return-Path: <bremner@tethera.net>\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 E9908431FDF\r
+ for <notmuch@notmuchmail.org>; Sun, 9 Mar 2014 05:57:42 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 0BxN5a7h65yT for <notmuch@notmuchmail.org>;\r
+ Sun, 9 Mar 2014 05:57:37 -0700 (PDT)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\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 6EDF1431FC7\r
+ for <notmuch@notmuchmail.org>; Sun, 9 Mar 2014 05:57:26 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1WMdIE-0003qi-3G; Sun, 09 Mar 2014 09:57:26 -0300\r
+Received: (nullmailer pid 8487 invoked by uid 1000); Sun, 09 Mar 2014\r
+ 12:57:08 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v3 3/4] doc: install sphinx version of man pages\r
+Date: Sun, 9 Mar 2014 09:56:59 -0300\r
+Message-Id: <1394369820-8319-4-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.5.3\r
+In-Reply-To: <1394369820-8319-1-git-send-email-david@tethera.net>\r
+References: <1394369820-8319-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: Sun, 09 Mar 2014 12:57:43 -0000\r
+\r
+The python script mkdocdeps.py is used to import the list of man pages\r
+from the sphinx configuration to make.\r
+\r
+This will delete the (release only) target update-man-versions. This\r
+will be replaced in a followup commit.\r
+---\r
+ Makefile | 2 +-\r
+ Makefile.local | 2 +-\r
+ doc/Makefile.local | 27 ++++++++++++++++++++++++++-\r
+ doc/mkdocdeps.py | 13 +++++++++++++\r
+ man/Makefile.local | 55 ------------------------------------------------------\r
+ 5 files changed, 41 insertions(+), 58 deletions(-)\r
+ create mode 100644 doc/mkdocdeps.py\r
+ delete mode 100644 man/Makefile.local\r
+\r
+diff --git a/Makefile b/Makefile\r
+index 39f0e62..f53bec0 100644\r
+--- a/Makefile\r
++++ b/Makefile\r
+@@ -5,7 +5,7 @@ all:\r
+ # List all subdirectories here. Each contains its own Makefile.local.\r
+ # Use of '=', without '+=', seems to be required for out-of-tree\r
+ # builds to work.\r
+-subdirs = compat completion doc emacs lib man parse-time-string performance-test util test\r
++subdirs = compat completion doc emacs lib parse-time-string performance-test util test\r
+ \r
+ # We make all targets depend on the Makefiles themselves.\r
+ global_deps = Makefile Makefile.config Makefile.local \\r
+diff --git a/Makefile.local b/Makefile.local\r
+index 174506c..5f797ad 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -95,7 +95,7 @@ dist: $(TAR_FILE)\r
+ \r
+ .PHONY: update-versions\r
+ \r
+-update-versions: update-man-versions\r
++update-versions:\r
+ sed -i "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" $(PV_FILE)\r
+ \r
+ # We invoke make recursively only to force ordering of our phony\r
+diff --git a/doc/Makefile.local b/doc/Makefile.local\r
+index 4719247..fd64f70 100644\r
+--- a/doc/Makefile.local\r
++++ b/doc/Makefile.local\r
+@@ -8,6 +8,7 @@ SPHINXBUILD = sphinx-build\r
+ DOCBUILDDIR := $(dir)/_build\r
+ \r
+ prerst2man := python $(dir)/prerst2man.py\r
++mkdocdeps := python $(dir)/mkdocdeps.py\r
+ \r
+ # Internal variables.\r
+ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)\r
+@@ -15,6 +16,11 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir)\r
+ .PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info\r
+ .PHONY: rst2man\r
+ \r
++.PHONY: install-man\r
++\r
++%.gz: %\r
++ rm -f $@ && gzip --stdout $^ > $@\r
++\r
+ sphinx-html:\r
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html\r
+ \r
+@@ -31,4 +37,23 @@ sphinx-info: sphinx-texinfo\r
+ rst2man:\r
+ $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man\r
+ \r
+-CLEAN := $(CLEAN) $(DOCBUILDDIR)\r
++-include $(dir)/docdeps.mk\r
++\r
++MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})\r
++\r
++${MAN_ROFF_FILES} : sphinx-man\r
++\r
++install-man: ${MAN_GZIP_FILES}\r
++ mkdir -p "$(DESTDIR)$(mandir)/man1"\r
++ mkdir -p "$(DESTDIR)$(mandir)/man5"\r
++ mkdir -p "$(DESTDIR)$(mandir)/man7"\r
++ install -m0644 $(DOCBUILDDIR)/man/*.1.gz $(DESTDIR)/$(mandir)/man1\r
++ install -m0644 $(DOCBUILDDIR)/man/*.5.gz $(DESTDIR)/$(mandir)/man5\r
++ install -m0644 $(DOCBUILDDIR)/man/*.7.gz $(DESTDIR)/$(mandir)/man7\r
++ cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz\r
++\r
++\r
++$(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py\r
++ $(mkdocdeps) $< $(DOCBUILDDIR) $@\r
++\r
++CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk\r
+diff --git a/doc/mkdocdeps.py b/doc/mkdocdeps.py\r
+new file mode 100644\r
+index 0000000..2f4a959\r
+--- /dev/null\r
++++ b/doc/mkdocdeps.py\r
+@@ -0,0 +1,13 @@\r
++from sys import argv\r
++conffile = argv[1]\r
++builddir = argv[2]\r
++outfile = argv[3]\r
++\r
++execfile(conffile)\r
++\r
++roff_files = []\r
++out=open(outfile,'w')\r
++for page in man_pages:\r
++ roff_files = roff_files + ["{0:s}/man/{1:s}.{2:d}".format(builddir,page[1],page[4])]\r
++\r
++out.write ('MAN_ROFF_FILES := ' + ' \\\n\t'.join(roff_files)+'\n')\r
+diff --git a/man/Makefile.local b/man/Makefile.local\r
+deleted file mode 100644\r
+index 57910b7..0000000\r
+--- a/man/Makefile.local\r
++++ /dev/null\r
+@@ -1,55 +0,0 @@\r
+-# -*- Makefile -*-\r
+-\r
+-dir := man\r
+-\r
+-# this variable seems to be needed to prevent lazy evaluation causing\r
+-# problems with $(dir) changing values.\r
+-MAIN_PAGE := $(dir)/man1/notmuch.1\r
+-\r
+-MAN1 := \\r
+- $(MAIN_PAGE) \\r
+- $(dir)/man1/notmuch-compact.1 \\r
+- $(dir)/man1/notmuch-config.1 \\r
+- $(dir)/man1/notmuch-count.1 \\r
+- $(dir)/man1/notmuch-dump.1 \\r
+- $(dir)/man1/notmuch-restore.1 \\r
+- $(dir)/man1/notmuch-insert.1 \\r
+- $(dir)/man1/notmuch-new.1 \\r
+- $(dir)/man1/notmuch-reply.1 \\r
+- $(dir)/man1/notmuch-search.1 \\r
+- $(dir)/man1/notmuch-show.1 \\r
+- $(dir)/man1/notmuch-tag.1\r
+-\r
+-MAN5 := $(dir)/man5/notmuch-hooks.5\r
+-MAN7 := $(dir)/man7/notmuch-search-terms.7\r
+-\r
+-MAN1_GZ := $(addsuffix .gz,$(MAN1))\r
+-MAN5_GZ := $(addsuffix .gz,$(MAN5))\r
+-MAN7_GZ := $(addsuffix .gz,$(MAN7))\r
+-\r
+-MAN_SOURCE := $(MAN1) $(MAN5) $(MAN7)\r
+-MAN_BACKUP := $(addsuffix .bak,$(MAN_SOURCE))\r
+-COMPRESSED_MAN := $(MAN1_GZ) $(MAN5_GZ) $(MAN7_GZ)\r
+-\r
+-%.gz: %\r
+- gzip --stdout $^ > $@\r
+-\r
+-.PHONY: install-man update-man-versions\r
+-\r
+-install-man: $(COMPRESSED_MAN)\r
+- mkdir -p "$(DESTDIR)$(mandir)/man1"\r
+- mkdir -p "$(DESTDIR)$(mandir)/man5"\r
+- mkdir -p "$(DESTDIR)$(mandir)/man7"\r
+- install -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1\r
+- install -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5\r
+- install -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7\r
+- cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz\r
+-\r
+-update-man-versions: $(MAN_SOURCE)\r
+- for file in $(MAN_SOURCE); do \\r
+- cp $$file $$file.bak ; \\r
+- sed "s/^.TH NOTMUCH\([^[:blank:]]*\) \([1-9]\) .*$$/.TH NOTMUCH\1 \2 ${DATE} \"Notmuch ${VERSION}\"/" \\r
+- < $$file.bak > $$file; \\r
+- done\r
+-\r
+-CLEAN := $(CLEAN) $(COMPRESSED_MAN) $(MAN_BACKUP)\r
+-- \r
+1.8.5.3\r
+\r