aboutsummaryrefslogtreecommitdiffstats
path: root/sys-apps/mandoc/mandoc-1.14.5-r2.ebuild
blob: 1382e719725e7fa15dbf27a305ffbf396c0f5a57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

inherit multilib toolchain-funcs

DESCRIPTION="Suite of tools compiling mdoc and man"
HOMEPAGE="http://mdocml.bsd.lv/"
SRC_URI="http://mdocml.bsd.lv/snapshots/${P}.tar.gz"

LICENSE="ISC"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="+cron static"

LIB_DEPEND="sys-libs/zlib[static-libs(+)]"
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
		 !sys-apps/man-db !sys-apps/man"
DEPEND="${RDEPEND}
	static? ( ${LIB_DEPEND} )"

src_prepare() {
	default

	sed -i -e '/ar rs/s:ar:$(AR):' Makefile || 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"

		BINM_SOELIM=msoelim
		MANM_MAN=mandoc_man
		MANM_ROFF=mandoc_roff

		CFLAGS="${CFLAGS} ${CPPFLAGS}"
		LDFLAGS="${LDFLAGS} $(usex static -static '')"
		AR="$(tc-getAR)"
		CC="$(tc-getCC)"
		# The STATIC variable is only used by man.cgi.
		STATIC=
	EOF
}

src_install() {
	default

	if use cron; then
		exeinto /etc/cron.daily
		newexe "${FILESDIR}"/mandoc.cron mandoc
	fi
}

pkg_postinst() {
	elog "In order to enable mandoc's apropos and man -k functionality,"
	elog "the appropriate mandoc.db files need to be created. This can"
	elog "be achieved by running makewhatis as root (Note: sudo will not"
	elog "work, as it does not preserve the MANPATH environment variable"
	elog "by default)."
	elog
	elog "If the cron use-flag is enabled, a cron.daily entry that calls"
	elog "makewhatis will be installed."
}