sys-process/glances: 3.1.4.1-r1 amd64 stable, bug #720368
[gentoo.git] / sys-devel / bison / bison-3.3.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit flag-o-matic
7
8 PATCHES="${PN}-3.3-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         https://dev.gentoo.org/~whissi/dist/bison/${PATCHES}
14         https://dev.gentoo.org/~polynomial-c/dist/bison/${PATCHES}"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 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"
19 IUSE="examples nls static test"
20 RESTRICT="!test? ( test )"
21
22 RDEPEND=">=sys-devel/m4-1.4.16"
23 DEPEND="${RDEPEND}
24         sys-devel/flex
25         examples? ( dev-lang/perl )
26         nls? ( sys-devel/gettext )
27         test? ( dev-lang/perl )"
28
29 DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO ) # ChangeLog-2012 ChangeLog-1998 PACKAGING README-alpha README-release
30
31 PATCHES=(
32         "${WORKDIR}"/patches/${PN}-3.1-optional-perl.patch #538300
33         "${WORKDIR}"/patches/${PN}-3.3-avoid_autoreconf.patch
34 )
35
36 src_prepare() {
37         # Record date to avoid 'config.status --recheck' & regen of 'tests/package.m4'
38         touch -r configure.ac old.configure.ac || die
39         touch -r configure old.configure || die
40
41         default
42
43         # Restore date after patching
44         touch -r old.configure.ac configure.ac || die
45         touch -r old.configure configure || die
46
47         # The makefiles make the man page depend on the configure script
48         # which we patched above.  Touch it to prevent regeneration.
49         touch doc/bison.1 || die #548778 #538300#9
50
51         # Avoid regenerating the info page when the timezone is diff. #574492
52         sed -i '2iexport TZ=UTC' build-aux/mdate-sh || die
53 }
54
55 src_configure() {
56         use static && append-ldflags -static
57
58         local myeconfargs=(
59                 $(use_enable examples)
60                 $(use_enable nls)
61         )
62         econf "${myeconfargs[@]}"
63 }
64
65 src_install() {
66         default
67
68         # This one is installed by dev-util/yacc
69         mv "${ED%/}"/usr/bin/yacc{,.bison} || die
70         mv "${ED%/}"/usr/share/man/man1/yacc{,.bison}.1 || die
71
72         # We do not need liby.a
73         rm -r "${ED%/}"/usr/lib* || die
74
75         # Move to documentation directory and leave compressing for EAPI>=4
76         mv "${ED%/}"/usr/share/${PN}/README "${ED%/}"/usr/share/doc/${PF}/README.data
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 }