From 4a503973223d9d82018142526e560db3fe58b26c Mon Sep 17 00:00:00 2001 From: David Bremner Date: Fri, 14 Mar 2014 00:21:14 +2100 Subject: [PATCH] [Patch v3 1/4] doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN --- b6/a5a3ce2670dc67a99fe84a17797cf9c79ca58a | 160 ++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 b6/a5a3ce2670dc67a99fe84a17797cf9c79ca58a diff --git a/b6/a5a3ce2670dc67a99fe84a17797cf9c79ca58a b/b6/a5a3ce2670dc67a99fe84a17797cf9c79ca58a new file mode 100644 index 000000000..b87f275a3 --- /dev/null +++ b/b6/a5a3ce2670dc67a99fe84a17797cf9c79ca58a @@ -0,0 +1,160 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id EEC6E429E31 + for ; Wed, 12 Mar 2014 20:21:45 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id zdbu2KbV-XAh for ; + Wed, 12 Mar 2014 20:21:41 -0700 (PDT) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id E9314431FC2 + for ; Wed, 12 Mar 2014 20:21:39 -0700 (PDT) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1WNwDD-0000Cq-K1; Thu, 13 Mar 2014 00:21:39 -0300 +Received: (nullmailer pid 25675 invoked by uid 1000); Thu, 13 Mar 2014 + 03:21:29 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [Patch v3 1/4] doc: build man pages at build time; introduce + HAVE_SPHINX, HAVE_RST2MAN +Date: Thu, 13 Mar 2014 00:21:14 -0300 +Message-Id: <1394680877-25572-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.8.5.3 +In-Reply-To: <1394680877-25572-1-git-send-email-david@tethera.net> +References: + <1394680877-25572-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Thu, 13 Mar 2014 03:21:46 -0000 + +This helps avoid build artifacts (namely, nroff and gzipped-nroff man +pages) owned by root. + +The variables allow choosing which generator to use for the man page. +These will be hooked to configure in a following commit. +--- + Makefile.local | 2 +- + doc/Makefile.local | 31 ++++++++++++++++++------------- + doc/mkdocdeps.py | 3 +++ + 3 files changed, 22 insertions(+), 14 deletions(-) + +diff --git a/Makefile.local b/Makefile.local +index 5f797ad..cb7b106 100644 +--- a/Makefile.local ++++ b/Makefile.local +@@ -53,7 +53,7 @@ endif + FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS) + + .PHONY: all +-all: notmuch notmuch-shared ++all: notmuch notmuch-shared build-man + ifeq ($(MAKECMDGOALS),) + ifeq ($(shell cat .first-build-message 2>/dev/null),) + @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all +diff --git a/doc/Makefile.local b/doc/Makefile.local +index fd64f70..23f4095 100644 +--- a/doc/Makefile.local ++++ b/doc/Makefile.local +@@ -13,10 +13,9 @@ mkdocdeps := python $(dir)/mkdocdeps.py + # Internal variables. + ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir) + +-.PHONY: sphinx-html sphinx-man sphinx-texinfo sphinx-info +-.PHONY: rst2man ++.PHONY: sphinx-html sphinx-texinfo sphinx-info + +-.PHONY: install-man ++.PHONY: install-man build-man + + %.gz: % + rm -f $@ && gzip --stdout $^ > $@ +@@ -24,24 +23,30 @@ ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(dir) + sphinx-html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCBUILDDIR)/html + +-sphinx-man: +- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man +- + sphinx-texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(DOCBUILDDIR)/texinfo + + sphinx-info: sphinx-texinfo + make -C $(DOCBUILDDIR)/texinfo info + +-# fallback target in case sphinx not installed +-rst2man: +- $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man +- + -include $(dir)/docdeps.mk + + MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES}) + +-${MAN_ROFF_FILES} : sphinx-man ++build-man: ${MAN_GZIP_FILES} ++ ++${MAN_ROFF_FILES}: ${dir}/man.stamp ++ ++$(dir)/man.stamp: ${MAN_RST_FILES} ++ifeq ($(HAVE_SPHINX),1) ++ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man ++ touch $@ ++else ifeq ($(HAVE_RST2MAN),1) ++ $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man ++ touch $@ ++else ++ @echo "No sphinx or rst2man, will not install man pages." ++endif + + install-man: ${MAN_GZIP_FILES} + mkdir -p "$(DESTDIR)$(mandir)/man1" +@@ -52,8 +57,8 @@ install-man: ${MAN_GZIP_FILES} + install -m0644 $(DOCBUILDDIR)/man/*.7.gz $(DESTDIR)/$(mandir)/man7 + cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz + +- + $(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py + $(mkdocdeps) $< $(DOCBUILDDIR) $@ + +-CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk ++CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(dir)/man.stamp ++CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES) +diff --git a/doc/mkdocdeps.py b/doc/mkdocdeps.py +index 2f4a959..e61bea6 100644 +--- a/doc/mkdocdeps.py ++++ b/doc/mkdocdeps.py +@@ -6,8 +6,11 @@ outfile = argv[3] + execfile(conffile) + + roff_files = [] ++rst_files = [] + out=open(outfile,'w') + for page in man_pages: ++ rst_files = rst_files + ["doc/{0:s}.rst".format(page[0])] + roff_files = roff_files + ["{0:s}/man/{1:s}.{2:d}".format(builddir,page[1],page[4])] + + out.write ('MAN_ROFF_FILES := ' + ' \\\n\t'.join(roff_files)+'\n') ++out.write ('MAN_RST_FILES := ' + ' \\\n\t'.join(rst_files)+'\n') +-- +1.8.5.3 + -- 2.26.2