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