https://github.com/digint/btrbk/commit/9dfee7bc32f392a599164ae4c2a0c24d418751ef From 9dfee7bc32f392a599164ae4c2a0c24d418751ef Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 8 Jul 2023 23:44:53 +0100 Subject: [PATCH] doc: allow asciidoc again This effectively reverts 0e63843195eb35c26386863d18a70a764a3efd04 and 173319e7e1599ef9d08b985740e55020ebc2ea85. asciidoc has been revived (for a while now) and doesn't require Python 2. We still prefer asciidoctor and fallback to asciidoc/a2x if it's not available. Comparing the asciidoc and asciidoctor man pages, everything looks OK. Python tends to be available more readily in distribution build environments rather than the Ruby stack. Also, the pregenerated man pages are gone as of f132c94c655afa930a73423e6c1abf88d412f49d. Signed-off-by: Sam James --- a/doc/Makefile +++ b/doc/Makefile @@ -18,8 +18,19 @@ ifeq ($(COMPRESS), yes) endif # convert using "asciidoctor": -ASCIIDOCTOR_MANPAGE = asciidoctor -d manpage -b manpage -ASCIIDOCTOR_HTML = asciidoctor -b html5 -d article +# fallback to "a2x" from asciidoc package: +ifneq (, $(shell command -v asciidoctor 2> /dev/null)) + ASCIIDOC_MANPAGE = asciidoctor -d manpage -b manpage + ASCIIDOC_HTML = asciidoctor -b html5 -d article +else ifneq (, $(shell command -v a2x 2> /dev/null)) + # NOTE: using -L (--no-xmllint), as xmllint is a separate package on many distros. + ASCIIDOC_MANPAGE = a2x -L -d manpage -f manpage + ASCIIDOC_HTML = asciidoc -b html -d article +else + ASCIIDOC_ERR = $(error "please install either asciidoc or asciidoctor") + ASCIIDOC_MANPAGE = $(ASCIIDOC_ERR) + ASCIIDOC_HTML = $(ASCIIDOC_ERR) +endif # reproducible builds: reference date is ":date:" attribute from asciidoc source date_attr = $(shell sed -rn 's/:date:\s*//p' $(1)) @@ -50,10 +61,10 @@ clean: gzip -9 -n -c $< > $@ %.1 : %.1.asciidoc - SOURCE_DATE_EPOCH=$(call source_date_epoch,$<) $(ASCIIDOCTOR_MANPAGE) -o $@ $< + SOURCE_DATE_EPOCH=$(call source_date_epoch,$<) $(ASCIIDOC_MANPAGE) $< %.5 : %.5.asciidoc - SOURCE_DATE_EPOCH=$(call source_date_epoch,$<) $(ASCIIDOCTOR_MANPAGE) -o $@ $< + SOURCE_DATE_EPOCH=$(call source_date_epoch,$<) $(ASCIIDOC_MANPAGE) $< %.html : %.asciidoc - SOURCE_DATE_EPOCH=$(call source_date_epoch,$<) $(ASCIIDOCTOR_HTML) -o $@ $< + SOURCE_DATE_EPOCH=$(call source_date_epoch,$<) $(ASCIIDOC_HTML) -o $@ $<