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