meson.eclass: Don't mix host *FLAGS with build *FLAGS
[gentoo.git] / eclass / autotools-multilib.eclass
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: autotools-multilib.eclass
5 # @MAINTAINER:
6 # gx86-multilib team <multilib@gentoo.org>
7 # @AUTHOR:
8 # Author: Michał Górny <mgorny@gentoo.org>
9 # @BLURB: autotools-utils wrapper for multilib builds
10 # @DESCRIPTION:
11 # The autotools-multilib.eclass provides a glue between
12 # autotools-utils.eclass(5) and multilib-minimal.eclass(5), aiming
13 # to provide a convenient way to build packages using autotools
14 # for multiple ABIs.
15 #
16 # Inheriting this eclass sets IUSE and exports default multilib_src_*()
17 # sub-phases that call autotools-utils phase functions for each ABI
18 # enabled. The multilib_src_*() functions can be defined in ebuild just
19 # like in multilib-minimal.
20
21 # EAPI=4 is required for meaningful MULTILIB_USEDEP.
22 case ${EAPI:-0} in
23         6) die "${ECLASS}.eclass is banned in EAPI ${EAPI}";;
24         4|5) ;;
25         *) die "EAPI=${EAPI} is not supported" ;;
26 esac
27
28 inherit autotools-utils eutils multilib-build multilib-minimal
29
30 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
31
32 # Note: _at_args[@] passing is a backwards compatibility measure.
33 # Don't use it in new packages.
34
35 autotools-multilib_src_prepare() {
36         autotools-utils_src_prepare "${@}"
37
38         [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && multilib_copy_sources
39 }
40
41 multilib_src_configure() {
42         [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR}
43         autotools-utils_src_configure "${_at_args[@]}"
44 }
45
46 autotools-multilib_src_configure() {
47         local _at_args=( "${@}" )
48
49         multilib-minimal_src_configure
50 }
51
52 multilib_src_compile() {
53         emake "${_at_args[@]}"
54 }
55
56 autotools-multilib_src_compile() {
57         local _at_args=( "${@}" )
58
59         multilib-minimal_src_compile
60 }
61
62 multilib_src_test() {
63         autotools-utils_src_test "${_at_args[@]}"
64 }
65
66 autotools-multilib_src_test() {
67         local _at_args=( "${@}" )
68
69         multilib-minimal_src_test
70 }
71
72 multilib_src_install() {
73         emake DESTDIR="${D}" "${_at_args[@]}" install
74 }
75
76 multilib_src_install_all() {
77         einstalldocs
78
79         # Remove libtool files and unnecessary static libs
80         local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES}
81         if [[ ${prune_ltfiles} != none ]]; then
82                 prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}}
83         fi
84 }
85
86 autotools-multilib_src_install() {
87         local _at_args=( "${@}" )
88
89         multilib-minimal_src_install
90 }