From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4C1C2431FDE for ; Wed, 12 Mar 2014 20:21:55 -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 u1x7qiIwqXTP for ; Wed, 12 Mar 2014 20:21:51 -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 68022431E64 for ; Wed, 12 Mar 2014 20:21:43 -0700 (PDT) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1WNwDH-0000D0-0q; Thu, 13 Mar 2014 00:21:43 -0300 Received: (nullmailer pid 25681 invoked by uid 1000); Thu, 13 Mar 2014 03:21:29 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [Patch v3 3/4] doc: configure detection of sphinx and rst2man Date: Thu, 13 Mar 2014 00:21:16 -0300 Message-Id: <1394680877-25572-4-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:56 -0000 Because sphinx-build does not provide a convenient way of listing which builders exist, and some people actually have pre 1.0 sphinx, we try loading a relevant python module. Currently the assumption is that no python in path -> no sphinx-build in path. --- configure | 25 +++++++++++++++++++++++++ doc/Makefile.local | 21 ++++++++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 2eaed4a..fb276f1 100755 --- a/configure +++ b/configure @@ -393,6 +393,25 @@ else have_emacs=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" + have_sphinx=1 + have_rst2man=0 +else + printf "No (falling back to rst2man).\n" + have_sphinx=0 + + printf "Checking if rst2man is available... " + if rst2man -V > /dev/null 2>&1; then + printf "Yes.\n" + have_rst2man=1 + else + printf "No (so will not install man pages).\n" + have_rst2man=0 + fi +fi + libdir_in_ldconfig=0 printf "Checking which platform we are on... " @@ -759,6 +778,12 @@ emacsetcdir=${EMACSETCDIR} # Whether there's an emacs binary available for byte-compiling HAVE_EMACS = ${have_emacs} +# Whether there's a sphinx-build binary available for building documentation +HAVE_SPHINX=${have_sphinx} + +# Whether there's a rst2man binary available for building documentation +HAVE_RST2MAN=${have_rst2man} + # The directory to which desktop files should be installed desktop_dir = \$(prefix)/share/applications diff --git a/doc/Makefile.local b/doc/Makefile.local index fab6d48..9c31c24 100644 --- a/doc/Makefile.local +++ b/doc/Makefile.local @@ -33,11 +33,9 @@ sphinx-info: sphinx-texinfo MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES}) -build-man: ${MAN_GZIP_FILES} - -${MAN_ROFF_FILES}: ${dir}/man.stamp - -$(dir)/man.stamp: ${MAN_RST_FILES} +# Use the man page converter that is available. We should never depend +# on MAN_ROFF_FILES if a converter is not available. +${MAN_ROFF_FILES}: ${MAN_RST_FILES} ifeq ($(HAVE_SPHINX),1) $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man for section in 1 5 7; do \ @@ -46,11 +44,19 @@ ifeq ($(HAVE_SPHINX),1) done else ifeq ($(HAVE_RST2MAN),1) $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man - touch $@ else - @echo "No sphinx or rst2man, will not install man pages." + @echo "Fatal: build dependency fail." + @false endif +# Do not try to build or install man pages if a man page converter is +# not available. +ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00) +build-man: +install-man: + @echo "No sphinx or rst2man, will not install man pages." +else +build-man: ${MAN_GZIP_FILES} install-man: ${MAN_GZIP_FILES} mkdir -p "$(DESTDIR)$(mandir)/man1" mkdir -p "$(DESTDIR)$(mandir)/man5" @@ -59,6 +65,7 @@ install-man: ${MAN_GZIP_FILES} install -m0644 $(DOCBUILDDIR)/man/man5/*.5.gz $(DESTDIR)/$(mandir)/man5 install -m0644 $(DOCBUILDDIR)/man/man7/*.7.gz $(DESTDIR)/$(mandir)/man7 cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz +endif $(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py $(mkdocdeps) $< $(DOCBUILDDIR) $@ -- 1.8.5.3