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

Diff of /eclass/multilib.eclass

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

Revision 1.15 Revision 1.19
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.15 2005/01/27 22:07:36 eradicator Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.19 2005/02/09 03:22:25 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.
23# on our last run through a src_* function. 23# on our last run through a src_* function.
24 24
25# number_abis: 25# number_abis:
26# echo the number of ABIs we will be installing for 26# echo the number of ABIs we will be installing for
27 27
28# get_abi_order: 28# get_install_abis:
29# 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
30# the last one in the list being the default. 30# the last one in the list being the default.
31 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
32# get_all_libdir: 36# get_all_libdirs:
33# 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
34# 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
35# "lib". 39# "lib".
36 40
37# get_libdir: 41# get_libdir:
82# 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
83# 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
84 88
85### END DOCUMENTATION ### 89### END DOCUMENTATION ###
86 90
91# Defaults:
92CFLAGS_default=""
93LIBDIR_default="${CONF_LIBDIR:-lib}"
94CDEFINE_default="__unix__"
95
87# has_multilib_profile() 96# has_multilib_profile()
88has_multilib_profile() { 97has_multilib_profile() {
89 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] 98 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
90} 99}
91 100
101# Added support for ${ABI} and ${DEFAULT_ABI}. If they're both not set, 110# 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 111# 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 112# depend on a newer version of portage (not yet released) which uses these
104# over CONF_LIBDIR in econf, dolib, etc... 113# over CONF_LIBDIR in econf, dolib, etc...
105get_libdir() { 114get_libdir() {
106 LIBDIR_TEST=$(type econf) 115 local CONF_LIBDIR
107 if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then 116 if [ -n "${CONF_LIBDIR_OVERRIDE}" ] ; then
108 # if there is an override, we want to use that... always. 117 # if there is an override, we want to use that... always.
109 CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" 118 echo ${CONF_LIBDIR_OVERRIDE}
110 elif [ -n "$(get_abi_LIBDIR)" ]; then 119 else
111 CONF_LIBDIR="$(get_abi_LIBDIR)" 120 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 121 fi
116 # and of course, default to lib if CONF_LIBDIR isnt set
117 echo ${CONF_LIBDIR:=lib}
118 unset LIBDIR_TEST
119} 122}
120 123
121get_multilibdir() { 124get_multilibdir() {
122 if [ -n "$(get_abi_LIBDIR)" ]; then 125 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" 126 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 127 exit 1
125 fi 128 fi
126 echo ${CONF_MULTILIBDIR:=lib32} 129 echo ${CONF_MULTILIBDIR:=lib32}
127} 130}
136# 139#
137# get_libdir_override lib64 140# get_libdir_override lib64
138# 141#
139# Travis Tilley <lv@gentoo.org> (31 Aug 2004) 142# Travis Tilley <lv@gentoo.org> (31 Aug 2004)
140get_libdir_override() { 143get_libdir_override() {
141 if [ -n "$(get_abi_LIBDIR)" ]; then 144 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" 145 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 146 exit 1
144 fi 147 fi
145 CONF_LIBDIR="$1" 148 CONF_LIBDIR="$1"
146 CONF_LIBDIR_OVERRIDE="$1" 149 CONF_LIBDIR_OVERRIDE="$1"
150 LIBDIR_default="$1"
147} 151}
148 152
149# get_abi_var <VAR> [<ABI>] 153# get_abi_var <VAR> [<ABI>]
150# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults 154# returns the value of ${<VAR>_<ABI>} which should be set in make.defaults
151# 155#
168 elif [ -n "${ABI}" ]; then 172 elif [ -n "${ABI}" ]; then
169 abi=${ABI} 173 abi=${ABI}
170 elif [ -n "${DEFAULT_ABI}" ]; then 174 elif [ -n "${DEFAULT_ABI}" ]; then
171 abi=${DEFAULT_ABI} 175 abi=${DEFAULT_ABI}
172 else 176 else
173 return 1 177 abi="default"
174 fi 178 fi
175 179
176 local var="${flag}_${abi}" 180 local var="${flag}_${abi}"
177 echo ${!var} 181 echo ${!var}
178} 182}
181get_abi_CDEFINE() { get_abi_var CDEFINE ${@}; } 185get_abi_CDEFINE() { get_abi_var CDEFINE ${@}; }
182get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; } 186get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; }
183 187
184# Return a list of the ABIs we want to install for with 188# Return a list of the ABIs we want to install for with
185# the last one in the list being the default. 189# the last one in the list being the default.
186get_abi_order() { 190get_install_abis() {
187 local order="" 191 local order=""
188 192
189 if [ -z "${MULTILIB_ABIS}" ]; then 193 if [ -z "${MULTILIB_ABIS}" ]; then
190 echo "NOMULTILIB" 194 echo "default"
191 return 1 195 return 0
192 fi 196 fi
193 197
194 if hasq multilib-pkg-force ${RESTRICT} || 198 if hasq multilib-pkg-force ${RESTRICT} ||
195 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then 199 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then
196 for x in ${MULTILIB_ABIS}; do 200 for x in ${MULTILIB_ABIS}; do
219 223
220 echo ${order} 224 echo ${order}
221 return 0 225 return 0
222} 226}
223 227
228# Return a list of the ABIs supported by this profile.
229# the last one in the list being the default.
230get_all_abis() {
231 local order=""
232
233 if [ -z "${MULTILIB_ABIS}" ]; then
234 echo "default"
235 return 0
236 fi
237
238 for x in ${MULTILIB_ABIS}; do
239 if [ "${x}" != "${DEFAULT_ABI}" ]; then
240 order="${order:+${order }}${x}"
241 fi
242 done
243 order="${order:+${order} }${DEFAULT_ABI}"
244
245 echo ${order}
246 return 0
247}
248
224# get_all_libdir() 249# get_all_libdirs()
225# Returns a list of all the libdirs used by this profile. This includes 250# Returns a list of all the libdirs used by this profile. This includes
226# those that might not be touched by the current ebuild. 251# those that might not be touched by the current ebuild.
227get_all_libdirs() { 252get_all_libdirs() {
228 local libdirs="lib" 253 local libdirs="lib"
229 local abi 254 local abi
232 if has_multilib_profile; then 257 if has_multilib_profile; then
233 for abi in ${MULTILIB_ABIS}; do 258 for abi in ${MULTILIB_ABIS}; do
234 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" 259 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"
235 done 260 done
236 elif [ -n "${CONF_LIBDIR}" ]; then 261 elif [ -n "${CONF_LIBDIR}" ]; then
237 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:=lib32}; do 262 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:-lib32}; do
238 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}" 263 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}"
239 done 264 done
240 fi 265 fi
241 266
242 echo "${libdirs}" 267 echo "${libdirs}"
245# Return true if ${ABI} is the last ABI on our list (or if we're not 270# 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 271# 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} 272# if we're in the last (or only) run through src_{unpack,compile,install}
248is_final_abi() { 273is_final_abi() {
249 ! has_multilib_profile && return 0 274 ! has_multilib_profile && return 0
250 local ALL_ABIS=$(get_abi_order) 275 local ALL_ABIS=$(get_install_abis)
251 local LAST_ABI=${ALL_ABIS/* /} 276 local LAST_ABI=${ALL_ABIS/* /}
252 [ "${LAST_ABI}" = "${ABI}" ] 277 [ "${LAST_ABI}" = "${ABI}" ]
253} 278}
254 279
255# echo the number of ABIs we will be installing for 280# echo the number of ABIs we will be installing for
256number_abis() { 281number_abis() {
257 get_abi_order | wc -w 282 get_install_abis | wc -w
258} 283}
259 284
260# get_ml_incdir [<include dir> [<ABI>]] 285# get_ml_incdir [<include dir> [<ABI>]]
261# include dir defaults to /usr/include 286# include dir defaults to /usr/include
262# ABI defaults to ${ABI} or ${DEFAULT_ABI} 287# ABI defaults to ${ABI} or ${DEFAULT_ABI}
327 popd 352 popd
328 353
329 for dir in ${dirs}; do 354 for dir in ${dirs}; do
330 local args=${dir} 355 local args=${dir}
331 local abi 356 local abi
332 for abi in $(get_abi_order); do 357 for abi in $(get_install_abis); do
333 args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}" 358 args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"
334 done 359 done
335 create_ml_includes ${args} 360 create_ml_includes ${args}
336 done 361 done
337 fi 362 fi

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20