*/*: Discontinue Gentoo SuperH port
[gentoo.git] / sys-devel / bison / bison-3.5.3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit flag-o-matic
7
8 PATCHES="${PN}-3.5.1-patches-01.tar.xz"
9
10 DESCRIPTION="A general-purpose (yacc-compatible) parser generator"
11 HOMEPAGE="https://www.gnu.org/software/bison/"
12 SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
13         mirror://gentoo/${PATCHES}
14         https://dev.gentoo.org/~whissi/dist/bison/${PATCHES}
15         https://dev.gentoo.org/~polynomial-c/dist/bison/${PATCHES}"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
20 IUSE="examples nls static test"
21 RESTRICT="!test? ( test )"
22
23 RDEPEND=">=sys-devel/m4-1.4.16"
24 DEPEND="${RDEPEND}"
25 BDEPEND="
26         sys-devel/flex
27         examples? ( dev-lang/perl )
28         nls? ( sys-devel/gettext )
29         test? ( dev-lang/perl )
30 "
31
32 DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO ) # ChangeLog-2012 ChangeLog-1998 PACKAGING README-alpha README-release
33
34 PATCHES=(
35         "${WORKDIR}"/patches/${PN}-3.5-optional-perl.patch #538300
36         "${WORKDIR}"/patches/${PN}-3.5.1-avoid_autoreconf.patch
37 )
38
39 src_prepare() {
40         # Record date to avoid 'config.status --recheck' & regen of 'tests/package.m4'
41         touch -r configure.ac old.configure.ac || die
42         touch -r configure old.configure || die
43
44         default
45
46         # Restore date after patching
47         touch -r old.configure.ac configure.ac || die
48         touch -r old.configure configure || die
49
50         # The makefiles make the man page depend on the configure script
51         # which we patched above.  Touch it to prevent regeneration.
52         touch doc/bison.1 || die #548778 #538300#9
53
54         # Avoid regenerating the info page when the timezone is diff. #574492
55         sed -i '2iexport TZ=UTC' build-aux/mdate-sh || die
56 }
57
58 src_configure() {
59         use static && append-ldflags -static
60
61         local myeconfargs=(
62                 $(use_enable examples)
63                 $(use_enable nls)
64         )
65         econf "${myeconfargs[@]}"
66 }
67
68 src_install() {
69         default
70
71         # This one is installed by dev-util/yacc
72         mv "${ED}"/usr/bin/yacc{,.bison} || die
73         mv "${ED}"/usr/share/man/man1/yacc{,.bison}.1 || die
74
75         # We do not need liby.a
76         rm -r "${ED}"/usr/lib* || die
77 }
78
79 pkg_postinst() {
80         local f="${EROOT}/usr/bin/yacc"
81         if [[ ! -e ${f} ]] ; then
82                 ln -s yacc.bison "${f}"
83         fi
84 }
85
86 pkg_postrm() {
87         # clean up the dead symlink when we get unmerged #377469
88         local f="${EROOT}/usr/bin/yacc"
89         if [[ -L ${f} && ! -e ${f} ]] ; then
90                 rm -f "${f}"
91         fi
92 }