/[gentoo-x86]/eclass/autotools-multilib.eclass
Gentoo

Diff of /eclass/autotools-multilib.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.21
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2014 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.6 2013/01/26 11:38:43 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.21 2014/04/03 22:09:36 mgorny Exp $
4 4
5# @ECLASS: autotools-multilib.eclass 5# @ECLASS: autotools-multilib.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# gx86-multilib team <multilib@gentoo.org>
8# @AUTHOR:
7# Michał Górny <mgorny@gentoo.org> 9# Author: Michał Górny <mgorny@gentoo.org>
8# @BLURB: autotools-utils wrapper for multilib builds 10# @BLURB: autotools-utils wrapper for multilib builds
9# @DESCRIPTION: 11# @DESCRIPTION:
10# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper 12# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper
11# introducing support for building for more than one ABI (multilib). 13# introducing support for building for more than one ABI (multilib).
12# 14#
13# Inheriting this eclass sets IUSE=multilib and exports autotools-utils 15# Inheriting this eclass sets the USE flags and exports autotools-utils
14# phase function wrappers which build the package for each supported ABI 16# phase function wrappers which build the package for each supported ABI
15# if the flag is enabled. Otherwise, it works like regular 17# when the relevant flag is enabled. Other than that, it works like
16# autotools-utils. 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.
17# 23#
18# Note that the multilib support requires out-of-source builds to be 24# Note that the multilib support requires out-of-source builds to be
19# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with 25# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with
20# it. 26# it.
21 27
22# EAPI=5 is required for meaningful MULTILIB_USEDEP. 28# EAPI=4 is required for meaningful MULTILIB_USEDEP.
23case ${EAPI:-0} in 29case ${EAPI:-0} in
24 5) ;; 30 4|5) ;;
25 *) die "EAPI=${EAPI} is not supported" ;; 31 *) die "EAPI=${EAPI} is not supported" ;;
26esac 32esac
27 33
28if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then 34inherit autotools-utils eutils multilib-build multilib-minimal
29 die "${ECLASS}: multilib support requires out-of-source builds."
30fi
31 35
32inherit autotools-utils multilib multiprocessing 36EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
33 37
34EXPORT_FUNCTIONS src_configure src_compile src_test src_install 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
35 45
36IUSE=multilib 46# Note: _at_args[@] passing is a backwards compatibility measure.
47# Don't use it in new packages.
37 48
38# @ECLASS-VARIABLE: MULTILIB_USEDEP 49autotools-multilib_src_prepare() {
39# @DESCRIPTION: 50 autotools-utils_src_prepare "${@}"
40# The USE-dependency to be used on dependencies (libraries) needing
41# to support multilib as well.
42#
43# Example use:
44# @CODE
45# RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}]
46# net-libs/libbar[ssl,${MULTILIB_USEDEP}]"
47# @CODE
48MULTILIB_USEDEP=multilib?
49 51
50# @FUNCTION: autotools-multilib_foreach_abi 52 [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && multilib_copy_sources
51# @USAGE: argv... 53}
52# @DESCRIPTION:
53# If multilib support is enabled, sets the toolchain up for each
54# supported ABI along with the ABI variable and correct BUILD_DIR,
55# and runs the given commands with them.
56#
57# If multilib support is disabled, it just runs the commands. No setup
58# is done.
59autotools-multilib_foreach_abi() {
60 local initial_dir=${BUILD_DIR:-${S}}
61 54
62 if use multilib; then 55multilib_src_configure() {
63 local ABI 56 [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR}
64 for ABI in $(get_all_abis); do 57 autotools-utils_src_configure "${_at_args[@]}"
65 multilib_toolchain_setup "${ABI}" 58}
66 BUILD_DIR=${initial_dir%%/}-${ABI} "${@}" 59
67 done 60autotools-multilib_src_configure() {
68 else 61 local _at_args=( "${@}" )
69 "${@}" 62
63 multilib-minimal_src_configure
64}
65
66multilib_src_compile() {
67 emake "${_at_args[@]}"
68}
69
70autotools-multilib_src_compile() {
71 local _at_args=( "${@}" )
72
73 multilib-minimal_src_compile
74}
75
76multilib_src_test() {
77 autotools-utils_src_test "${_at_args[@]}"
78}
79
80autotools-multilib_src_test() {
81 local _at_args=( "${@}" )
82
83 multilib-minimal_src_test
84}
85
86multilib_src_install() {
87 emake DESTDIR="${D}" "${_at_args[@]}" install
88}
89
90multilib_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}}
70 fi 97 fi
71} 98}
72 99
73# @FUNCTION: autotools-multilib_parallel_foreach_abi 100autotools-multilib_src_install() {
74# @USAGE: argv... 101 local _at_args=( "${@}" )
75# @DESCRIPTION:
76# If multilib support is enabled, sets the toolchain up for each
77# supported ABI along with the ABI variable and correct BUILD_DIR,
78# and runs the given commands with them. The commands are run
79# in parallel with number of jobs being determined from MAKEOPTS.
80#
81# If multilib support is disabled, it just runs the commands. No setup
82# is done.
83#
84# Useful for running configure scripts.
85autotools-multilib_parallel_foreach_abi() {
86 local initial_dir=${BUILD_DIR:-${S}}
87 102
88 if use multilib; then 103 multilib-minimal_src_install
89 multijob_init
90
91 local ABI
92 for ABI in $(get_all_abis); do
93 (
94 multijob_child_init
95
96 multilib_toolchain_setup "${ABI}"
97 BUILD_DIR=${initial_dir%%/}-${ABI}
98 "${@}"
99 ) &
100
101 multijob_post_fork
102 done
103
104 multijob_finish
105 else
106 "${@}"
107 fi
108} 104}
109
110autotools-multilib_src_configure() {
111 autotools-multilib_parallel_foreach_abi autotools-utils_src_configure
112}
113
114autotools-multilib_src_compile() {
115 autotools-multilib_foreach_abi autotools-utils_src_compile
116}
117
118autotools-multilib_src_test() {
119 autotools-multilib_foreach_abi autotools-utils_src_test
120}
121
122autotools-multilib_src_install() {
123 autotools-multilib_foreach_abi autotools-utils_src_install
124}

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20