dev-python/hypothesis: Bump to 5.8.3
[gentoo.git] / eclass / toolchain-autoconf.eclass
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: toolchain-autoconf.eclass
5 # @MAINTAINER:
6 # <base-system@gentoo.org>
7 # @SUPPORTED_EAPIS: 6 7
8 # @BLURB: Common code for sys-devel/autoconf ebuilds
9 # @DESCRIPTION:
10 # This eclass contains the common phase functions migrated from
11 # sys-devel/autoconf eblits.
12
13 case ${EAPI:-0} in
14         [0-5])
15                 die "${ECLASS} is banned in EAPI ${EAPI:-0}"
16                 ;;
17         [6-7])
18                 ;;
19         *)
20                 die "Unknown EAPI ${EAPI:-0}"
21                 ;;
22 esac
23
24 if [[ -z ${_TOOLCHAIN_AUTOCONF_ECLASS} ]]; then
25
26 EXPORT_FUNCTIONS src_prepare src_configure src_install
27
28 toolchain-autoconf_src_prepare() {
29         find -name Makefile.in -exec sed -i '/^pkgdatadir/s:$:-@VERSION@:' {} + || die
30         default
31 }
32
33 toolchain-autoconf_src_configure() {
34         # Disable Emacs in the build system since it is in a separate package.
35         export EMACS=no
36         econf --program-suffix="-${PV}" || die
37         # econf updates config.{sub,guess} which forces the manpages
38         # to be regenerated which we dont want to do #146621
39         touch man/*.1
40 }
41
42 # slot the info pages.  do this w/out munging the source so we don't have
43 # to depend on texinfo to regen things.  #464146 (among others)
44 slot_info_pages() {
45         [[ ${SLOT} == "0" ]] && return
46
47         pushd "${ED}"/usr/share/info >/dev/null || die
48         rm -f dir || die
49
50         # Rewrite all the references to other pages.
51         # before: * aclocal-invocation: (automake)aclocal Invocation.   Generating aclocal.m4.
52         # after:  * aclocal-invocation v1.13: (automake-1.13)aclocal Invocation.   Generating aclocal.m4.
53         local p pages=( *.info ) args=()
54         for p in "${pages[@]/%.info}" ; do
55                 args+=(
56                         -e "/START-INFO-DIR-ENTRY/,/END-INFO-DIR-ENTRY/s|: (${p})| v${SLOT}&|"
57                         -e "s:(${p}):(${p}-${SLOT}):g"
58                 )
59         done
60         sed -i "${args[@]}" * || die
61
62         # Rewrite all the file references, and rename them in the process.
63         local f d
64         for f in * ; do
65                 d=${f/.info/-${SLOT}.info}
66                 mv "${f}" "${d}" || die
67                 sed -i -e "s:${f}:${d}:g" * || die
68         done
69
70         popd >/dev/null || die
71 }
72
73 toolchain-autoconf_src_install() {
74         default
75         slot_info_pages
76 }
77
78 _TOOLCHAIN_AUTOCONF_ECLASS=1
79 fi