dev-util/qbs: version bump
[gentoo.git] / eclass / multilib-minimal.eclass
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: multilib-minimal.eclass
6 # @MAINTAINER:
7 # Julian Ospald <hasufell@gentoo.org>
8 # @BLURB: wrapper for multilib builds providing convenient multilib_src_* functions
9 # @DESCRIPTION:
10 #
11 # src_configure, src_compile, src_test and src_install are exported.
12 #
13 # Use multilib_src_* instead of src_* which runs this phase for
14 # all enabled ABIs.
15 #
16 # multilib-minimal should _always_ go last in inherit order!
17 #
18 # If you want to use in-source builds, then you must run
19 # multilib_copy_sources at the end of src_prepare!
20 # Also make sure to set correct variables such as
21 # ECONF_SOURCE=${S}
22 #
23 # If you need generic install rules, use multilib_src_install_all function.
24
25
26 # EAPI=4 is required for meaningful MULTILIB_USEDEP.
27 case ${EAPI:-0} in
28         4|5) ;;
29         *) die "EAPI=${EAPI} is not supported" ;;
30 esac
31
32
33 inherit eutils multilib-build
34
35 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
36
37
38 multilib-minimal_src_configure() {
39         debug-print-function ${FUNCNAME} "$@"
40
41         multilib-minimal_abi_src_configure() {
42                 debug-print-function ${FUNCNAME} "$@"
43
44                 mkdir -p "${BUILD_DIR}" || die
45                 pushd "${BUILD_DIR}" >/dev/null || die
46                 if declare -f multilib_src_configure >/dev/null ; then
47                         multilib_src_configure
48                 else
49                         default_src_configure
50                 fi
51                 popd >/dev/null || die
52         }
53
54         multilib_foreach_abi multilib-minimal_abi_src_configure
55 }
56
57 multilib-minimal_src_compile() {
58         debug-print-function ${FUNCNAME} "$@"
59
60         multilib-minimal_abi_src_compile() {
61                 debug-print-function ${FUNCNAME} "$@"
62
63                 pushd "${BUILD_DIR}" >/dev/null || die
64                 if declare -f multilib_src_compile >/dev/null ; then
65                         multilib_src_compile
66                 else
67                         default_src_compile
68                 fi
69                 popd >/dev/null || die
70         }
71
72         multilib_foreach_abi multilib-minimal_abi_src_compile
73 }
74
75 multilib-minimal_src_test() {
76         debug-print-function ${FUNCNAME} "$@"
77
78         multilib-minimal_abi_src_test() {
79                 debug-print-function ${FUNCNAME} "$@"
80
81                 pushd "${BUILD_DIR}" >/dev/null || die
82                 if declare -f multilib_src_test >/dev/null ; then
83                         multilib_src_test
84                 else
85                         default_src_test
86                 fi
87                 popd >/dev/null || die
88         }
89
90         multilib_foreach_abi multilib-minimal_abi_src_test
91 }
92
93 multilib-minimal_src_install() {
94         debug-print-function ${FUNCNAME} "$@"
95
96         multilib-minimal_abi_src_install() {
97                 debug-print-function ${FUNCNAME} "$@"
98
99                 pushd "${BUILD_DIR}" >/dev/null || die
100                 if declare -f multilib_src_install >/dev/null ; then
101                         multilib_src_install
102                 else
103                         # default_src_install will not work here as it will
104                         # break handling of DOCS wrt #468092
105                         # so we split up the emake and doc-install part
106                         # this is synced with __eapi4_src_install
107                         if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
108                                 emake DESTDIR="${D}" install
109                         fi
110                 fi
111
112                 multilib_prepare_wrappers
113                 multilib_check_headers
114                 popd >/dev/null || die
115         }
116         multilib_foreach_abi multilib-minimal_abi_src_install
117         multilib_install_wrappers
118
119         if declare -f multilib_src_install_all >/dev/null ; then
120                 multilib_src_install_all
121         else
122                 einstalldocs
123         fi
124 }