]> git.draconx.ca Git - gentoo-fixes.git/blob - sys-apps/man/man-1.6g-r3.ebuild
app-emulation/wine-vanilla-4.0.4: Adapt mpg123 dependency.
[gentoo-fixes.git] / sys-apps / man / man-1.6g-r3.ebuild
1 # Copyright © 2018-2019, 2022 Nick Bowler
2 # License GPLv2+: GNU General Public License version 2 or any later version.
3 # This is free software: you are free to change and distribute it.
4 # There is NO WARRANTY, to the extent permitted by law.
5 #
6 # This a modified version of the original ebuild from Gentoo GNU/Linux,
7 # covered by the following copyright and permission notice:
8 #
9 #   Copyright 1999-2018 Gentoo Foundation
10 #   Distributed under the terms of the GNU General Public License v2
11 #
12 # The modifications are:
13 #
14 #   * Fix nonportable "echo" usage (2018-10)
15 #   * Convert to EAPI 6 patch application (2019-03)
16 #   * Improve /etc/cron.daily/makewhatis installation (2019-03)
17 #   * Convert from user.eclass to GLEP 81 user/group packages (2022-12)
18
19 EAPI="6"
20
21 inherit eutils prefix toolchain-funcs
22
23 DESCRIPTION="Standard commands to read man pages"
24 HOMEPAGE="http://primates.ximian.com/~flucifredi/man/"
25 SRC_URI="http://primates.ximian.com/~flucifredi/man/${P}.tar.gz"
26
27 LICENSE="GPL-2"
28 SLOT="0"
29 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd"
30 IUSE="+lzma nls selinux"
31
32 DEPEND="nls? ( sys-devel/gettext )"
33 RDEPEND="|| ( >=sys-apps/groff-1.19.2-r1 app-doc/heirloom-doctools )
34         !sys-apps/man-db
35         !<app-arch/lzma-4.63
36         lzma? ( app-arch/xz-utils )
37         selinux? ( sec-policy/selinux-makewhatis )
38         acct-group/man
39         acct-user/man"
40
41 PATCHES=(
42         "${FILESDIR}"/man-1.6f-man2html-compression-2.patch
43         "${FILESDIR}"/man-1.6-cross-compile.patch
44         "${FILESDIR}"/man-1.6f-unicode.patch #146315
45         "${FILESDIR}"/man-1.6c-cut-duplicate-manpaths.patch
46         "${FILESDIR}"/man-1.5m2-apropos.patch
47         "${FILESDIR}"/man-1.6g-fbsd.patch #138123
48         "${FILESDIR}"/man-1.6e-headers.patch
49         "${FILESDIR}"/man-1.6f-so-search-2.patch
50         "${FILESDIR}"/man-1.6g-compress.patch #205147
51         "${FILESDIR}"/man-1.6f-parallel-build.patch #207148 #258916
52         "${FILESDIR}"/man-1.6g-xz.patch #302380
53         "${FILESDIR}"/man-1.6f-makewhatis-compression-cleanup.patch #331979
54         "${FILESDIR}"/man-1.6g-nonportable-echo.patch #651038
55 )
56
57 src_prepare() {
58         # make sure `less` handles escape sequences #287183
59         sed -i -e '/^DEFAULTLESSOPT=/s:"$:R":' configure
60         default
61 }
62
63 echoit() { echo "$@" ; "$@" ; }
64 src_configure() {
65         strip-linguas $(eval $(grep ^LANGUAGES= configure) ; echo ${LANGUAGES//,/ })
66
67         unset NLSPATH #175258
68
69         tc-export CC BUILD_CC
70
71         local mylang=
72         if use nls ; then
73                 if [[ -z ${LINGUAS} ]] ; then
74                         mylang="all"
75                 else
76                         mylang="${LINGUAS// /,}"
77                 fi
78         else
79                 mylang="none"
80         fi
81         export COMPRESS
82         if use lzma ; then
83                 COMPRESS="${EPREFIX}"/usr/bin/xz
84         else
85                 COMPRESS="${EPREFIX}"/bin/bzip2
86         fi
87
88         if [[ -n ${EPREFIX} ]]; then
89                 hprefixify configure || die
90                 sed -i \
91                         -e "s/man_user=root/man_user=$(id -u)/"  \
92                         -e "s/man_group=man/man_group=$(id -g)/" \
93                         configure || die "Failed to disable suid/sgid options for man"
94                 sed -i -e 's:/usr/bin:@bindir@:' man2html/Makefile.in || die
95         fi
96
97         echoit \
98         ./configure \
99                 -prefix="$EPREFIX/usr" \
100                 -confdir="$EPREFIX/etc" \
101                 +sgid +fhs \
102                 +lang ${mylang} \
103                 || die "configure failed"
104
105         cat >makewhatis.cron <<EOF
106 #!/bin/sh
107
108 exec nice $EPREFIX/usr/sbin/makewhatis -u
109 EOF
110 }
111
112 src_install() {
113         unset NLSPATH #175258
114
115         emake PREFIX="${D}" install || die "make install failed"
116         dosym man /usr/bin/manpath
117
118         dodoc LSM README* TODO
119
120         # makewhatis only adds man-pages from the last 24hrs
121         exeinto /etc/cron.daily
122         newexe makewhatis.cron makewhatis
123
124         keepdir /var/cache/man
125         [[ -z ${EPREFIX} ]] && diropts -m0775 -g man
126         local mansects=$(grep ^MANSECT "${ED}"/etc/man.conf | cut -f2-)
127         for x in ${mansects//:/ } ; do
128                 keepdir /var/cache/man/cat${x}
129         done
130 }
131
132 pkg_postinst() {
133         einfo "Forcing sane permissions onto ${ROOT}var/cache/man (Bug #40322)"
134         chown -R root:man "${ROOT}"/var/cache/man
135         chmod -R g+w "${ROOT}"/var/cache/man
136         [[ -e ${ROOT}/var/cache/man/whatis ]] \
137                 && chown root:0 "${ROOT}"/var/cache/man/whatis
138
139         echo
140
141         if has_version app-doc/heirloom-doctools; then
142                 ewarn "Please note that the /etc/man.conf file installed will not"
143                 ewarn "work with heirloom's nroff by default (yet)."
144                 ewarn ""
145                 ewarn "Check app-doc/heirloom-doctools elog messages for the proper"
146                 ewarn "configuration."
147         fi
148 }