1 |
# Copyright 1999-2014 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.20 2014/01/15 12:12:41 mgorny Exp $ |
4 |
|
5 |
# @ECLASS: autotools-multilib.eclass |
6 |
# @MAINTAINER: |
7 |
# gx86-multilib team <multilib@gentoo.org> |
8 |
# @AUTHOR: |
9 |
# Author: Michał Górny <mgorny@gentoo.org> |
10 |
# @BLURB: autotools-utils wrapper for multilib builds |
11 |
# @DESCRIPTION: |
12 |
# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper |
13 |
# introducing support for building for more than one ABI (multilib). |
14 |
# |
15 |
# Inheriting this eclass sets the USE flags and exports autotools-utils |
16 |
# phase function wrappers which build the package for each supported ABI |
17 |
# when the relevant flag is enabled. Other than that, it works like |
18 |
# regular autotools-utils. |
19 |
# |
20 |
# The multilib phase functions can be overriden via defining multilib_* |
21 |
# phase functions as in multilib-minimal.eclass. In some cases you may |
22 |
# need to call the underlying autotools-utils_* phase though. |
23 |
# |
24 |
# Note that the multilib support requires out-of-source builds to be |
25 |
# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with |
26 |
# it. |
27 |
|
28 |
# EAPI=4 is required for meaningful MULTILIB_USEDEP. |
29 |
case ${EAPI:-0} in |
30 |
4|5) ;; |
31 |
*) die "EAPI=${EAPI} is not supported" ;; |
32 |
esac |
33 |
|
34 |
inherit autotools-utils eutils multilib-build multilib-minimal |
35 |
|
36 |
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install |
37 |
|
38 |
# bug #485046 |
39 |
_autotools-multilib_fix_multilib_minimal() { |
40 |
src_conf=$(declare -f multilib-minimal_src_configure) |
41 |
src_conf=${src_conf/multilib_foreach_abi/multilib_parallel_foreach_abi} |
42 |
eval "${src_conf}" |
43 |
} |
44 |
_autotools-multilib_fix_multilib_minimal |
45 |
|
46 |
# Note: _at_args[@] passing is a backwards compatibility measure. |
47 |
# Don't use it in new packages. |
48 |
|
49 |
autotools-multilib_src_prepare() { |
50 |
autotools-utils_src_prepare "${@}" |
51 |
|
52 |
[[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && multilib_copy_sources |
53 |
} |
54 |
|
55 |
multilib_src_configure() { |
56 |
[[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR} |
57 |
autotools-utils_src_configure "${_at_args[@]}" |
58 |
} |
59 |
|
60 |
autotools-multilib_src_configure() { |
61 |
local _at_args=( "${@}" ) |
62 |
|
63 |
multilib-minimal_src_configure |
64 |
} |
65 |
|
66 |
multilib_src_compile() { |
67 |
emake "${_at_args[@]}" |
68 |
} |
69 |
|
70 |
autotools-multilib_src_compile() { |
71 |
local _at_args=( "${@}" ) |
72 |
|
73 |
multilib-minimal_src_compile |
74 |
} |
75 |
|
76 |
multilib_src_test() { |
77 |
autotools-utils_src_test "${_at_args[@]}" |
78 |
} |
79 |
|
80 |
autotools-multilib_src_test() { |
81 |
local _at_args=( "${@}" ) |
82 |
|
83 |
multilib-minimal_src_test |
84 |
} |
85 |
|
86 |
multilib_src_install() { |
87 |
emake DESTDIR="${D}" "${_at_args[@]}" install |
88 |
} |
89 |
|
90 |
multilib_src_install_all() { |
91 |
einstalldocs |
92 |
|
93 |
# Remove libtool files and unnecessary static libs |
94 |
local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES} |
95 |
if [[ ${prune_ltfiles} != none ]]; then |
96 |
prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}} |
97 |
fi |
98 |
} |
99 |
|
100 |
autotools-multilib_src_install() { |
101 |
local _at_args=( "${@}" ) |
102 |
|
103 |
multilib-minimal_src_install |
104 |
} |