app-eselect/eselect-postgresql: [QA] Fix BadHomepage
[gentoo.git] / eclass / multilib-minimal.eclass
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: multilib-minimal.eclass
5 # @MAINTAINER:
6 # Multilib team <multilib@gentoo.org>
7 # @SUPPORTED_EAPIS: 4 5 6 7
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|6|7) ;;
29         *) die "EAPI=${EAPI} is not supported" ;;
30 esac
31
32
33 [[ ${EAPI} == [45] ]] && inherit eutils
34 inherit multilib-build
35
36 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
37
38
39 multilib-minimal_src_configure() {
40         debug-print-function ${FUNCNAME} "$@"
41
42         multilib-minimal_abi_src_configure() {
43                 debug-print-function ${FUNCNAME} "$@"
44
45                 mkdir -p "${BUILD_DIR}" || die
46                 pushd "${BUILD_DIR}" >/dev/null || die
47                 if declare -f multilib_src_configure >/dev/null ; then
48                         multilib_src_configure
49                 else
50                         default_src_configure
51                 fi
52                 popd >/dev/null || die
53         }
54
55         multilib_foreach_abi multilib-minimal_abi_src_configure
56 }
57
58 multilib-minimal_src_compile() {
59         debug-print-function ${FUNCNAME} "$@"
60
61         multilib-minimal_abi_src_compile() {
62                 debug-print-function ${FUNCNAME} "$@"
63
64                 pushd "${BUILD_DIR}" >/dev/null || die
65                 if declare -f multilib_src_compile >/dev/null ; then
66                         multilib_src_compile
67                 else
68                         default_src_compile
69                 fi
70                 popd >/dev/null || die
71         }
72
73         multilib_foreach_abi multilib-minimal_abi_src_compile
74 }
75
76 multilib-minimal_src_test() {
77         debug-print-function ${FUNCNAME} "$@"
78
79         multilib-minimal_abi_src_test() {
80                 debug-print-function ${FUNCNAME} "$@"
81
82                 pushd "${BUILD_DIR}" >/dev/null || die
83                 if declare -f multilib_src_test >/dev/null ; then
84                         multilib_src_test
85                 else
86                         default_src_test
87                 fi
88                 popd >/dev/null || die
89         }
90
91         multilib_foreach_abi multilib-minimal_abi_src_test
92 }
93
94 multilib-minimal_src_install() {
95         debug-print-function ${FUNCNAME} "$@"
96
97         multilib-minimal_abi_src_install() {
98                 debug-print-function ${FUNCNAME} "$@"
99
100                 pushd "${BUILD_DIR}" >/dev/null || die
101                 if declare -f multilib_src_install >/dev/null ; then
102                         multilib_src_install
103                 else
104                         # default_src_install will not work here as it will
105                         # break handling of DOCS wrt #468092
106                         # so we split up the emake and doc-install part
107                         # this is synced with __eapi4_src_install
108                         if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
109                                 emake DESTDIR="${D}" install
110                         fi
111                 fi
112
113                 multilib_prepare_wrappers
114                 multilib_check_headers
115                 popd >/dev/null || die
116         }
117         multilib_foreach_abi multilib-minimal_abi_src_install
118         multilib_install_wrappers
119
120         if declare -f multilib_src_install_all >/dev/null ; then
121                 multilib_src_install_all
122         else
123                 einstalldocs
124         fi
125 }