packages: Add a mandoc package

Move mandoc to its own package so users can install it independently of
-utilities.  Put the package in the minimal set, since we also ship
manpages in minimal and "man" is a basic Unix utility.

Add a pkg-triggers(5) hook to run makewhatis when new manpages are
installed, so that apropos(1) works.  This depends on a new pkg(8)
feature expected to be in in the upcoming 2.3.2 release; in the mean
time, this is a no-op (i.e., having an older pkg doesn't break anything,
it just won't run the trigger).

MFC after:	3 seconds
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52564
This commit is contained in:
Lexi Winter 2025-09-18 10:14:45 +01:00
parent 9065390ddc
commit ea5e50c298
5 changed files with 41 additions and 0 deletions

View file

@ -28,6 +28,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 16.x IS SLOW:
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20250918:
mandoc (including /usr/bin/man) has been moved to a new package,
FreeBSD-mandoc. If you have the minimal set installed, this package
will be installed automatically, otherwise you may want to install it.
Kyua has been moved to the FreeBSD-kyua package, and ATF has been moved
to the FreeBSD-atf* packages. If you have FreeBSD-tests installed,
these packages will be installed automatically, otherwise you should

View file

@ -0,0 +1,11 @@
comment = "Online manual page reader"
desc = <<EOD
This packages provides man(1), a utility which can format and display system
manual pages, along with the related utilities apropos(1) and makewhatis(8),
and the mandoc(1) backend.
EOD
annotations {
set = minimal
}

View file

@ -1,3 +1,5 @@
PACKAGE= mandoc
SCRIPTS= man.sh
LINKS= ${BINDIR}/man ${BINDIR}/manpath

View file

@ -3,6 +3,8 @@
MANDOCDIR= ${SRCTOP}/contrib/mandoc
.PATH: ${MANDOCDIR}
PACKAGE= mandoc
PROG= mandoc
MAN= mandoc.1 mandoc.db.5 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 roff.7
MLINKS= mandoc.1 mdocml.1
@ -16,6 +18,10 @@ LINKS= ${BINDIR}/mandoc ${BINDIR}/whatis \
.error MK_MAN_UTILS should be set to yes when bootstrapping
.endif
FILESGROUPS= TRIGGERS
TRIGGERS= mandoc.ucl
TRIGGERSDIR= /usr/share/pkg/triggers
LIBMAN_SRCS= man.c \
man_macro.c \
man_validate.c

18
usr.bin/mandoc/mandoc.ucl Normal file
View file

@ -0,0 +1,18 @@
path_glob: "/usr/share/man/*"
cleanup: {
type: lua
sandbox: false
script: <<EOD
os.remove("/usr/share/man/mandoc.db")
EOD
}
trigger: {
type: lua
sandbox: false
script: <<EOD
print("Generating apropos(1) database...")
pkg.exec({"/usr/bin/makewhatis", "/usr/share/man"})
EOD
}