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

Diff of /eclass/multilib.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.14 Revision 1.22
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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.14 2005/01/18 04:56:03 eradicator Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.22 2005/02/14 11:33:11 eradicator Exp $
4# 4#
5# Author: Jeremy Huddleston <eradicator@gentoo.org> 5# Author: Jeremy Huddleston <eradicator@gentoo.org>
6# 6#
7# This eclass is for all functions pertaining to handling multilib. 7# This eclass is for all functions pertaining to handling multilib.
8# configurations. 8# configurations.
11INHERITED="$INHERITED $ECLASS" 11INHERITED="$INHERITED $ECLASS"
12 12
13DESCRIPTION="Based on the ${ECLASS} eclass" 13DESCRIPTION="Based on the ${ECLASS} eclass"
14 14
15# has_multilib_profile: 15# has_multilib_profile:
16# Return true if the current profile is a multilib profile. You might 16# Return true if the current profile is a multilib profile and lists more than
17# want to use this like 'use multilib || has_multilib_profile' until 17# one abi in ${MULTILIB_ABIS}. You might want to use this like
18# 'use multilib || has_multilib_profile' until all profiles utilizing the
18# all profiles utilizing the 'multilib' use flag are removed from portage 19# 'multilib' use flag are removed from portage
19 20
20# is_final_abi: 21# is_final_abi:
21# Return true if ${ABI} is the final abi to be installed (and thus we are 22# Return true if ${ABI} is the final abi to be installed (and thus we are
22# on our last run through a src_* function. 23# on our last run through a src_* function.
23 24
24# number_abis: 25# number_abis:
25# echo the number of ABIs we will be installing for 26# echo the number of ABIs we will be installing for
26 27
27# get_abi_order: 28# get_install_abis:
28# Return a list of the ABIs we want to install for with 29# Return a list of the ABIs we want to install for with
29# the last one in the list being the default. 30# the last one in the list being the default.
30 31
32# get_all_abis:
33# Return a list of the ABIs supported by this profile.
34# the last one in the list being the default.
35
31# get_all_libdir: 36# get_all_libdirs:
32# Returns a list of all the libdirs used by this profile. This includes 37# Returns a list of all the libdirs used by this profile. This includes
33# those that might not be touched by the current ebuild and always includes 38# those that might not be touched by the current ebuild and always includes
34# "lib". 39# "lib".
35 40
36# get_libdir: 41# get_libdir:
81# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64 86# create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64
82# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64 87# create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64
83 88
84### END DOCUMENTATION ### 89### END DOCUMENTATION ###
85 90
91# Defaults:
92export MULTILIB_ABIS=${MULTILIB_ABIS:-"default"}
93export DEFAULT_ABI=${DEFAULT_ABI:-"default"}
94export ABI=${ABI:-"default"}
95export CFLAGS_default=""
96export LDFLAGS_default=""
97export CHOST_default=${CHOST}
98export LIBDIR_default=${CONF_LIBDIR:-"lib"}
99export CDEFINE_default="__unix__"
100
86# has_multilib_profile() 101# has_multilib_profile()
87# Return true if
88has_multilib_profile() { 102has_multilib_profile() {
89 [ -n "${MULTILIB_ABIS}" ] 103 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
90} 104}
91 105
92# This function simply returns the desired lib directory. With portage 106# This function simply returns the desired lib directory. With portage
93# 2.0.51, we now have support for installing libraries to lib32/lib64 107# 2.0.51, we now have support for installing libraries to lib32/lib64
94# to accomidate the needs of multilib systems. It's no longer a good idea 108# to accomidate the needs of multilib systems. It's no longer a good idea
101# Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set, 115# Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set,
102# fall back on old behavior. Any profile that has these set should also 116# fall back on old behavior. Any profile that has these set should also
103# depend on a newer version of portage (not yet released) which uses these 117# depend on a newer version of portage (not yet released) which uses these
104# over CONF_LIBDIR in econf, dolib, etc... 118# over CONF_LIBDIR in econf, dolib, etc...
105get_libdir() { 119get_libdir() {
106 LIBDIR_TEST=$(type econf) 120 local CONF_LIBDIR
107 if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then 121 if [ -n "${CONF_LIBDIR_OVERRIDE}" ] ; then
108 # if there is an override, we want to use that... always. 122 # if there is an override, we want to use that... always.
109 CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" 123 echo ${CONF_LIBDIR_OVERRIDE}
110 elif [ -n "$(get_abi_LIBDIR)" ]; then 124 else
111 CONF_LIBDIR="$(get_abi_LIBDIR)" 125 get_abi_LIBDIR
112 elif [ "${LIBDIR_TEST/CONF_LIBDIR}" == "${LIBDIR_TEST}" ]; then # we don't have CONF_LIBDIR support
113 # will be <portage-2.0.51_pre20
114 CONF_LIBDIR="lib"
115 fi 126 fi
116 # and of course, default to lib if CONF_LIBDIR isnt set
117 echo ${CONF_LIBDIR:=lib}
118 unset LIBDIR_TEST
119} 127}
120 128
121get_multilibdir() { 129get_multilibdir() {
122 if [ -n "$(get_abi_LIBDIR)" ]; then 130 if has_multilib_profile; then
123 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" 131 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"
124 exit 1 132 exit 1
125 fi 133 fi
126 echo ${CONF_MULTILIBDIR:=lib32} 134 echo ${CONF_MULTILIBDIR:=lib32}
127} 135}
136# 144#
137# get_libdir_override lib64 145# get_libdir_override lib64
138# 146#
139# Travis Tilley <lv@gentoo.org> (31 Aug 2004) 147# Travis Tilley <lv@gentoo.org> (31 Aug 2004)
140get_libdir_override() { 148get_libdir_override() {
141 if [ -n "$(get_abi_LIBDIR)" ]; then 149 if has_multilib_profile; then
142 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" 150 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"
143 exit 1 151 exit 1
144 fi 152 fi
145 CONF_LIBDIR="$1" 153 CONF_LIBDIR="$1"
146 CONF_LIBDIR_OVERRIDE="$1" 154 CONF_LIBDIR_OVERRIDE="$1"
155 LIBDIR_default="$1"
147} 156}
148 157
149# get_abi_var <VAR> [<ABI>] 158# get_abi_var <VAR> [<ABI>]
150# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults 159# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults
151# 160#
168 elif [ -n "${ABI}" ]; then 177 elif [ -n "${ABI}" ]; then
169 abi=${ABI} 178 abi=${ABI}
170 elif [ -n "${DEFAULT_ABI}" ]; then 179 elif [ -n "${DEFAULT_ABI}" ]; then
171 abi=${DEFAULT_ABI} 180 abi=${DEFAULT_ABI}
172 else 181 else
173 return 1 182 abi="default"
174 fi 183 fi
175 184
176 local var="${flag}_${abi}" 185 local var="${flag}_${abi}"
177 echo ${!var} 186 echo ${!var}
178} 187}
179 188
180get_abi_CFLAGS() { get_abi_var CFLAGS ${@}; } 189get_abi_CFLAGS() { get_abi_var CFLAGS "${@}"; }
190get_abi_LDFLAGS() { get_abi_var LDFLAGS "${@}"; }
191get_abi_CHOST() { get_abi_var CHOST "${@}"; }
181get_abi_CDEFINE() { get_abi_var CDEFINE ${@}; } 192get_abi_CDEFINE() { get_abi_var CDEFINE "${@}"; }
182get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; } 193get_abi_LIBDIR() { get_abi_var LIBDIR "${@}"; }
183 194
184# Return a list of the ABIs we want to install for with 195# Return a list of the ABIs we want to install for with
185# the last one in the list being the default. 196# the last one in the list being the default.
186get_abi_order() { 197get_install_abis() {
187 local order="" 198 local order=""
188 199
189 if [ -z "${MULTILIB_ABIS}" ]; then 200 if [ -z "${MULTILIB_ABIS}" ]; then
190 echo "NOMULTILIB" 201 echo "default"
191 return 1 202 return 0
192 fi 203 fi
193 204
194 if hasq multilib-pkg-force ${RESTRICT} || 205 if hasq multilib-pkg-force ${RESTRICT} ||
195 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then 206 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then
196 for x in ${MULTILIB_ABIS}; do 207 for x in ${MULTILIB_ABIS}; do
219 230
220 echo ${order} 231 echo ${order}
221 return 0 232 return 0
222} 233}
223 234
235# Return a list of the ABIs supported by this profile.
236# the last one in the list being the default.
237get_all_abis() {
238 local order=""
239
240 if [ -z "${MULTILIB_ABIS}" ]; then
241 echo "default"
242 return 0
243 fi
244
245 for x in ${MULTILIB_ABIS}; do
246 if [ "${x}" != "${DEFAULT_ABI}" ]; then
247 order="${order:+${order }}${x}"
248 fi
249 done
250 order="${order:+${order} }${DEFAULT_ABI}"
251
252 echo ${order}
253 return 0
254}
255
224# get_all_libdir() 256# get_all_libdirs()
225# Returns a list of all the libdirs used by this profile. This includes 257# Returns a list of all the libdirs used by this profile. This includes
226# those that might not be touched by the current ebuild. 258# those that might not be touched by the current ebuild.
227get_all_libdirs() { 259get_all_libdirs() {
228 local libdirs="lib" 260 local libdirs="lib"
229 local abi 261 local abi
232 if has_multilib_profile; then 264 if has_multilib_profile; then
233 for abi in ${MULTILIB_ABIS}; do 265 for abi in ${MULTILIB_ABIS}; do
234 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" 266 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"
235 done 267 done
236 elif [ -n "${CONF_LIBDIR}" ]; then 268 elif [ -n "${CONF_LIBDIR}" ]; then
237 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:=lib32}; do 269 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:-lib32}; do
238 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}" 270 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}"
239 done 271 done
240 fi 272 fi
241 273
242 echo "${libdirs}" 274 echo "${libdirs}"
245# Return true if ${ABI} is the last ABI on our list (or if we're not 277# Return true if ${ABI} is the last ABI on our list (or if we're not
246# using the new multilib configuration. This can be used to determine 278# using the new multilib configuration. This can be used to determine
247# if we're in the last (or only) run through src_{unpack,compile,install} 279# if we're in the last (or only) run through src_{unpack,compile,install}
248is_final_abi() { 280is_final_abi() {
249 ! has_multilib_profile && return 0 281 ! has_multilib_profile && return 0
250 local ALL_ABIS=$(get_abi_order) 282 local ALL_ABIS=$(get_install_abis)
251 local LAST_ABI=${ALL_ABIS/* /} 283 local LAST_ABI=${ALL_ABIS/* /}
252 [ "${LAST_ABI}" = "${ABI}" ] 284 [ "${LAST_ABI}" = "${ABI}" ]
253} 285}
254 286
255# echo the number of ABIs we will be installing for 287# echo the number of ABIs we will be installing for
256number_abis() { 288number_abis() {
257 get_abi_order | wc -w 289 get_install_abis | wc -w
258} 290}
259 291
260# get_ml_incdir [<include dir> [<ABI>]] 292# get_ml_incdir [<include dir> [<ABI>]]
261# include dir defaults to /usr/include 293# include dir defaults to /usr/include
262# ABI defaults to ${ABI} or ${DEFAULT_ABI} 294# ABI defaults to ${ABI} or ${DEFAULT_ABI}
321 done 353 done
322 354
323 if is_final_abi; then 355 if is_final_abi; then
324 base=${T}/gentoo-multilib 356 base=${T}/gentoo-multilib
325 pushd ${base} 357 pushd ${base}
326 find . | cpio -pmd --no-preserve-owner ${D} 358 find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C ${D}
327 popd 359 popd
328 360
329 for dir in ${dirs}; do 361 for dir in ${dirs}; do
330 local args=${dir} 362 local args=${dir}
331 local abi 363 local abi
332 for abi in $(get_abi_order); do 364 for abi in $(get_install_abis); do
333 args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}" 365 args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"
334 done 366 done
335 create_ml_includes ${args} 367 create_ml_includes ${args}
336 done 368 done
337 fi 369 fi
359 local file 391 local file
360 for file in $(create_ml_includes-allfiles ${basedirs}); do 392 for file in $(create_ml_includes-allfiles ${basedirs}); do
361 local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')" 393 local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')"
362 { 394 {
363 echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */" 395 echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */"
364 #echo "#ifndef __CREATE_ML_INCLUDES_STUB_${name}__"
365 #echo "#define __CREATE_ML_INCLUDES_STUB_${name}__"
366 #echo ""
367 396
368 local dir 397 local dir
369 for dir in ${basedirs}; do 398 for dir in ${basedirs}; do
370 if [ -f "${D}/${dir}/${file}" ]; then 399 if [ -f "${D}/${dir}/${file}" ]; then
371 echo "#ifdef $(create_ml_includes-sym_for_dir ${dir} ${mlinfo})" 400 local sym=$(create_ml_includes-sym_for_dir ${dir} ${mlinfo})
401 if [[ ${sym::1} == "!" ]]; then
402 echo "#ifndef ${sym:1}"
403 else
404 echo "#ifdef ${sym}"
405 fi
372 echo "#include \"$(create_ml_includes-relative_between ${dest}/$(dirname ${file}) ${dir}/${file})\"" 406 echo "#include \"$(create_ml_includes-relative_between ${dest}/$(dirname ${file}) ${dir}/${file})\""
373 echo "#endif /* $(create_ml_includes-sym_for_dir ${dir} ${mlinfo}) */" 407 echo "#endif /* ${sym} */"
374 echo "" 408 echo ""
375 fi 409 fi
376 done 410 done
377 411
378 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */" 412 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */"

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20