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

Diff of /eclass/multilib.eclass

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

Revision 1.5 Revision 1.10
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.5 2005/01/12 22:39:44 eradicator Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.10 2005/01/16 17:45:19 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.
9 9
10ECLASS=multilib 10ECLASS=multilib
11INHERITED="$INHERITED $ECLASS" 11INHERITED="$INHERITED $ECLASS"
12 12
13DESCRIPTION="Based on the ${ECLASS} eclass" 13DESCRIPTION="Based on the ${ECLASS} eclass"
14
15DEPEND="!build? ( sys-apps/sed sys-apps/findutils sys-apps/coreutils )"
16 14
17# This function simply returns the desired lib directory. With portage 15# This function simply returns the desired lib directory. With portage
18# 2.0.51, we now have support for installing libraries to lib32/lib64 16# 2.0.51, we now have support for installing libraries to lib32/lib64
19# to accomidate the needs of multilib systems. It's no longer a good idea 17# to accomidate the needs of multilib systems. It's no longer a good idea
20# to assume all libraries will end up in lib. Replace any (sane) instances 18# to assume all libraries will end up in lib. Replace any (sane) instances
180# echo the number of ABIs we will be installing for 178# echo the number of ABIs we will be installing for
181number_abis() { 179number_abis() {
182 get_abi_order | wc -w 180 get_abi_order | wc -w
183} 181}
184 182
183# get_ml_incdir [<include dir> [<ABI>]]
184# include dir defaults to /usr/include
185# ABI defaults to ${ABI} or ${DEFAULT_ABI}
186get_ml_incdir() {
187 local dir=/usr/include
188
189 if [[ ${#} -gt 0 ]]; then
190 incdir=${1}
191 shift
192 fi
193
194 if [[ -z "${MULTILIB_ABIS}" ]]; then
195 echo ${incdir}
196 return 0
197 fi
198
199 local abi=${ABI:-${DEFAULT_ABI}}
200 if [[ ${#} -gt 0 ]]; then
201 abi=${1}
202 shift
203 fi
204
205 if [[ -d "${dir}/gentoo-multilib/${abi}" ]]; then
206 echo ${dir}/gentoo-multilib/${abi}
207 else
208 echo ${dir}
209 fi
210}
211
185# prep_ml_includes: 212# prep_ml_includes:
186# 213#
187# Some includes (include/asm, glibc, etc) are ABI dependent. In this case, 214# Some includes (include/asm, glibc, etc) are ABI dependent. In this case,
188# We can install them in different locations for each ABI and create a common 215# We can install them in different locations for each ABI and create a common
189# header which includes the right one based on CDEFINE_${ABI}. If your 216# header which includes the right one based on CDEFINE_${ABI}. If your
213 240
214 if is_final_abi; then 241 if is_final_abi; then
215 for dir in ${dirs}; do 242 for dir in ${dirs}; do
216 local args="${dir}" 243 local args="${dir}"
217 local abi 244 local abi
245 dodir ${dir}/gentoo-multilib
218 for abi in $(get_abi_order); do 246 for abi in $(get_abi_order); do
247 mv ${D}/${dir}.${abi} ${D}/${dir}/gentoo-multilib/${abi}
219 args="${args} $(get_abi_CDEFINE ${abi}):${dir}.${abi}" 248 args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"
220 done 249 done
221 create_ml_includes ${args} 250 create_ml_includes ${args}
222 done 251 done
223 fi 252 fi
224 fi 253 fi
294 323
295# Helper function for create_ml_includes 324# Helper function for create_ml_includes
296create_ml_includes-tidy_path() { 325create_ml_includes-tidy_path() {
297 local removed="${1}" 326 local removed="${1}"
298 327
299 if [ -n "${1}" ]; then 328 if [ -n "${removed}" ]; then
300 # Remove multiple slashes 329 # Remove multiple slashes
301 while [ "${removed}" != "${removed/\/\//\/}" ]; do 330 while [ "${removed}" != "${removed/\/\//\/}" ]; do
302 removed=${removed/\/\//\/} 331 removed=${removed/\/\//\/}
303 done 332 done
304 333
307 removed=${removed//\/.\//\/} 336 removed=${removed//\/.\//\/}
308 done 337 done
309 [ "${removed##*/}" = "." ] && removed=${removed%/*} 338 [ "${removed##*/}" = "." ] && removed=${removed%/*}
310 339
311 # Removed .. directories 340 # Removed .. directories
312 # I wonder if there's a non-trivial bashism for this one... 341 while [ "${removed}" != "${removed//\/..\/}" ]; do
313 while [ "${removed}" != "$(echo ${removed} | sed -e 's:[^/]*/\.\./::')" ]; do 342 local p1="${removed%%\/..\/*}"
314 removed=$(echo ${removed} | sed -e 's:[^/]*/\.\./::') 343 local p2="${removed#*\/..\/}"
344
345 removed="${p1%\/*}/${p2}"
315 done 346 done
316 347
317 # Remove trailing .. 348 # Remove trailing ..
318 removed=$(echo ${removed} | sed -e 's:/[^/]*/\.\.$::') 349 [ "${removed##*/}" = ".." ] && removed=${removed%/*/*}
319 350
320 # Remove trailing / 351 # Remove trailing /
321 [ "${removed##*/}" = "" ] && removed=${removed%/*} 352 [ "${removed##*/}" = "" ] && removed=${removed%/*}
322 353
323 echo ${removed} 354 echo ${removed}
353 384
354# Helper function for create_ml_includes 385# Helper function for create_ml_includes
355create_ml_includes-allfiles() { 386create_ml_includes-allfiles() {
356 local basedirs=${@} 387 local basedirs=${@}
357 388
358 local files 389 local basedir
359 for basedir in ${basedirs}; do 390 for basedir in ${basedirs}; do
360 local file 391 local file
361 for file in $(find ${D}/${basedir} -type f); do 392 for file in $(find ${D}/${basedir} -type f); do
362 echo ${file/${D}\/${basedir}\//} 393 echo ${file/${D}\/${basedir}\//}
363 done 394 done
373 if [ "${dir}" = "${data/*:/}" ]; then 404 if [ "${dir}" = "${data/*:/}" ]; then
374 echo ${data/:*/} 405 echo ${data/:*/}
375 return 0 406 return 0
376 fi 407 fi
377 done 408 done
378 echo "Should be here -- create_ml_includes-sym_for_dir ${1} ${@}" 409 echo "Shouldn't be here -- create_ml_includes-sym_for_dir ${1} ${@}"
379 # exit because we'll likely be called from a subshell 410 # exit because we'll likely be called from a subshell
380 exit 1 411 exit 1
381} 412}

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20