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

Contents of /eclass/autotools-multilib.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Sat Jan 26 11:35:38 2013 UTC (18 months, 3 weeks ago) by mgorny
Branch: MAIN
Changes since 1.4: +40 -3 lines
Support running commands in parallel and use it to run configure scripts.

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

  ViewVC Help
Powered by ViewVC 1.1.20