From 105f26b55c3c3ffc9913e781deca4c5973a4940c Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 22 Apr 2019 17:24:19 +0200 Subject: [PATCH] Switch to the new man(1) command. * Exchange our old GNU man(1) command with the one from FreeBSD that I recently imported. It uses mandoc(1) by default. If mandoc(1) reports that it cannot render a page, man(1) will fall back to groff (right now our base groff, later the groff pkg when we remove it). * Install mandoc(1) as apropos(1) and makewhatis(8). This means makewhatis moves from /usr/sbin to /usr/bin. * Use mandoc(1) instead of groff for most purposes of bsd.man.mk. * Remove /usr/share/man/cat*. It's not necessary anymore to cache formatted manual pages. --- Makefile.inc1 | 2 +- Makefile_upgrade.inc | 14 +++++++++++++- etc/Makefile | 12 ------------ etc/mtree/BSD.usr.dist | 20 -------------------- gnu/usr.bin/Makefile | 2 +- share/examples/etc/README.examples | 1 - share/man/Makefile | 6 +++--- share/man/man5/Makefile | 1 - share/mk/bsd.man.mk | 28 +++++++++++++++------------- usr.bin/Makefile | 1 + usr.bin/mandoc/Makefile | 7 +++++-- usr.sbin/Makefile | 1 - 12 files changed, 39 insertions(+), 56 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index f0eb1cca45..06c680ad04 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -872,7 +872,7 @@ BSTRAPDIRS2= \ usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \ usr.bin/tail usr.bin/unifdef \ usr.sbin/chown usr.sbin/mtree usr.sbin/config \ - usr.sbin/zic usr.sbin/makewhatis usr.sbin/pwd_mkdb \ + usr.sbin/zic usr.sbin/pwd_mkdb \ gnu/usr.bin/grep usr.bin/sort usr.bin/gzip \ usr.bin/mkcsmapper usr.bin/mkesdb usr.bin/crunch diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 4211758030..bf8509d672 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -86,7 +86,6 @@ TO_REMOVE+=/usr/lib/libstdc++.so.3 TO_REMOVE+=/usr/lib/libstdc++_p.a TO_REMOVE+=/usr/libexec/binutils214 TO_REMOVE+=/usr/libexec/binutils215 -TO_REMOVE+=/usr/bin/makewhatis TO_REMOVE+=/usr/sbin/prebind TO_REMOVE+=/modules/checkpt.ko TO_REMOVE+=/usr/share/man/man1aout @@ -3522,6 +3521,19 @@ TO_REMOVE+=/usr/bin/catman TO_REMOVE+=/usr/libexec/catman.local TO_REMOVE+=/usr/share/man/man1/catman.1.gz TO_REMOVE+=/usr/share/man/man8/catman.local.8.gz +TO_REMOVE+=/etc/manpath.config +TO_REMOVE+=/usr/sbin/makewhatis +TO_REMOVE+=/usr/share/man/cat1 +TO_REMOVE+=/usr/share/man/cat2 +TO_REMOVE+=/usr/share/man/cat3 +TO_REMOVE+=/usr/share/man/cat4 +TO_REMOVE+=/usr/share/man/cat5 +TO_REMOVE+=/usr/share/man/cat6 +TO_REMOVE+=/usr/share/man/cat7 +TO_REMOVE+=/usr/share/man/cat8 +TO_REMOVE+=/usr/share/man/cat9 +TO_REMOVE+=/usr/share/man/man5/manpath.config.5.gz +TO_REMOVE+=/usr/share/man/whatis .if !defined(WANT_INSTALLER) TO_REMOVE+=/usr/sbin/dfuibe_installer diff --git a/etc/Makefile b/etc/Makefile index ddd4eec4e1..224caf05ed 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -35,11 +35,6 @@ BIN1= auth.conf auto_master \ shells sysctl.conf syslog.conf \ wpa_supplicant.conf \ etc.${MACHINE_ARCH}/ttys -.if defined(BINARY_UPGRADE) # location of these depends on upgrade method -BIN1+= manpath.config -.else -BIN1+= ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config -.endif DIRS+= lib/libssh usr.bin/openssl usr.bin/ssh usr.sbin/sshd @@ -79,13 +74,6 @@ remove-obsolete-files: rm -rf "${DESTDIR}$${item}"; \ fi; \ done; - @for item in ${TO_REMOVE:M*/man/man[1-9]/*:C@/man/man([1-9])/@/man/cat\1/@g}; do \ - if [ -e ${DESTDIR}$${item} ]; then \ - echo "${DESTDIR}$${item}"; \ - chflags -Rf noschg "${DESTDIR}$${item}"; \ - rm -rf "${DESTDIR}$${item}"; \ - fi; \ - done remove-deprecated-files: .if defined(REMOVE_DEPRECATED) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 498ae85298..47a0272d99 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -709,26 +709,6 @@ .. .. man -/set uname=man - cat1 - .. - cat2 - .. - cat3 - .. - cat4 - .. - cat5 - .. - cat6 - .. - cat7 - .. - cat8 - .. - cat9 - .. -/set uname=root man1 .. man2 diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile index 4d0fb0af8c..1fca2efe86 100644 --- a/gnu/usr.bin/Makefile +++ b/gnu/usr.bin/Makefile @@ -2,7 +2,7 @@ .include "Makefile.buo" -SUBDIR= dialog diff grep groff man rcs +SUBDIR= dialog diff grep groff rcs .if !defined(NO_CVS) SUBDIR+=cvs diff --git a/share/examples/etc/README.examples b/share/examples/etc/README.examples index 68629e8cb4..eb52143091 100644 --- a/share/examples/etc/README.examples +++ b/share/examples/etc/README.examples @@ -35,7 +35,6 @@ locate.rc - configuration file for locate(1) login.access - configuration file for login(8) login.conf - login class capabilities database mail.rc - systemwide initialization files for mail(1) -manpath.config - configuration file for man(1) modems - modem configuration database motd - sample Message of the Day netconfig - network configuration database diff --git a/share/man/Makefile b/share/man/Makefile index 37a3dd6fa9..732e604adc 100644 --- a/share/man/Makefile +++ b/share/man/Makefile @@ -3,10 +3,10 @@ SUBDIR= man1 man3 man4 man5 man6 man7 man8 man9 -MAKEWHATIS= /usr/sbin/makewhatis - +MAKEWHATIS= /usr/bin/makewhatis + makedb: ${MAKEWHATIS} ${DESTDIR}${BINDIR}/man - + .include "${.CURDIR}/../Makefile.inc" .include diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile index 1bd8c19425..845396976d 100644 --- a/share/man/man5/Makefile +++ b/share/man/man5/Makefile @@ -31,7 +31,6 @@ MAN= acct.5 \ loader.conf.5 \ mailer.conf.5 \ make.conf.5 \ - manpath.config.5 \ motd.5 \ msdos.5 \ networks.5 \ diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 4f731945eb..e2ece0b78d 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -1,6 +1,6 @@ # $FreeBSD: src/share/mk/bsd.man.mk,v 1.31.2.11 2002/12/19 13:48:33 ru Exp $ # -# The include file handles installing manual pages and +# The include file handles installing manual pages and # their links. # # @@ -26,11 +26,11 @@ # stdout. [${COMPRESS_CMD}] # # MLINKS List of manual page links (using a suffix). The -# linked-to file must come first, the linked file -# second, and there may be multiple pairs. The files +# linked-to file must come first, the linked file +# second, and there may be multiple pairs. The files # are hard-linked. # -# NOMANCOMPRESS If you do not want unformatted manual pages to be +# NOMANCOMPRESS If you do not want unformatted manual pages to be # compressed when they are installed. [not set] # # NOMLINKS If you do not want install manual page links. [not set] @@ -41,7 +41,8 @@ # MANBUILDCAT create preformatted manual pages in addition to normal # pages. [not set] # -# MROFF_CMD command and flags to create preformatted pages +# MANDOC_CMD command and flags to create preformatted pages +# MROFF_CMD groff command for manlint and mandiff # # +++ targets +++ # @@ -60,6 +61,7 @@ MINSTALL?= ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ CATDIR= ${MANDIR:H:S/$/\/cat/} CATEXT= .cat +MANDOC_CMD?= mandoc -Tascii MROFF_CMD?= groff -Tascii -mtty-char -man -t MCOMPRESS_CMD?= ${COMPRESS_CMD} @@ -106,7 +108,7 @@ ${target}: ${page} .for target in ${page:T:S/$/${CATEXT}${FILTEXTENSION}/g} _manpages: ${target} ${target}: ${page} - ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} > ${.TARGET} + ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} > ${.TARGET} .endfor .endif .endfor @@ -119,7 +121,7 @@ CLEANFILES+= ${MAN:T:S/$/${CATEXT}/g} .for target in ${page:T:S/$/${CATEXT}/g} _manpages: ${target} ${target}: ${page} - ${MROFF_CMD} ${.ALLSRC} > ${.TARGET} + ${MANDOC_CMD} ${.ALLSRC} > ${.TARGET} .endfor .endfor .else @@ -150,9 +152,9 @@ ${target}: ${page} _manpages: ${target} ${target}: ${page} .if defined(MANFILTER) - ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} | ${MCOMPRESS_CMD} > ${.TARGET} + ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} | ${MCOMPRESS_CMD} > ${.TARGET} .else - ${MROFF_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET} + ${MANDOC_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET} .endif .endfor .endif @@ -248,15 +250,15 @@ mandiff: ${page}diff ${page}lint: ${page} .if defined(MANFILTER) @${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} -ww -z - @-${MANFILTER} < ${.ALLSRC} | mandoc -Tlint + @-${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint .else @${MROFF_CMD} -ww -z ${.ALLSRC} - @-mandoc -Tlint ${.ALLSRC} + @-${MANDOC_CMD} -Tlint ${.ALLSRC} .endif ${page}.out.groff: ${page} - @-nroff -man -t ${.ALLSRC} 2>&1 > ${.TARGET} + @-${MROFF_CMD} ${.ALLSRC} 2>&1 > ${.TARGET} ${page}.out.mandoc: ${page} - @-mandoc -Werror ${.ALLSRC} 2>&1 > ${.TARGET} + @-${MANDOC_CMD} -Werror ${.ALLSRC} 2>&1 > ${.TARGET} ${page}diff: ${page}.out.groff ${page}.out.mandoc @-diff -au ${.ALLSRC} @rm ${.ALLSRC} diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 6a3759539c..0cfc21893f 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -115,6 +115,7 @@ SUBDIR= alias \ lzmainfo \ m4 \ mail \ + man \ mandoc \ mesg \ ministat \ diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile index 2ef3c3c42c..e95dfcf83d 100644 --- a/usr.bin/mandoc/Makefile +++ b/usr.bin/mandoc/Makefile @@ -1,8 +1,8 @@ .PATH: ${.CURDIR}/../../contrib/mdocml PROG= mandoc -MAN= mandoc.1 mandoc_char.7 -#MAN+= apropos.1 mandoc.db.5 eqn.7 man.7 mdoc.7 roff.7 tbl.7 makewhatis.8 +MAN= apropos.1 mandoc.1 mandoc.db.5 mandoc_char.7 makewhatis.8 +#MAN+= eqn.7 man.7 mdoc.7 roff.7 tbl.7 WARNS?= 3 CFLAGS+=-I${.CURDIR} @@ -28,4 +28,7 @@ SRCS+= compat_ohash.c compat_recallocarray.c LDADD= -lz DPADD= ${LIBZ} +LINKS= ${BINDIR}/mandoc ${BINDIR}/apropos +LINKS+= ${BINDIR}/mandoc ${BINDIR}/makewhatis + .include diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 06a80c3b45..dd5b805d5e 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -56,7 +56,6 @@ SUBDIR= 802_11 \ lastlogin \ mailwrapper \ makefs \ - makewhatis \ manctl \ memcontrol \ mergemaster \ -- 2.41.0