/[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.7 Revision 1.12
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 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.7 2013/01/26 11:39:41 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.12 2013/02/27 21:47:38 mgorny Exp $
4 4
5# @ECLASS: autotools-multilib.eclass 5# @ECLASS: autotools-multilib.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Michał Górny <mgorny@gentoo.org> 7# Michał Górny <mgorny@gentoo.org>
8# @BLURB: autotools-utils wrapper for multilib builds 8# @BLURB: autotools-utils wrapper for multilib builds
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper 10# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper
11# introducing support for building for more than one ABI (multilib). 11# introducing support for building for more than one ABI (multilib).
12# 12#
13# Inheriting this eclass sets IUSE=multilib and exports autotools-utils 13# Inheriting this eclass sets the USE flags and exports autotools-utils
14# phase function wrappers which build the package for each supported ABI 14# phase function wrappers which build the package for each supported ABI
15# if the flag is enabled. Otherwise, it works like regular 15# when the relevant flag is enabled. Other than that, it works like
16# autotools-utils. 16# regular autotools-utils.
17# 17#
18# Note that the multilib support requires out-of-source builds to be 18# 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 19# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with
20# it. 20# it.
21 21
27 27
28if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then 28if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
29 die "${ECLASS}: multilib support requires out-of-source builds." 29 die "${ECLASS}: multilib support requires out-of-source builds."
30fi 30fi
31 31
32inherit autotools-utils multilib multiprocessing 32inherit autotools-utils multilib-build
33 33
34EXPORT_FUNCTIONS src_configure src_compile src_test src_install 34EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
35 35
36IUSE=multilib
37
38# @ECLASS-VARIABLE: MULTILIB_USEDEP
39# @DESCRIPTION:
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
50# @FUNCTION: autotools-multilib_foreach_abi
51# @USAGE: argv...
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() { 36autotools-multilib_src_prepare() {
60 local initial_dir=${BUILD_DIR:-${S}} 37 autotools-utils_src_prepare "${@}"
61
62 if use multilib; then
63 local ABI
64 for ABI in $(get_all_abis); do
65 multilib_toolchain_setup "${ABI}"
66 BUILD_DIR=${initial_dir%%/}-${ABI} "${@}"
67 done
68 else
69 "${@}"
70 fi
71}
72
73# @FUNCTION: autotools-multilib_parallel_foreach_abi
74# @USAGE: argv...
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
88 if use multilib; then
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} 38}
109 39
110autotools-multilib_src_configure() { 40autotools-multilib_src_configure() {
111 autotools-multilib_parallel_foreach_abi autotools-utils_src_configure 41 multilib_parallel_foreach_abi autotools-utils_src_configure "${@}"
112} 42}
113 43
114autotools-multilib_src_compile() { 44autotools-multilib_src_compile() {
115 autotools-multilib_foreach_abi autotools-utils_src_compile 45 multilib_foreach_abi autotools-utils_src_compile "${@}"
116} 46}
117 47
118autotools-multilib_src_test() { 48autotools-multilib_src_test() {
119 autotools-multilib_foreach_abi autotools-utils_src_test 49 multilib_foreach_abi autotools-utils_src_test "${@}"
120} 50}
121 51
122autotools-multilib_src_install() { 52autotools-multilib_src_install() {
53 autotools-multilib_secure_install() {
54 autotools-utils_src_install "${@}"
55
56 # Make sure all headers are the same for each ABI.
57 multilib_check_headers
58 }
59
123 autotools-multilib_foreach_abi autotools-utils_src_install 60 multilib_foreach_abi autotools-multilib_secure_install "${@}"
124} 61}

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20