681f16a302b1fa796a15add98b5528d506870e00
[gentoo.git] / sys-devel / automake / automake-1.16.1-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5 PYTHON_COMPAT=( python2_7 )
6
7 inherit python-any-r1 versionator
8
9 if [[ ${PV} == 9999 ]] ; then
10         EGIT_REPO_URI="https://git.savannah.gnu.org/r/${PN}.git"
11
12         inherit git-r3
13 else
14         KEYWORDS="~alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh 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"
15         if [[ ${PV/_beta} == ${PV} ]]; then
16                 MY_P=${P}
17                 SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
18                         https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
19         else
20                 MY_PV="$(get_major_version).$(($(get_version_component_range 2)-1))b"
21                 MY_P="${PN}-${MY_PV}"
22
23                 # Alpha/beta releases are not distributed on the usual mirrors.
24                 SRC_URI="https://alpha.gnu.org/pub/gnu/${PN}/${MY_P}.tar.xz"
25         fi
26         S="${WORKDIR}/${MY_P}"
27 fi
28
29 DESCRIPTION="Used to generate Makefile.in from Makefile.am"
30 HOMEPAGE="https://www.gnu.org/software/automake/"
31
32 LICENSE="GPL-2"
33 # Use Gentoo versioning for slotting.
34 SLOT="${PV:0:4}"
35 IUSE="test"
36 RESTRICT="!test? ( test )"
37
38 RDEPEND="dev-lang/perl
39         >=sys-devel/automake-wrapper-11
40         >=sys-devel/autoconf-2.69:*
41         sys-devel/gnuconfig"
42 DEPEND="${RDEPEND}
43         sys-apps/help2man
44         test? ( ${PYTHON_DEPS} )"
45
46 pkg_setup() {
47         use test && python-any-r1_pkg_setup
48 }
49
50 src_prepare() {
51         default
52         export WANT_AUTOCONF=2.5
53         # Don't try wrapping the autotools this thing runs as it tends
54         # to be a bit esoteric, and the script does `set -e` itself.
55         ./bootstrap || die
56         sed -i -e "/APIVERSION=/s:=.*:=${SLOT}:" configure || die
57
58         # Bug 628912
59         if ! has_version sys-apps/texinfo ; then
60                 touch doc/{stamp-vti,version.texi,automake.info} || die
61         fi
62 }
63
64 # slot the info pages.  do this w/out munging the source so we don't have
65 # to depend on texinfo to regen things.  #464146 (among others)
66 slot_info_pages() {
67         pushd "${ED%/}"/usr/share/info >/dev/null || die
68         rm -f dir || die
69
70         # Rewrite all the references to other pages.
71         # before: * aclocal-invocation: (automake)aclocal Invocation.   Generating aclocal.m4.
72         # after:  * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation.   Generating aclocal.m4.
73         local p pages=( *.info ) args=()
74         for p in "${pages[@]/%.info}" ; do
75                 args+=(
76                         -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
77                         -e "s:(${p}):(${p}-${SLOT}):g"
78                 )
79         done
80         sed -i "${args[@]}" * || die
81
82         # Rewrite all the file references, and rename them in the process.
83         local f d
84         for f in * ; do
85                 d=${f/.info/-${SLOT}.info}
86                 mv "${f}" "${d}" || die
87                 sed -i -e "s:${f}:${d}:g" * || die
88         done
89
90         popd >/dev/null || die
91 }
92
93 src_install() {
94         default
95
96         slot_info_pages
97         rm "${ED%/}"/usr/share/aclocal/README || die
98         rmdir "${ED%/}"/usr/share/aclocal || die
99         rm \
100                 "${ED%/}"/usr/bin/{aclocal,automake} \
101                 "${ED%/}"/usr/share/man/man1/{aclocal,automake}.1 || die
102
103         # remove all config.guess and config.sub files replacing them
104         # w/a symlink to a specific gnuconfig version
105         local x
106         for x in guess sub ; do
107                 dosym ../gnuconfig/config.${x} /usr/share/${PN}-${SLOT}/config.${x}
108         done
109 }