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