app-text/mandoc: Add from Gentoo

It's from Gentoo commit 62290e51e6cb68978525105151c8f5f9ddbc4a6e.
This commit is contained in:
Krzesimir Nowak 2023-11-23 15:16:18 +01:00
parent 186ee9bfb2
commit b92d6c55d0
5 changed files with 168 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST mandoc-1.14.6.tar.gz 697150 BLAKE2B e9f6087e9df977901815b1231f68e381502c7392b0ac65a060ce0ef270da3b76540a17931a076b700865a02f9ca1a8ca044a54dbf6318756931c29e6b1deb228 SHA512 54286070812a47b629f68757046d3c9a1bdd2b5d1c3b84a5c8e4cb92f1331afa745443f7238175835d8cfbe5b8dd442e00c75c3a5b5b8f8efd8d2ec8f636dad4

View File

@ -0,0 +1,19 @@
diff --git a/Makefile b/Makefile
index f4e2954..191c7e2 100644
--- a/Makefile
+++ b/Makefile
@@ -535,9 +535,11 @@ soelim: $(SOELIM_OBJS)
# --- maintainer targets ---
www-install: www
- $(INSTALL_DATA) mandoc.css $(HTDOCDIR)
- $(INSTALL_DATA) $(WWW_MANS) $(HTDOCDIR)/man
- $(INSTALL_DATA) $(WWW_INCS) $(HTDOCDIR)/includes
+ mkdir -p $(DESTDIR)$(HTDOCDIR)/man
+ mkdir -p $(DESTDIR)$(HTDOCDIR)/includes
+ $(INSTALL_DATA) mandoc.css $(DESTDIR)$(HTDOCDIR)
+ $(INSTALL_DATA) $(WWW_MANS) $(DESTDIR)$(HTDOCDIR)/man
+ $(INSTALL_DATA) $(WWW_INCS) $(DESTDIR)$(HTDOCDIR)/includes
depend: config.h
mkdep -f Makefile.depend $(CFLAGS) $(SRCS)

View File

@ -0,0 +1,6 @@
#!/bin/sh
# need MANPATH
. /etc/profile.env
exec nice makewhatis -T utf8 2>/dev/null

View File

@ -0,0 +1,131 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit toolchain-funcs
DESCRIPTION="Suite of tools compiling mdoc and man"
HOMEPAGE="https://mdocml.bsd.lv/"
SRC_URI="https://mdocml.bsd.lv/snapshots/${P}.tar.gz"
LICENSE="ISC"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ppc ppc64 ~riscv ~s390 sparc x86"
IUSE="cgi selinux system-man test"
RESTRICT="!test? ( test )"
RDEPEND="sys-libs/zlib
system-man? ( !sys-apps/man-db )
"
DEPEND="${RDEPEND}
cgi? ( sys-libs/zlib[static-libs] )
"
BDEPEND="
cgi? ( app-text/highlight )
test? ( dev-lang/perl )
"
RDEPEND+=" selinux? ( sec-policy/selinux-makewhatis )"
PATCHES=(
"${FILESDIR}"/${PN}-1.14.5-r1-www-install.patch
)
pkg_pretend() {
if use system-man ; then
# only support uncompressed and gzip
[[ -n ${PORTAGE_COMPRESS+unset} ]] && \
[[ "${PORTAGE_COMPRESS}" == "gzip" || "${PORTAGE_COMPRESS}" == "" ]] || \
ewarn "only PORTAGE_COMPRESS=gzip or '' is supported, man pages will not be indexed"
fi
}
src_prepare() {
default
# The db-install change is to support parallel installs.
sed -i \
-e '/ar rs/s:ar:$(AR):' \
-e '/^db-install:/s:$: base-install:' \
Makefile || die
# make-4.3 doesn't like the CC line (bug #706024)
# and "echo -n" is not portable
sed \
-e "s@^\(CC=\).*\$@\1\"$(tc-getCC)\"@" \
-e 's@echo -n@printf@g' \
-i configure || die
cat <<-EOF > "configure.local"
PREFIX="${EPREFIX}/usr"
BINDIR="${EPREFIX}/usr/bin"
SBINDIR="${EPREFIX}/usr/sbin"
LIBDIR="${EPREFIX}/usr/$(get_libdir)"
MANDIR="${EPREFIX}/usr/share/man"
INCLUDEDIR="${EPREFIX}/usr/include/mandoc"
EXAMPLEDIR="${EPREFIX}/usr/share/examples/mandoc"
MANPATH_DEFAULT="${EPREFIX}/usr/man:${EPREFIX}/usr/share/man:${EPREFIX}/usr/local/man:${EPREFIX}/usr/local/share/man"
CFLAGS="${CFLAGS} ${CPPFLAGS}"
LDFLAGS="${LDFLAGS}"
AR="$(tc-getAR)"
CC="$(tc-getCC)"
# The STATIC variable is only used by man.cgi.
STATIC=
# conflicts with sys-apps/groff
BINM_SOELIM=msoelim
MANM_ROFF=mandoc_roff
# conflicts with sys-apps/man-pages
MANM_MAN=mandoc_man
# fix utf-8 locale on musl
$(usex elibc_musl UTF8_LOCALE=C.UTF-8 '')
EOF
use system-man || cat <<-EOF >> "configure.local"
BINM_MAN=mman
BINM_APROPOS=mapropos
BINM_WHATIS=mwhatis
BINM_MAKEWHATIS=mmakewhatis
MANM_MDOC=mandoc_mdoc
MANM_EQN=mandoc_eqn
MANM_TBL=mandoc_tbl
MANM_MANCONF=mman.conf
EOF
if use cgi; then
cp cgi.h{.example,} || die
fi
if [[ -n "${MANDOC_CGI_H}" ]]; then
cp "${MANDOC_CGI_H}" cgi.h || die
fi
# ./configure does not propagate all configure.local
# settings to Makefile.local settings.
tc-export AR
}
src_compile() {
default
use cgi && emake man.cgi
}
src_test() {
emake regress
}
src_install() {
emake DESTDIR="${D}" install
use cgi && emake DESTDIR="${D}" cgi-install www-install
if use system-man ; then
exeinto /etc/cron.daily
newexe "${FILESDIR}"/mandoc.cron-r0 mandoc
fi
}
pkg_postinst() {
if use system-man ; then
elog "Generating mandoc database"
makewhatis || die
fi
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>
</maintainer>
<use>
<flag name="cgi">build man.cgi web plugin for viewing man pages</flag>
<flag name="system-man">set as the default man provider</flag>
</use>
</pkgmetadata>