*/*: downgrade m68k down to ~m68k
[gentoo.git] / sys-apps / groff / groff-1.22.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="4"
5
6 inherit autotools eutils toolchain-funcs
7
8 DESCRIPTION="Text formatter used for man pages"
9 HOMEPAGE="https://www.gnu.org/software/groff/groff.html"
10 SRC_URI="mirror://gnu/groff/${P}.tar.gz
11         l10n_ja? ( https://dev.gentoo.org/~naota/patch/${PN}-1.22.1-japanese.patch.bz2 )"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
16 IUSE="examples X l10n_ja"
17
18 RDEPEND="
19         X? (
20                 x11-libs/libX11
21                 x11-libs/libXt
22                 x11-libs/libXmu
23                 x11-libs/libXaw
24                 x11-libs/libSM
25                 x11-libs/libICE
26         )"
27 DEPEND="${RDEPEND}
28         dev-lang/perl
29         l10n_ja? ( virtual/yacc )"
30
31 DOCS=( BUG-REPORT ChangeLog MORE.STUFF NEWS PROBLEMS PROJECTS README REVISION TODO VERSION )
32
33 src_prepare() {
34         epatch "${FILESDIR}"/${PN}-1.19.2-man-unicode-dashes.patch #16108 #17580 #121502
35         epatch "${FILESDIR}"/${PN}-1.22.2-parallel-mom.patch #487276
36
37         # Make sure we can cross-compile this puppy
38         if tc-is-cross-compiler ; then
39                 sed -i \
40                         -e '/^GROFFBIN=/s:=.*:=${EPREFIX}/usr/bin/groff:' \
41                         -e '/^TROFFBIN=/s:=.*:=${EPREFIX}/usr/bin/troff:' \
42                         -e '/^GROFF_BIN_PATH=/s:=.*:=:' \
43                         -e '/^GROFF_BIN_DIR=/s:=.*:=:' \
44                         contrib/*/Makefile.sub \
45                         doc/Makefile.in \
46                         doc/Makefile.sub || die "cross-compile sed failed"
47         fi
48
49         local pfx=$(usex prefix ' Prefix' '')
50         cat <<-EOF >> tmac/mdoc.local
51         .ds volume-operating-system Gentoo${pfx}
52         .ds operating-system Gentoo${pfx}/${KERNEL}
53         .ds default-operating-system Gentoo${pfx}/${KERNEL}
54         EOF
55
56         if use l10n_ja ; then
57                 epatch "${WORKDIR}"/${PN}-1.22.1-japanese.patch #255292 #350534 #450796
58                 eautoconf
59                 eautoheader
60         fi
61
62         # make sure we don't get a crappy `g' nameprefix on UNIX systems with real
63         # troff (GROFF_G macro runs some test to see, its own troff doesn't satisfy)
64         sed -i -e 's/^[ \t]\+g=g$/g=/' configure || die
65 }
66
67 src_configure() {
68         econf \
69                 --with-appresdir="${EPREFIX}"/usr/share/X11/app-defaults \
70                 --docdir="${EPREFIX}"/usr/share/doc/${PF} \
71                 $(use_with X x) \
72                 $(usex l10n_ja '--enable-japanese' '')
73 }
74
75 src_compile() {
76         emake AR="$(tc-getAR)"
77 }
78
79 src_install() {
80         default
81
82         # The following links are required for man #123674
83         dosym eqn /usr/bin/geqn
84         dosym tbl /usr/bin/gtbl
85
86         if ! use examples ; then
87                 # The pdf files might not be generated if ghostscript is unavailable. #602020
88                 local pdf="${ED}/usr/share/doc/${PF}/examples/mom/mom-pdf.pdf"
89                 if [[ -e ${pdf} ]] ; then
90                         # Keep mom-pdf.pdf since it's more of a manual than an example. #454196 #516732
91                         mv "${pdf}" "${ED}"/usr/share/doc/${PF}/pdf/ || die
92                 fi
93                 rm -rf "${ED}"/usr/share/doc/${PF}/examples
94         fi
95 }