void-packages/srcpkgs/mdocml/template
Érico Rolim f732676052 mdocml: fix behavior when localized man pages are present.
Using the -a option with makewhatis(8) makes it scan every file under
the configured manpaths, instead of only the ones in directories that
match "man*". When localized man pages are present, this makes it so
files under the "$some_lang/man*" directories are also indexed, which
can lead, as shown in #28146, to `man w3m` displaying a localized man
page instead of the default english one from /usr/share/man/man1/w3m.1.

Without a mandoc.db in the manpath, man(1) behaves predictably, and
removing from -a from the makewhatis(8) invocations makes it behave
predictably even with a mandoc.db available.

Users who wish to use localized man pages are expected to configure
manpaths in man.conf(5) or use the MANPATH env var.

Fixes #28146
2021-01-26 21:47:33 -03:00

83 lines
2.1 KiB
Bash

# Template file for 'mdocml'
pkgname=mdocml
version=1.14.5
revision=7
wrksrc="mandoc-${version}"
build_style=configure
make_build_args="all man.cgi"
make_check_target="regress"
makedepends="less zlib-devel"
depends="less"
checkdepends="perl"
conf_files="/etc/man.conf"
short_desc="UNIX manpage compiler toolset (mandoc)"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="ISC"
homepage="http://mandoc.bsd.lv"
distfiles="http://mandoc.bsd.lv/snapshots/mandoc-${version}.tar.gz"
checksum=8219b42cb56fc07b2aa660574e6211ac38eefdbf21f41b698d3348793ba5d8f7
provides="man-0_1"
alternatives="
man:man:/usr/bin/mandoc
man:whatis:/usr/bin/mandoc
man:apropos:/usr/bin/mandoc
man:man.1:/usr/share/man/man1/mandoc-man.1
man:whatis.1:/usr/share/man/man1/mandoc-whatis.1
man:apropos.1:/usr/share/man/man1/mandoc-apropos.1"
CFLAGS="-fcommon"
post_patch() {
# use less(1)
vsed -i 's,"more -s","less -s",g' main.c
vsed -i 's,.Xr more,.Xr less,g' *.1
vsed -i 's/^CC=.*/CC=cc/' configure
cat ${FILESDIR}/void.css >>mandoc.css
cp ${FILESDIR}/cgi.h .
}
pre_configure() {
cat >configure.local <<-EOF
PREFIX=/usr
SBINDIR=/usr/bin
MANDIR=/usr/share/man
OSNAME="Void Linux"
BINM_SOELIM=mandoc-soelim
MANM_ROFF="mandoc_roff"
LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS"
CC="$CC"
HAVE_REWB_BSD=0
EOF
case "$XBPS_TARGET_MACHINE" in
*-musl) echo 'UTF8_LOCALE="C.UTF-8"' >>configure.local;;
esac
}
post_install() {
# Rename mans for alternatives
for f in apropos man whatis; do
mv ${DESTDIR}/usr/share/man/man1/{$f,mandoc-$f}.1
done
# Use alternatives.
rm -f ${DESTDIR}/usr/bin/{apropos,man,whatis}
# man(1) configuration file
vconf ${FILESDIR}/man.conf
# remove devel stuff
rm -rf ${DESTDIR}/usr/{include,lib,share/man/man3}
# Daily cron job to generate man db
vinstall ${FILESDIR}/makewhatis.cron.daily 755 etc/cron.daily makewhatis
vlicense LICENSE
}
void-man-cgi_package() {
short_desc="CGI manpage formatter for man.voidlinux.org"
depends="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmkdir usr/libexec/mandoc
vinstall man.cgi 0755 usr/libexec/mandoc
vsconf mandoc.css
vman man.cgi.3
vman man.cgi.8
}
}