Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 210521
Collapse All | Expand All

(-)multilib.eclass.orig (-113 / +117 lines)
Lines 1-98 Link Here
1
# Copyright 1999-2007 Gentoo Foundation
1
# Copyright 1999-2008 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/multilib.eclass,v 1.63 2007/07/01 23:14:58 peper Exp $
3
# $Header: $
4
#
5
# Maintainer: amd64@gentoo.org / toolchain@gentoo.org
6
#
7
# This eclass is for all functions pertaining to handling multilib.
8
# configurations.
9
10
___ECLASS_RECUR_MULTILIB="yes"
11
[[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs
12
13
# has_multilib_profile:
14
# Return true if the current profile is a multilib profile and lists more than
15
# one abi in ${MULTILIB_ABIS}.  When has_multilib_profile returns true, that
16
# profile should enable the 'multilib' use flag. This is so you can DEPEND on
17
# a package only for multilib or not multilib.
18
4
19
# is_final_abi:
5
# @ECLASS: multilib.eclass
20
# Return true if ${ABI} is the final abi to be installed (and thus we are
6
# @MAINTAINER:
21
# on our last run through a src_* function.
7
# amd64@gentoo.org
8
# toolchain@gentoo.org
9
# @BLURB: This eclass is for all functions pertaining to handling multilib. configurations.
10
# @DESCRIPTION:
11
# This eclass is for all functions pertaining to handling multilib. configurations.
22
12
23
# number_abis:
24
# echo the number of ABIs we will be installing for
25
13
26
# get_install_abis:
14
___ECLASS_RECUR_MULTILIB="yes"
27
# Return a list of the ABIs we want to install for with
15
[[ -z ${___ECLASS_RECUR_TOOLCHAIN_FUNCS} ]] && inherit toolchain-funcs
28
# the last one in the list being the default.
29
30
# get_all_abis:
31
# Return a list of the ABIs supported by this profile.
32
# the last one in the list being the default.
33
34
# get_all_libdirs:
35
# Returns a list of all the libdirs used by this profile.  This includes
36
# those that might not be touched by the current ebuild and always includes
37
# "lib".
38
39
# get_libdir:
40
# Returns the libdir for the selected ABI.  This is backwards compatible
41
# and simply calls get_abi_LIBDIR() on newer profiles.  You should use this
42
# to determine where to install shared objects (ex: /usr/$(get_libdir))
43
44
# get_abi_var <VAR> [<ABI>]:
45
# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults
46
#
47
# get_abi_CFLAGS:
48
# get_abi_CDEFINE:
49
# get_abi_LIBDIR:
50
# Aliases for 'get_abi_var CFLAGS', etc.
51
52
# get_ml_incdir [<include dir> [<ABI>]]
53
# include dir defaults to /usr/include
54
# ABI defaults to ${ABI} or ${DEFAULT_ABI}
55
#
56
# If a multilib include dir is associated with the passed include dir, then
57
# we return it, otherwise, we just echo back the include dir.  This is
58
# neccessary when a built script greps header files rather than testing them
59
# via #include (like perl) to figure out features.
60
61
# prep_ml_includes:
62
# Some includes (include/asm, glibc, etc) are ABI dependent.  In this case,
63
# We can install them in different locations for each ABI and create a common
64
# header which includes the right one based on CDEFINE_${ABI}.  If your
65
# package installs ABI-specific headers, just add 'prep_ml_includes' to the
66
# end of your src_install().  It takes a list of directories that include
67
# files are installed in (default is /usr/include if none are passed).
68
#
69
# Example:
70
# src_install() {
71
#    ...
72
#    prep_ml_includes /usr/qt/3/include
73
# }
74
75
# create_ml_includes <include dir> <symbol 1>:<dir 1> [<symbol 2>:<dir 2> ...]
76
# If you need more control than prep_ml_includes can offer (like linux-headers
77
# for the asm-* dirs, then use create_ml_includes.  The firs argument is the
78
# common dir.  The remaining args are of the form <symbol>:<dir> where
79
# <symbol> is what is put in the #ifdef for choosing that dir.
80
#
81
# Ideas for this code came from debian's sparc-linux headers package.
82
#
83
# Example:
84
# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64
85
# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
86
87
# get_libname [version]
88
# returns libname with proper suffix {.so,.dylib} and optionally supplied version
89
# for ELF/MACH-O shared objects
90
#
91
# Example:
92
# get_libname libfoo ${PV}
93
# Returns: libfoo.so.${PV} (ELF) || libfoo.${PV}.dylib (MACH)
94
95
### END DOCUMENTATION ###
96
16
97
# Defaults:
17
# Defaults:
98
export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"}
18
export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"}
Lines 105-123 Link Here
105
export CDEFINE_default="__unix__"
25
export CDEFINE_default="__unix__"
106
export KERNEL_ABI=${KERNEL_ABI:-${DEFAULT_ABI}}
26
export KERNEL_ABI=${KERNEL_ABI:-${DEFAULT_ABI}}
107
27
108
# has_multilib_profile()
28
# @FUNCTION: has_multilib_profile
29
# @DESCRIPTION:
30
# Return true if the current profile is a multilib profile and lists more than
31
# one abi in ${MULTILIB_ABIS}.  When has_multilib_profile returns true, that
32
# profile should enable the 'multilib' use flag. This is so you can DEPEND on
33
# a package only for multilib or not multilib.
109
has_multilib_profile() {
34
has_multilib_profile() {
110
	[ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
35
	[ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
111
}
36
}
112
37
38
# FUNCTION: get_libdir
39
# @MAINTAINER:
40
# Travis Tilley <lv@gentoo.org> (24 Aug 2004)
41
# Jeremy Huddleston <eradicator@gentoo.org> (23 Dec 2004):
42
# @RETURN: Returns the libdir for the selected ABI.
43
# @DESCRIPTION:
113
# This function simply returns the desired lib directory. With portage
44
# This function simply returns the desired lib directory. With portage
114
# 2.0.51, we now have support for installing libraries to lib32/lib64
45
# 2.0.51, we now have support for installing libraries to lib32/lib64
115
# to accomidate the needs of multilib systems. It's no longer a good idea
46
# to accomidate the needs of multilib systems. It's no longer a good idea
116
# to assume all libraries will end up in lib. Replace any (sane) instances
47
# to assume all libraries will end up in lib. Replace any (sane) instances
117
# where lib is named directly with $(get_libdir) if possible.
48
# where lib is named directly with $(get_libdir) if possible.
118
#
49
#
119
# Travis Tilley <lv@gentoo.org> (24 Aug 2004)
120
#
121
# Jeremy Huddleston <eradicator@gentoo.org> (23 Dec 2004):
50
# Jeremy Huddleston <eradicator@gentoo.org> (23 Dec 2004):
122
#   Added support for ${ABI} and ${DEFAULT_ABI}.  If they're both not set,
51
#   Added support for ${ABI} and ${DEFAULT_ABI}.  If they're both not set,
123
#   fall back on old behavior.  Any profile that has these set should also
52
#   fall back on old behavior.  Any profile that has these set should also
Lines 133-138 Link Here
133
	fi
62
	fi
134
}
63
}
135
64
65
# @FUNCTION: get_multilibdir
66
# @RETURN: Returns the multilibdir
136
get_multilibdir() {
67
get_multilibdir() {
137
	if has_multilib_profile; then
68
	if has_multilib_profile; then
138
		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@gentoo.org"
69
		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@gentoo.org"
Lines 141-146 Link Here
141
	echo ${CONF_MULTILIBDIR:=lib32}
72
	echo ${CONF_MULTILIBDIR:=lib32}
142
}
73
}
143
74
75
# @FUNCTION: get_libdir_override
76
# @MAINTAINER:
77
# Travis Tilley <lv@gentoo.org> (31 Aug 2004)
78
# @DESCRIPTION:
144
# Sometimes you need to override the value returned by get_libdir. A good
79
# Sometimes you need to override the value returned by get_libdir. A good
145
# example of this is xorg-x11, where lib32 isnt a supported configuration,
80
# example of this is xorg-x11, where lib32 isnt a supported configuration,
146
# and where lib64 -must- be used on amd64 (for applications that need lib
81
# and where lib64 -must- be used on amd64 (for applications that need lib
Lines 150-157 Link Here
150
# return:
85
# return:
151
#
86
#
152
#   get_libdir_override lib64
87
#   get_libdir_override lib64
153
#
154
# Travis Tilley <lv@gentoo.org> (31 Aug 2004)
155
get_libdir_override() {
88
get_libdir_override() {
156
	if has_multilib_profile; then
89
	if has_multilib_profile; then
157
		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@gentoo.org"
90
		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@gentoo.org"
Lines 162-171 Link Here
162
	LIBDIR_default="$1"
95
	LIBDIR_default="$1"
163
}
96
}
164
97
165
# get_abi_var <VAR> [<ABI>]
98
# @FUNCTION: get_abi_var
166
# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults
99
# @USAGE: < VAR > [ ABI ]
167
#
100
# @RETURN: returns the value of ${<VAR>_<ABI>} which should be set in make.defaults
101
# @MAINTAINER:
102
# Jeremy Huddleston <eradicator@gentoo.org>
103
# @DESCRIPTION:
168
# ex:
104
# ex:
105
#
169
# CFLAGS=$(get_abi_var CFLAGS sparc32) # CFLAGS=-m32
106
# CFLAGS=$(get_abi_var CFLAGS sparc32) # CFLAGS=-m32
170
#
107
#
171
# Note that the prefered method is to set CC="$(tc-getCC) $(get_abi_CFLAGS)"
108
# Note that the prefered method is to set CC="$(tc-getCC) $(get_abi_CFLAGS)"
Lines 174-181 Link Here
174
# If <ABI> is not specified, ${ABI} is used.
111
# If <ABI> is not specified, ${ABI} is used.
175
# If <ABI> is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used.
112
# If <ABI> is not specified and ${ABI} is not defined, ${DEFAULT_ABI} is used.
176
# If <ABI> is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string.
113
# If <ABI> is not specified and ${ABI} and ${DEFAULT_ABI} are not defined, we return an empty string.
177
#
178
# Jeremy Huddleston <eradicator@gentoo.org>
179
get_abi_var() {
114
get_abi_var() {
180
	local flag=$1
115
	local flag=$1
181
	local abi
116
	local abi
Lines 193-207 Link Here
193
	echo ${!var}
128
	echo ${!var}
194
}
129
}
195
130
131
# @FUNCTION: get_abi_CFLAGS
132
# @USAGE: [ ABI ]
133
# @DESCRIPTION:
134
# Alias for 'get_abi_var CFLAGS'
196
get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; }
135
get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; }
136
137
# @FUNCTION: get_abi_ASFLAGS
138
# @USAGE: [ ABI ]
139
# @DESCRIPTION:
140
# Alias for 'get_abi_var ASFLAGS'
197
get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; }
141
get_abi_ASFLAGS() { get_abi_var ASFLAGS "$@"; }
142
143
# @FUNCTION: get_abi_LDFLAGS
144
# @USAGE: [ ABI ]
145
# @DESCRIPTION:
146
# Alias for 'get_abi_var LDFLAGS'
198
get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; }
147
get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; }
148
149
# @FUNCTION: get_abi_CHOST
150
# @USAGE: [ ABI ]
151
# @DESCRIPTION:
152
# Alias for 'get_abi_var CHOST'
199
get_abi_CHOST() { get_abi_var CHOST "$@"; }
153
get_abi_CHOST() { get_abi_var CHOST "$@"; }
154
155
# @FUNCTION: get_abi_CTARGET
156
# @USAGE: [ ABI ]
157
# @DESCRIPTION:
158
# Alias for 'get_abi_var CTARGET'
200
get_abi_CTARGET() { get_abi_var CTARGET "$@"; }
159
get_abi_CTARGET() { get_abi_var CTARGET "$@"; }
160
161
# @FUNCTION: get_abi_FAKE_TARGETS
162
# @USAGE: [ ABI ]
163
# @DESCRIPTION:
164
# Alias for 'get_abi_var FAKE_TARGETS'
201
get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; }
165
get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; }
166
167
# @FUNCTION: get_abi_CDEFINE
168
# @USAGE: [ ABI ]
169
# @DESCRIPTION:
170
# Alias for 'get_abi_var CDEFINE'
202
get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; }
171
get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; }
172
173
# @FUNCTION: get_abi_LIBDIR
174
# @USAGE: [ ABI ]
175
# @DESCRIPTION:
176
# Alias for 'get_abi_var LIBDIR'
203
get_abi_LIBDIR() { get_abi_var LIBDIR "$@"; }
177
get_abi_LIBDIR() { get_abi_var LIBDIR "$@"; }
204
178
179
# @FUNCTION: get_install_abis
180
# @DESCRIPTION:
205
# Return a list of the ABIs we want to install for with
181
# Return a list of the ABIs we want to install for with
206
# the last one in the list being the default.
182
# the last one in the list being the default.
207
get_install_abis() {
183
get_install_abis() {
Lines 241-246 Link Here
241
	return 0
217
	return 0
242
}
218
}
243
219
220
# @FUNCTION: get_all_abis
221
# @DESCRIPTION: 
244
# Return a list of the ABIs supported by this profile.
222
# Return a list of the ABIs supported by this profile.
245
# the last one in the list being the default.
223
# the last one in the list being the default.
246
get_all_abis() {
224
get_all_abis() {
Lines 262-270 Link Here
262
	return 0
240
	return 0
263
}
241
}
264
242
265
# get_all_libdirs()
243
# @FUNCTION: get_all_libdirs
244
# @DESCRIPTION:
266
# Returns a list of all the libdirs used by this profile.  This includes
245
# Returns a list of all the libdirs used by this profile.  This includes
267
# those that might not be touched by the current ebuild.
246
# those that might not be touched by the current ebuild and always includes
247
# "lib".
268
get_all_libdirs() {
248
get_all_libdirs() {
269
	local libdirs="lib"
249
	local libdirs="lib"
270
	local abi
250
	local abi
Lines 277-282 Link Here
277
	echo "${libdirs}"
257
	echo "${libdirs}"
278
}
258
}
279
259
260
# @FUNCTION: is_final_abi
261
# @DESCRIPTION:
280
# Return true if ${ABI} is the last ABI on our list (or if we're not
262
# Return true if ${ABI} is the last ABI on our list (or if we're not
281
# using the new multilib configuration.  This can be used to determine
263
# using the new multilib configuration.  This can be used to determine
282
# if we're in the last (or only) run through src_{unpack,compile,install}
264
# if we're in the last (or only) run through src_{unpack,compile,install}
Lines 287-300 Link Here
287
	[[ ${LAST_ABI} == ${ABI} ]]
269
	[[ ${LAST_ABI} == ${ABI} ]]
288
}
270
}
289
271
272
# @FUNCTION: number_abis
273
# @DESCRIPTION:
290
# echo the number of ABIs we will be installing for
274
# echo the number of ABIs we will be installing for
291
number_abis() {
275
number_abis() {
292
	get_install_abis | wc -w
276
	get_install_abis | wc -w
293
}
277
}
294
278
295
# get_ml_incdir [<include dir> [<ABI>]]
279
# @FUNCTION: get_ml_incdir
280
# @USAGE: [ include_dir ] [ ABI ]
281
# @DESCRIPTION:
296
# include dir defaults to /usr/include
282
# include dir defaults to /usr/include
297
# ABI defaults to ${ABI} or ${DEFAULT_ABI}
283
# ABI defaults to ${ABI} or ${DEFAULT_ABI}
284
#
285
# If a multilib include dir is associated with the passed include dir, then
286
# we return it, otherwise, we just echo back the include dir.  This is
287
# neccessary when a built script greps header files rather than testing them
288
# via #include (like perl) to figure out features.
298
get_ml_incdir() {
289
get_ml_incdir() {
299
	local dir=/usr/include
290
	local dir=/usr/include
300
291
Lines 321-328 Link Here
321
	fi
312
	fi
322
}
313
}
323
314
324
# prep_ml_includes:
315
# @FUNCTION: prep_ml_includes
325
#
316
# @DESCRIPTION:
326
# Some includes (include/asm, glibc, etc) are ABI dependent.  In this case,
317
# Some includes (include/asm, glibc, etc) are ABI dependent.  In this case,
327
# We can install them in different locations for each ABI and create a common
318
# We can install them in different locations for each ABI and create a common
328
# header which includes the right one based on CDEFINE_${ABI}.  If your
319
# header which includes the right one based on CDEFINE_${ABI}.  If your
Lines 331-341 Link Here
331
# files are installed in (default is /usr/include if none are passed).
322
# files are installed in (default is /usr/include if none are passed).
332
#
323
#
333
# Example:
324
# Example:
334
# src_install() {
325
#     src_install() {
335
#    ...
326
#        ...
336
#    prep_ml_includes /usr/qt/3/include
327
#        prep_ml_includes /usr/qt/3/include
337
# }
328
#     }
338
339
prep_ml_includes() {
329
prep_ml_includes() {
340
	if [[ $(number_abis) -gt 1 ]] ; then
330
	if [[ $(number_abis) -gt 1 ]] ; then
341
		local dir
331
		local dir
Lines 376-381 Link Here
376
	fi
366
	fi
377
}
367
}
378
368
369
# @FUNCTION: create_ml_includes
370
# @USAGE: < include_dir > < symbol_1 >:< dir_1 > [ <symbol_2>:<dir_2> ...]
371
# @DESCRIPTION:
379
# If you need more control than prep_ml_includes can offer (like linux-headers
372
# If you need more control than prep_ml_includes can offer (like linux-headers
380
# for the asm-* dirs, then use create_ml_includes.  The firs argument is the
373
# for the asm-* dirs, then use create_ml_includes.  The firs argument is the
381
# common dir.  The remaining args are of the form <symbol>:<dir> where
374
# common dir.  The remaining args are of the form <symbol>:<dir> where
Lines 384-391 Link Here
384
# Ideas for this code came from debian's sparc-linux headers package.
377
# Ideas for this code came from debian's sparc-linux headers package.
385
#
378
#
386
# Example:
379
# Example:
387
# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64
380
#     create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64
388
# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
381
#     create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
389
#
382
#
390
# Warning: Be careful with the ordering here. The default ABI has to be the
383
# Warning: Be careful with the ordering here. The default ABI has to be the
391
# last, because it is always defined (by GCC)
384
# last, because it is always defined (by GCC)
Lines 531-536 Link Here
531
	exit 1
524
	exit 1
532
}
525
}
533
526
527
# @FUNCTION: get_libname
528
# @USAGE: [ version ]
529
# @DESCRIPTION:
530
# Returns libname with proper suffix {.so,.dylib} and optionally supplied version
531
# for ELF/MACH-O shared objects
532
#
533
# Example:
534
#     get_libname libfoo ${PV}
535
#     Returns: libfoo.so.${PV} (ELF) || libfoo.${PV}.dylib (MACH)
534
get_libname() {
536
get_libname() {
535
	local libname
537
	local libname
536
	local ver=$1
538
	local ver=$1
Lines 650-655 Link Here
650
	esac
652
	esac
651
}
653
}
652
654
655
# @FUNCTION: multilib_toolchain_setup
656
# @DESCRIPTION:
653
# Hide multilib details here for packages which are forced to be compiled for a
657
# Hide multilib details here for packages which are forced to be compiled for a
654
# specific ABI when run on another ABI (like x86-specific packages on amd64)
658
# specific ABI when run on another ABI (like x86-specific packages on amd64)
655
multilib_toolchain_setup() {
659
multilib_toolchain_setup() {

Return to bug 210521