From c8f4ad907f111640fec18431bc7da0be8956cf03 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 28 Nov 2023 08:00:14 -0500 Subject: [PATCH] more MAN2TXT follow-up Following a commit for Issue #1153, g-branden-robinson commented: > Mac OS X stayed on _groff_ 1.19.2 for over a decade (presumably due to > _groff_ 1.20 adopting to GNU GPLv3), until finally dropping _groff_ > altogether for macOS Ventura (2022). > > There _has_ been an interface change in that time. The [`-P` option I > advised about is new to _groff_ 1.23.0 (July 2023)] > (https://git.savannah.gnu.org/cgit/groff.git/tree/NEWS?h=1.23.0#n86). > [...] > > There is a significant number of _groff_ users via Homebrew (enough that > we hear from them occasionally via bug reports). Some of these have > upgraded to 1.23.0 via that mechanism. > [...] > > `nroff -` is not necessary with any _nroff_ known to me; like many other > Bell Labs Unix programs, it reads from the standard input stream by default > if not given any operands. Action taken: 1. Remove the unnecessary ' -' from the nroff command in Makefile.doc. 2. In the misc.370 file containing make snippets to include, test whether groff >= 1.23, and only insert the -P option for 1.23 or greater. --- sys/unix/Makefile.doc | 7 +++++-- sys/unix/hints/include/misc.370 | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sys/unix/Makefile.doc b/sys/unix/Makefile.doc index 5ea70b434..d43acfcdf 100644 --- a/sys/unix/Makefile.doc +++ b/sys/unix/Makefile.doc @@ -115,8 +115,11 @@ Guidebook.dat : Gbk-1pg-pfx.mn Gbk-1pg-sfx.mn $(GUIDEBOOK_MN) tmac.n tmac.nh \ $(ONEPAGECMD) > $@ # plain text output -#MAN2TXT = $(NHGREP) | nroff -man $(MORE_MAN2TXT_FLAGS) - | $(COLCMD) -MAN2TXT = $(NHGREP) | nroff -man $(MORE_MAN2TXT_FLAGS) - +# MORE_MAN2TXT_FLAGS is included so that a hints file can alter the options +MAN2TXT = $(NHGREP) | nroff -man $(MORE_MAN2TXT_FLAGS) +# If you aren't using a hints file, you can uncomment the following +# line if you have groff 1.23 or greater. +#MAN2TXT = $(NHGREP) | nroff -man -Tascii -P -cbou nethack.txt : nethack.6 cat nethack.6 | $(MAN2TXT) > nethack.txt recover.txt : recover.6 diff --git a/sys/unix/hints/include/misc.370 b/sys/unix/hints/include/misc.370 index eea26d2ba..973473444 100644 --- a/sys/unix/hints/include/misc.370 +++ b/sys/unix/hints/include/misc.370 @@ -69,20 +69,21 @@ endif NROFFISGROFF := $(shell echo `nroff --version | grep "GNU groff version"`) #$(info NROFFISGROFF=$(NROFFISGROFF)) ifneq "$(NROFFISGROFF)" "" -# --- version check is not currently needed --- -# get the version of groff -#GROFFGE123 := $(shell expr `echo $(NROFFISGROFF) | cut -f2 -d.` \>= 23) -#$(info GROFFGE123=$(GROFFGE123)) -#ifeq "$(GROFFGE123)" "1" -#NROFF_FLAGS = -W font -#endif -# --- +# get the version of groff and flag if it is gt or eq to 1.23 +GROFFGE123 := $(shell expr `echo $(NROFFISGROFF) | cut -f2 -d.` \>= 23) endif # NROFFISGROFF ifneq "$(NROFFISGROFF)" "" # It's groff -# add the groff-specific plain text flags -MORE_MAN2TXT_FLAGS += -Tascii -P -cbou +# add the -Tascii flag used by groff +MORE_MAN2TXT_FLAGS += -Tascii +ifneq "$(GROFFGE123)" "" # It's groff 1.23 or greater +#$(info GROFFGE123=$(GROFFGE123)) +# add the groff 1.23 specific plain text flag -P +MORE_MAN2TXT_FLAGS += -P endif +# add more plain text flags used by groff +MORE_MAN2TXT_FLAGS += -cbou +endif # end groff-specific #end of hints/include/misc.370 #------------------------------------------------------------------------------