DOCS: conditionalized manual page builds from website for --enable-maintainer-mode
authorTim Janik <timj@gtk.org>
Mon, 9 May 2011 17:49:59 +0000 (19:49 +0200)
committerTim Janik <timj@gtk.org>
Mon, 9 May 2011 17:49:59 +0000 (19:49 +0200)
configure.in
docs/Makefile.am

index ad3f6b9..e89bb00 100644 (file)
@@ -353,6 +353,29 @@ AC_DEFUN([AC_BSE_REQUIREMENTS],
     bseuserdatadir='~/beast'
     AC_SUBST(bseuserdatadir)
 ])
+AC_DEFUN([AC_MAN_REQUIREMENTS],
+[
+  AC_PATH_PROGS(WIKIHTML2MAN, wikihtml2man wikihtml2man.py, false)
+  AC_PATH_PROG(GROFF, groff, false)
+  IFMAN=
+  IFAGING=
+  if test x"$enable_maintainer_mode" = xyes ; then
+    test x"$WIKIHTML2MAN" = xfalse && {
+      AC_MSG_ERROR(This package requires the wikihtml2man.py tool for maintainer builds)
+    }
+    echo "" | $GROFF -mandoc -Thtml 2>/dev/null | grep -Fq HTML || {
+      AC_MSG_ERROR(Failed to test-build HTML manual page via groff)
+    }
+  else # non-maintainer builds, need to have pre-built manual pages
+    test -e "${srcdir}/docs/mans/beast.1" || {
+      AC_MSG_ERROR([Missing prepackaged manual pages, use --enable-maintainer-mode])
+    }
+    IFMAN="#"
+    IFAGING="#"
+  fi
+  AC_SUBST(IFMAN)
+  AC_SUBST(IFAGING)
+])
 AC_DEFUN([AC_ASOUND_CHECK],
 [
     saved_cflags="$CFLAGS"
@@ -627,6 +650,7 @@ AC_BIRNET_REQUIREMENTS
 AC_I18N_REQUIREMENTS
 AC_SFI_REQUIREMENTS
 AC_BSE_REQUIREMENTS
+AC_MAN_REQUIREMENTS
 AC_ASOUND_CHECK
 AC_BSESCM_REQUIREMENTS
 AC_BSE_SNDDEV_CHECK
index d882718..de37134 100644 (file)
@@ -20,11 +20,10 @@ mans/:
 $(MANUAL_CACHE_TARGETS): cache/stamp-refresh
        curl -sfS http://beast.testbit.eu/$(@F)?action=render >$(@D)/xgen-$(@F)
        mv $(@D)/xgen-$(@F) $@ ; rm -f $(@D)/xgen-$(@F)
-WIKIHTML2MAN = wikihtml2man.py
-mans/%: cache/% | mans/
+mans/%: $(IFMAN) cache/% | mans/
        $(WIKIHTML2MAN) $< >$(@D)/xgen-$(@F)
        mv $(@D)/xgen-$(@F) $@ ; rm -f $(@D)/xgen-$(@F)
-html/%.html: mans/% | html/
+html/%.html: $(IFMAN) mans/% | html/
        groff -mandoc -Thtml $< >$(@D)/xgen-$(@F)
        mv $(@D)/xgen-$(@F) $@ ; rm -f $(@D)/xgen-$(@F)
 
@@ -69,7 +68,7 @@ cache/:
 stamp-refresh-message: # conditional phony dependency
        @TXT="  Some source files hosted online appear outdated; forcing refresh...  " \
        && echo "$$TXT" | sed 's/./=/g' && echo "$$TXT" && echo "$$TXT" | sed 's/./=/g'
-cache/stamp-refresh: $(call AGINGRULE, cache/stamp-refresh, 1440, stamp-refresh-message) | cache/ # refresh daily
+cache/stamp-refresh: $(IFAGING) $(call AGINGRULE, cache/stamp-refresh, 1440, stamp-refresh-message) | cache/ # refresh daily
        touch $@
 MAINTAINERCLEANFILES += cache/
 # $(call AGINGRULE, stamp-file-for-aging, AgingInMinutes, rule-name-for-remaking)