1 |
The eclass does: |
2 |
|
3 |
- export proper USE flags to control the built ABIs, |
4 |
|
5 |
- provide MULTILIB_USEDEP to write proper USE dependencies, |
6 |
|
7 |
- provide utility functions to run commands for each ABI. |
8 |
--- |
9 |
gx86/eclass/multilib-build.eclass | 103 ++++++++++++++++++++++++++++++++++++++ |
10 |
1 file changed, 103 insertions(+) |
11 |
create mode 100644 gx86/eclass/multilib-build.eclass |
12 |
|
13 |
diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass |
14 |
new file mode 100644 |
15 |
index 0000000..d8bd5ab |
16 |
--- /dev/null |
17 |
+++ b/gx86/eclass/multilib-build.eclass |
18 |
@@ -0,0 +1,103 @@ |
19 |
+# Copyright 1999-2013 Gentoo Foundation |
20 |
+# Distributed under the terms of the GNU General Public License v2 |
21 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.7 2013/01/26 11:39:41 mgorny Exp $ |
22 |
+ |
23 |
+# @ECLASS: multilib-build.eclass |
24 |
+# @MAINTAINER: |
25 |
+# Michał Górny <mgorny@g.o> |
26 |
+# @BLURB: flags and utility functions for building multilib packages |
27 |
+# @DESCRIPTION: |
28 |
+# The multilib-build.eclass exports USE flags and utility functions |
29 |
+# necessary to build packages for multilib in a clean and uniform |
30 |
+# manner. |
31 |
+# |
32 |
+# Please note that dependency specifications for multilib-capable |
33 |
+# dependencies shall use the USE dependency string in ${MULTILIB_USEDEP} |
34 |
+# to properly request multilib enabled. |
35 |
+ |
36 |
+if [[ ! ${_MULTILIB_BUILD} ]]; then |
37 |
+ |
38 |
+# EAPI=5 is required for meaningful MULTILIB_USEDEP. |
39 |
+case ${EAPI:-0} in |
40 |
+ 5) ;; |
41 |
+ *) die "EAPI=${EAPI} is not supported" ;; |
42 |
+esac |
43 |
+ |
44 |
+inherit multilib multiprocessing |
45 |
+ |
46 |
+IUSE=multilib |
47 |
+ |
48 |
+# @ECLASS-VARIABLE: MULTILIB_USEDEP |
49 |
+# @DESCRIPTION: |
50 |
+# The USE-dependency to be used on dependencies (libraries) needing |
51 |
+# to support multilib as well. |
52 |
+# |
53 |
+# Example use: |
54 |
+# @CODE |
55 |
+# RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}] |
56 |
+# net-libs/libbar[ssl,${MULTILIB_USEDEP}]" |
57 |
+# @CODE |
58 |
+MULTILIB_USEDEP='multilib(-)?' |
59 |
+ |
60 |
+# @FUNCTION: multilib_foreach_abi |
61 |
+# @USAGE: <argv>... |
62 |
+# @DESCRIPTION: |
63 |
+# If multilib support is enabled, sets the toolchain up for each |
64 |
+# supported ABI along with the ABI variable and correct BUILD_DIR, |
65 |
+# and runs the given commands with them. |
66 |
+# |
67 |
+# If multilib support is disabled, it just runs the commands. No setup |
68 |
+# is done. |
69 |
+multilib_foreach_abi() { |
70 |
+ local initial_dir=${BUILD_DIR:-${S}} |
71 |
+ |
72 |
+ if use multilib; then |
73 |
+ local ABI |
74 |
+ for ABI in $(get_all_abis); do |
75 |
+ multilib_toolchain_setup "${ABI}" |
76 |
+ BUILD_DIR=${initial_dir%%/}-${ABI} "${@}" |
77 |
+ done |
78 |
+ else |
79 |
+ "${@}" |
80 |
+ fi |
81 |
+} |
82 |
+ |
83 |
+# @FUNCTION: multilib_parallel_foreach_abi |
84 |
+# @USAGE: <argv>... |
85 |
+# @DESCRIPTION: |
86 |
+# If multilib support is enabled, sets the toolchain up for each |
87 |
+# supported ABI along with the ABI variable and correct BUILD_DIR, |
88 |
+# and runs the given commands with them. The commands are run |
89 |
+# in parallel with number of jobs being determined from MAKEOPTS. |
90 |
+# |
91 |
+# If multilib support is disabled, it just runs the commands. No setup |
92 |
+# is done. |
93 |
+# |
94 |
+# Useful for running configure scripts. |
95 |
+multilib_parallel_foreach_abi() { |
96 |
+ local initial_dir=${BUILD_DIR:-${S}} |
97 |
+ |
98 |
+ if use multilib; then |
99 |
+ multijob_init |
100 |
+ |
101 |
+ local ABI |
102 |
+ for ABI in $(get_all_abis); do |
103 |
+ ( |
104 |
+ multijob_child_init |
105 |
+ |
106 |
+ multilib_toolchain_setup "${ABI}" |
107 |
+ BUILD_DIR=${initial_dir%%/}-${ABI} |
108 |
+ "${@}" |
109 |
+ ) & |
110 |
+ |
111 |
+ multijob_post_fork |
112 |
+ done |
113 |
+ |
114 |
+ multijob_finish |
115 |
+ else |
116 |
+ "${@}" |
117 |
+ fi |
118 |
+} |
119 |
+ |
120 |
+_MULTILIB_BUILD=1 |
121 |
+fi |
122 |
-- |
123 |
1.8.1.1 |