1 |
vapier 08/06/01 01:37:30 |
2 |
|
3 |
Modified: multilib.eclass |
4 |
Log: |
5 |
add eclass documentation by mren #210521 |
6 |
|
7 |
Revision Changes Path |
8 |
1.65 eclass/multilib.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/multilib.eclass?rev=1.65&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/multilib.eclass?rev=1.65&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/multilib.eclass?r1=1.64&r2=1.65 |
13 |
|
14 |
Index: multilib.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v |
17 |
retrieving revision 1.64 |
18 |
retrieving revision 1.65 |
19 |
diff -u -r1.64 -r1.65 |
20 |
--- multilib.eclass 2 May 2008 04:07:38 -0000 1.64 |
21 |
+++ multilib.eclass 1 Jun 2008 01:37:29 -0000 1.65 |
22 |
@@ -1,21 +1,18 @@ |
23 |
-# Copyright 1999-2007 Gentoo Foundation |
24 |
+# Copyright 1999-2008 Gentoo Foundation |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.64 2008/05/02 04:07:38 vapier Exp $ |
27 |
-# |
28 |
-# Maintainer: amd64@g.o / toolchain@g.o |
29 |
-# |
30 |
-# This eclass is for all functions pertaining to handling multilib. |
31 |
-# configurations. |
32 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.65 2008/06/01 01:37:29 vapier Exp $ |
33 |
+ |
34 |
+# @ECLASS: multilib.eclass |
35 |
+# @MAINTAINER: |
36 |
+# amd64@g.o |
37 |
+# toolchain@g.o |
38 |
+# @BLURB: This eclass is for all functions pertaining to handling multilib configurations. |
39 |
+# @DESCRIPTION: |
40 |
+# This eclass is for all functions pertaining to handling multilib configurations. |
41 |
|
42 |
___ECLASS_RECUR_MULTILIB="yes" |
43 |
[[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs |
44 |
|
45 |
-# has_multilib_profile: |
46 |
-# Return true if the current profile is a multilib profile and lists more than |
47 |
-# one abi in ${MULTILIB_ABIS}. When has_multilib_profile returns true, that |
48 |
-# profile should enable the 'multilib' use flag. This is so you can DEPEND on |
49 |
-# a package only for multilib or not multilib. |
50 |
- |
51 |
# is_final_abi: |
52 |
# Return true if ${ABI} is the final abi to be installed (and thus we are |
53 |
# on our last run through a src_* function. |
54 |
@@ -105,19 +102,25 @@ |
55 |
export CDEFINE_default="__unix__" |
56 |
export KERNEL_ABI=${KERNEL_ABI:-${DEFAULT_ABI}} |
57 |
|
58 |
-# has_multilib_profile() |
59 |
+# @FUNCTION: has_multilib_profile |
60 |
+# @DESCRIPTION: |
61 |
+# Return true if the current profile is a multilib profile and lists more than |
62 |
+# one abi in ${MULTILIB_ABIS}. When has_multilib_profile returns true, that |
63 |
+# profile should enable the 'multilib' use flag. This is so you can DEPEND on |
64 |
+# a package only for multilib or not multilib. |
65 |
has_multilib_profile() { |
66 |
[ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] |
67 |
} |
68 |
|
69 |
+# @FUNCTION: get_libdir |
70 |
+# @RETURN: the libdir for the selected ABI |
71 |
+# @DESCRIPTION: |
72 |
# This function simply returns the desired lib directory. With portage |
73 |
# 2.0.51, we now have support for installing libraries to lib32/lib64 |
74 |
# to accomidate the needs of multilib systems. It's no longer a good idea |
75 |
# to assume all libraries will end up in lib. Replace any (sane) instances |
76 |
# where lib is named directly with $(get_libdir) if possible. |
77 |
# |
78 |
-# Travis Tilley <lv@g.o> (24 Aug 2004) |
79 |
-# |
80 |
# Jeremy Huddleston <eradicator@g.o> (23 Dec 2004): |
81 |
# Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set, |
82 |
# fall back on old behavior. Any profile that has these set should also |
83 |
@@ -133,6 +136,8 @@ |
84 |
fi |
85 |
} |
86 |
|
87 |
+# @FUNCTION: get_multilibdir |
88 |
+# @RETURN: Returns the multilibdir |
89 |
get_multilibdir() { |
90 |
if has_multilib_profile; then |
91 |
eerror "get_multilibdir called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@g.o" |
92 |
@@ -141,6 +146,8 @@ |
93 |
echo ${CONF_MULTILIBDIR:=lib32} |
94 |
} |
95 |
|
96 |
+# @FUNCTION: get_libdir_override |
97 |
+# @DESCRIPTION: |
98 |
# Sometimes you need to override the value returned by get_libdir. A good |
99 |
# example of this is xorg-x11, where lib32 isnt a supported configuration, |
100 |
# and where lib64 -must- be used on amd64 (for applications that need lib |
101 |
@@ -150,8 +157,6 @@ |
102 |
# return: |
103 |
# |
104 |
# get_libdir_override lib64 |
105 |
-# |
106 |
-# Travis Tilley <lv@g.o> (31 Aug 2004) |
107 |
get_libdir_override() { |
108 |
if has_multilib_profile; then |
109 |
eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@g.o" |
110 |
@@ -162,9 +167,10 @@ |
111 |
LIBDIR_default="$1" |
112 |
} |
113 |
|
114 |
-# get_abi_var <VAR> [<ABI>] |
115 |
-# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults |
116 |
-# |
117 |
+# @FUNCTION: get_abi_var |
118 |
+# @USAGE: <VAR> [ABI] |
119 |
+# @RETURN: returns the value of ${<VAR>_<ABI>} which should be set in make.defaults |
120 |
+# @DESCRIPTION: |
121 |
# ex: |
122 |
# CFLAGS=$(get_abi_var CFLAGS sparc32) # CFLAGS=-m32 |
123 |
# |
124 |
@@ -174,8 +180,6 @@ |
125 |
# If <ABI> is not specified, ${ABI} is used. |
126 |
# If <ABI> is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used. |
127 |
# If <ABI> is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string. |
128 |
-# |
129 |
-# Jeremy Huddleston <eradicator@g.o> |
130 |
get_abi_var() { |
131 |
local flag=$1 |
132 |
local abi |
133 |
@@ -193,15 +197,56 @@ |
134 |
echo ${!var} |
135 |
} |
136 |
|
137 |
+# @FUNCTION: get_abi_CFLAGS |
138 |
+# @USAGE: [ABI] |
139 |
+# @DESCRIPTION: |
140 |
+# Alias for 'get_abi_var CFLAGS' |
141 |
get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; } |
142 |
+ |
143 |
+# @FUNCTION: get_abi_ASFLAGS |
144 |
+# @USAGE: [ABI] |
145 |
+# @DESCRIPTION: |
146 |
+# Alias for 'get_abi_var ASFLAGS' |
147 |
get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; } |
148 |
+ |
149 |
+# @FUNCTION: get_abi_LDFLAGS |
150 |
+# @USAGE: [ABI] |
151 |
+# @DESCRIPTION: |
152 |
+# Alias for 'get_abi_var LDFLAGS' |
153 |
get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; } |
154 |
+ |
155 |
+# @FUNCTION: get_abi_CHOST |
156 |
+# @USAGE: [ABI] |
157 |
+# @DESCRIPTION: |
158 |
+# Alias for 'get_abi_var CHOST' |
159 |
get_abi_CHOST() { get_abi_var CHOST "$@"; } |
160 |
+ |
161 |
+# @FUNCTION: get_abi_CTARGET |
162 |
+# @USAGE: [ABI] |
163 |
+# @DESCRIPTION: |
164 |
+# Alias for 'get_abi_var CTARGET' |
165 |
get_abi_CTARGET() { get_abi_var CTARGET "$@"; } |
166 |
+ |
167 |
+# @FUNCTION: get_abi_FAKE_TARGETS |
168 |
+# @USAGE: [ABI] |
169 |
+# @DESCRIPTION: |
170 |
+# Alias for 'get_abi_var FAKE_TARGETS' |
171 |
get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; } |
172 |
+ |
173 |
+# @FUNCTION: get_abi_CDEFINE |
174 |
+# @USAGE: [ABI] |
175 |
+# @DESCRIPTION: |
176 |
+# Alias for 'get_abi_var CDEFINE' |
177 |
get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; } |
178 |
+ |
179 |
+# @FUNCTION: get_abi_LIBDIR |
180 |
+# @USAGE: [ABI] |
181 |
+# @DESCRIPTION: |
182 |
+# Alias for 'get_abi_var LIBDIR' |
183 |
get_abi_LIBDIR() { get_abi_var LIBDIR "$@"; } |
184 |
|
185 |
+# @FUNCTION: get_install_abis |
186 |
+# @DESCRIPTION: |
187 |
# Return a list of the ABIs we want to install for with |
188 |
# the last one in the list being the default. |
189 |
get_install_abis() { |
190 |
@@ -241,6 +286,8 @@ |
191 |
return 0 |
192 |
} |
193 |
|
194 |
+# @FUNCTION: get_all_abis |
195 |
+# @DESCRIPTION: |
196 |
# Return a list of the ABIs supported by this profile. |
197 |
# the last one in the list being the default. |
198 |
get_all_abis() { |
199 |
@@ -262,9 +309,11 @@ |
200 |
return 0 |
201 |
} |
202 |
|
203 |
-# get_all_libdirs() |
204 |
+# @FUNCTION: get_all_libdirs |
205 |
+# @DESCRIPTION: |
206 |
# Returns a list of all the libdirs used by this profile. This includes |
207 |
-# those that might not be touched by the current ebuild. |
208 |
+# those that might not be touched by the current ebuild and always includes |
209 |
+# "lib". |
210 |
get_all_libdirs() { |
211 |
local libdirs="lib" |
212 |
local abi |
213 |
@@ -277,6 +326,8 @@ |
214 |
echo "${libdirs}" |
215 |
} |
216 |
|
217 |
+# @FUNCTION: is_final_abi |
218 |
+# @DESCRIPTION: |
219 |
# Return true if ${ABI} is the last ABI on our list (or if we're not |
220 |
# using the new multilib configuration. This can be used to determine |
221 |
# if we're in the last (or only) run through src_{unpack,compile,install} |
222 |
@@ -287,14 +338,23 @@ |
223 |
[[ ${LAST_ABI} == ${ABI} ]] |
224 |
} |
225 |
|
226 |
+# @FUNCTION: number_abis |
227 |
+# @DESCRIPTION: |
228 |
# echo the number of ABIs we will be installing for |
229 |
number_abis() { |
230 |
get_install_abis | wc -w |
231 |
} |
232 |
|
233 |
-# get_ml_incdir [<include dir> [<ABI>]] |
234 |
+# @FUNCTION: get_ml_incdir |
235 |
+# @USAGE: [include_dir] [ABI] |
236 |
+# @DESCRIPTION: |
237 |
# include dir defaults to /usr/include |
238 |
# ABI defaults to ${ABI} or ${DEFAULT_ABI} |
239 |
+# |
240 |
+# If a multilib include dir is associated with the passed include dir, then |
241 |
+# we return it, otherwise, we just echo back the include dir. This is |
242 |
+# neccessary when a built script greps header files rather than testing them |
243 |
+# via #include (like perl) to figure out features. |
244 |
get_ml_incdir() { |
245 |
local dir=/usr/include |
246 |
|
247 |
@@ -321,8 +381,8 @@ |
248 |
fi |
249 |
} |
250 |
|
251 |
-# prep_ml_includes: |
252 |
-# |
253 |
+# @FUNCTION: prep_ml_includes |
254 |
+# @DESCRIPTION: |
255 |
# Some includes (include/asm, glibc, etc) are ABI dependent. In this case, |
256 |
# We can install them in different locations for each ABI and create a common |
257 |
# header which includes the right one based on CDEFINE_${ABI}. If your |
258 |
@@ -331,11 +391,10 @@ |
259 |
# files are installed in (default is /usr/include if none are passed). |
260 |
# |
261 |
# Example: |
262 |
-# src_install() { |
263 |
-# ... |
264 |
-# prep_ml_includes /usr/qt/3/include |
265 |
-# } |
266 |
- |
267 |
+# src_install() { |
268 |
+# ... |
269 |
+# prep_ml_includes /usr/qt/3/include |
270 |
+# } |
271 |
prep_ml_includes() { |
272 |
if [[ $(number_abis) -gt 1 ]] ; then |
273 |
local dir |
274 |
@@ -376,6 +435,9 @@ |
275 |
fi |
276 |
} |
277 |
|
278 |
+# @FUNCTION: create_ml_includes |
279 |
+# @USAGE: <include_dir> <symbol_1>:<dir_1> [<symbol_2>:<dir_2>...] |
280 |
+# @DESCRIPTION: |
281 |
# If you need more control than prep_ml_includes can offer (like linux-headers |
282 |
# for the asm-* dirs, then use create_ml_includes. The firs argument is the |
283 |
# common dir. The remaining args are of the form <symbol>:<dir> where |
284 |
@@ -384,8 +446,8 @@ |
285 |
# Ideas for this code came from debian's sparc-linux headers package. |
286 |
# |
287 |
# Example: |
288 |
-# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64 |
289 |
-# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64 |
290 |
+# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64 |
291 |
+# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64 |
292 |
# |
293 |
# Warning: Be careful with the ordering here. The default ABI has to be the |
294 |
# last, because it is always defined (by GCC) |
295 |
@@ -531,6 +593,15 @@ |
296 |
exit 1 |
297 |
} |
298 |
|
299 |
+# @FUNCTION: get_libname |
300 |
+# @USAGE: [version] |
301 |
+# @DESCRIPTION: |
302 |
+# Returns libname with proper suffix {.so,.dylib} and optionally supplied version |
303 |
+# for ELF/MACH-O shared objects |
304 |
+# |
305 |
+# Example: |
306 |
+# get_libname libfoo ${PV} |
307 |
+# Returns: libfoo.so.${PV} (ELF) || libfoo.${PV}.dylib (MACH) |
308 |
get_libname() { |
309 |
local libname |
310 |
local ver=$1 |
311 |
@@ -651,6 +722,8 @@ |
312 |
esac |
313 |
} |
314 |
|
315 |
+# @FUNCTION: multilib_toolchain_setup |
316 |
+# @DESCRIPTION: |
317 |
# Hide multilib details here for packages which are forced to be compiled for a |
318 |
# specific ABI when run on another ABI (like x86-specific packages on amd64) |
319 |
multilib_toolchain_setup() { |
320 |
|
321 |
|
322 |
|
323 |
-- |
324 |
gentoo-commits@l.g.o mailing list |