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

Diff of /eclass/multilib.eclass

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

Revision 1.18 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.18 2005/02/03 05:52:51 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.
86# 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
87# 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
88 88
89### END DOCUMENTATION ### 89### END DOCUMENTATION ###
90 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
91# has_multilib_profile() 101# has_multilib_profile()
92has_multilib_profile() { 102has_multilib_profile() {
93 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] 103 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
94} 104}
95 105
105# 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,
106# 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
107# 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
108# over CONF_LIBDIR in econf, dolib, etc... 118# over CONF_LIBDIR in econf, dolib, etc...
109get_libdir() { 119get_libdir() {
110 LIBDIR_TEST=$(type econf) 120 local CONF_LIBDIR
111 if [ ! -z "${CONF_LIBDIR_OVERRIDE}" ] ; then 121 if [ -n "${CONF_LIBDIR_OVERRIDE}" ] ; then
112 # if there is an override, we want to use that... always. 122 # if there is an override, we want to use that... always.
113 CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}" 123 echo ${CONF_LIBDIR_OVERRIDE}
114 elif [ -n "$(get_abi_LIBDIR)" ]; then 124 else
115 CONF_LIBDIR="$(get_abi_LIBDIR)" 125 get_abi_LIBDIR
116 elif [ "${LIBDIR_TEST/CONF_LIBDIR}" == "${LIBDIR_TEST}" ]; then # we don't have CONF_LIBDIR support
117 # will be <portage-2.0.51_pre20
118 CONF_LIBDIR="lib"
119 fi 126 fi
120 # and of course, default to lib if CONF_LIBDIR isnt set
121 echo ${CONF_LIBDIR:=lib}
122 unset LIBDIR_TEST
123} 127}
124 128
125get_multilibdir() { 129get_multilibdir() {
126 if [ -n "$(get_abi_LIBDIR)" ]; then 130 if has_multilib_profile; then
127 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"
128 exit 1 132 exit 1
129 fi 133 fi
130 echo ${CONF_MULTILIBDIR:=lib32} 134 echo ${CONF_MULTILIBDIR:=lib32}
131} 135}
140# 144#
141# get_libdir_override lib64 145# get_libdir_override lib64
142# 146#
143# Travis Tilley <lv@gentoo.org> (31 Aug 2004) 147# Travis Tilley <lv@gentoo.org> (31 Aug 2004)
144get_libdir_override() { 148get_libdir_override() {
145 if [ -n "$(get_abi_LIBDIR)" ]; then 149 if has_multilib_profile; then
146 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"
147 exit 1 151 exit 1
148 fi 152 fi
149 CONF_LIBDIR="$1" 153 CONF_LIBDIR="$1"
150 CONF_LIBDIR_OVERRIDE="$1" 154 CONF_LIBDIR_OVERRIDE="$1"
155 LIBDIR_default="$1"
151} 156}
152 157
153# get_abi_var <VAR> [<ABI>] 158# get_abi_var <VAR> [<ABI>]
154# 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
155# 160#
172 elif [ -n "${ABI}" ]; then 177 elif [ -n "${ABI}" ]; then
173 abi=${ABI} 178 abi=${ABI}
174 elif [ -n "${DEFAULT_ABI}" ]; then 179 elif [ -n "${DEFAULT_ABI}" ]; then
175 abi=${DEFAULT_ABI} 180 abi=${DEFAULT_ABI}
176 else 181 else
177 return 1 182 abi="default"
178 fi 183 fi
179 184
180 local var="${flag}_${abi}" 185 local var="${flag}_${abi}"
181 echo ${!var} 186 echo ${!var}
182} 187}
183 188
184get_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 "${@}"; }
185get_abi_CDEFINE() { get_abi_var CDEFINE ${@}; } 192get_abi_CDEFINE() { get_abi_var CDEFINE "${@}"; }
186get_abi_LIBDIR() { get_abi_var LIBDIR ${@}; } 193get_abi_LIBDIR() { get_abi_var LIBDIR "${@}"; }
187 194
188# 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
189# the last one in the list being the default. 196# the last one in the list being the default.
190get_install_abis() { 197get_install_abis() {
191 local order="" 198 local order=""
192 199
193 if [ -z "${MULTILIB_ABIS}" ]; then 200 if [ -z "${MULTILIB_ABIS}" ]; then
194 echo "NOMULTILIB" 201 echo "default"
195 return 1 202 return 0
196 fi 203 fi
197 204
198 if hasq multilib-pkg-force ${RESTRICT} || 205 if hasq multilib-pkg-force ${RESTRICT} ||
199 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then 206 { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then
200 for x in ${MULTILIB_ABIS}; do 207 for x in ${MULTILIB_ABIS}; do
229# the last one in the list being the default. 236# the last one in the list being the default.
230get_all_abis() { 237get_all_abis() {
231 local order="" 238 local order=""
232 239
233 if [ -z "${MULTILIB_ABIS}" ]; then 240 if [ -z "${MULTILIB_ABIS}" ]; then
234 echo "NOMULTILIB" 241 echo "default"
235 return 1 242 return 0
236 fi 243 fi
237 244
238 for x in ${MULTILIB_ABIS}; do 245 for x in ${MULTILIB_ABIS}; do
239 if [ "${x}" != "${DEFAULT_ABI}" ]; then 246 if [ "${x}" != "${DEFAULT_ABI}" ]; then
240 order="${order:+${order }}${x}" 247 order="${order:+${order }}${x}"
257 if has_multilib_profile; then 264 if has_multilib_profile; then
258 for abi in ${MULTILIB_ABIS}; do 265 for abi in ${MULTILIB_ABIS}; do
259 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})" 266 [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"
260 done 267 done
261 elif [ -n "${CONF_LIBDIR}" ]; then 268 elif [ -n "${CONF_LIBDIR}" ]; then
262 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:=lib32}; do 269 for dir in ${CONF_LIBDIR} ${CONF_MULTILIBDIR:-lib32}; do
263 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}" 270 [ "${dir}" != "lib" ] && libdirs="${libdirs} ${dir}"
264 done 271 done
265 fi 272 fi
266 273
267 echo "${libdirs}" 274 echo "${libdirs}"
384 local file 391 local file
385 for file in $(create_ml_includes-allfiles ${basedirs}); do 392 for file in $(create_ml_includes-allfiles ${basedirs}); do
386 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')"
387 { 394 {
388 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 */"
389 #echo "#ifndef __CREATE_ML_INCLUDES_STUB_${name}__"
390 #echo "#define __CREATE_ML_INCLUDES_STUB_${name}__"
391 #echo ""
392 396
393 local dir 397 local dir
394 for dir in ${basedirs}; do 398 for dir in ${basedirs}; do
395 if [ -f "${D}/${dir}/${file}" ]; then 399 if [ -f "${D}/${dir}/${file}" ]; then
396 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
397 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})\""
398 echo "#endif /* $(create_ml_includes-sym_for_dir ${dir} ${mlinfo}) */" 407 echo "#endif /* ${sym} */"
399 echo "" 408 echo ""
400 fi 409 fi
401 done 410 done
402 411
403 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */" 412 #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */"

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

  ViewVC Help
Powered by ViewVC 1.1.20