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

Diff of /eclass/multilib-build.eclass

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

Revision 1.44 Revision 1.45
1# Copyright 1999-2014 Gentoo Foundation 1# Copyright 1999-2014 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-build.eclass,v 1.44 2014/04/29 20:59:00 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.45 2014/04/29 20:59:41 mgorny Exp $
4 4
5# @ECLASS: multilib-build.eclass 5# @ECLASS: multilib-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# gx86-multilib team <multilib@gentoo.org> 7# gx86-multilib team <multilib@gentoo.org>
8# @AUTHOR: 8# @AUTHOR:
340 if multilib_is_native_abi; then 340 if multilib_is_native_abi; then
341 ln -s "${CHOST}-${fn}" "${root}/${f}" || die 341 ln -s "${CHOST}-${fn}" "${root}/${f}" || die
342 fi 342 fi
343 done 343 done
344 344
345 if [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
346 # XXX: get abi_* directly
347 local abi_flag
348 case "${ABI}" in
349 amd64|amd64_fbsd)
350 abi_flag=abi_x86_64;;
351 x86|x86_fbsd)
352 abi_flag=abi_x86_32;;
353 x32)
354 abi_flag=abi_x86_x32;;
355 n32)
356 abi_flag=abi_mips_n32;;
357 n64)
358 abi_flag=abi_mips_n64;;
359 o32)
360 abi_flag=abi_mips_o32;;
361 esac
362
363 # If abi_flag is unset, then header wrapping is unsupported
364 # on this ABI. This could mean either that:
365 #
366 # 1) the arch doesn't support multilib at all -- in this case,
367 # the headers are not wrapped and everything works as expected,
368 #
369 # 2) someone added new ABI and forgot to update the function --
370 # in this case, the header consistency check will notice one of
371 # those ABIs has an extra header (compared to the header moved
372 # for wrapping) and will fail.
373
374 if [[ ${abi_flag} ]]; then
345 for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do 375 for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
346 # drop leading slash if it's there 376 # drop leading slash if it's there
347 f=${f#/} 377 f=${f#/}
348 378
349 if [[ ${f} != usr/include/* ]]; then 379 if [[ ${f} != usr/include/* ]]; then
350 die "Wrapping headers outside of /usr/include is not supported at the moment." 380 die "Wrapping headers outside of /usr/include is not supported at the moment."
351 fi 381 fi
352 # and then usr/include 382 # and then usr/include
353 f=${f#usr/include} 383 f=${f#usr/include}
354 384
355 local dir=${f%/*} 385 local dir=${f%/*}
356 386
357 if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then 387 if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
358 dodir "/tmp/multilib-include${dir}" 388 dodir "/tmp/multilib-include${dir}"
359 # a generic template 389 # a generic template
360 cat > "${ED}/tmp/multilib-include${f}" <<_EOF_ 390 cat > "${ED}/tmp/multilib-include${f}" <<_EOF_
361/* This file is auto-generated by multilib-build.eclass 391/* This file is auto-generated by multilib-build.eclass
362 * as a multilib-friendly wrapper. For the original content, 392 * as a multilib-friendly wrapper. For the original content,
363 * please see the files that are #included below. 393 * please see the files that are #included below.
364 */ 394 */
365 395
381# endif 411# endif
382#else 412#else
383# error "No ABI matched, please report a bug to bugs.gentoo.org" 413# error "No ABI matched, please report a bug to bugs.gentoo.org"
384#endif 414#endif
385_EOF_ 415_EOF_
416 fi
417
418 # Some ABIs may have install less files than others.
419 if [[ -f ${root}/usr/include${f} ]]; then
420 # $CHOST shall be set by multilib_toolchain_setup
421 dodir "/tmp/multilib-include/${CHOST}${dir}"
422 mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
423
424 # Note: match a space afterwards to avoid collision potential.
425 sed -e "/${abi_flag} /s&error.*&include <${CHOST}${f}>&" \
426 -i "${ED}/tmp/multilib-include${f}" || die
427 fi
428 done
386 fi 429 fi
387
388 # Some ABIs may have install less files than others.
389 if [[ -f ${root}/usr/include${f} ]]; then
390 # $CHOST shall be set by multilib_toolchain_setup
391 dodir "/tmp/multilib-include/${CHOST}${dir}"
392 mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
393
394 # XXX: get abi_* directly
395 local abi_flag
396 case "${ABI}" in
397 amd64|amd64_fbsd)
398 abi_flag=abi_x86_64;;
399 x86|x86_fbsd)
400 abi_flag=abi_x86_32;;
401 x32)
402 abi_flag=abi_x86_x32;;
403 n32)
404 abi_flag=abi_mips_n32;;
405 n64)
406 abi_flag=abi_mips_n64;;
407 o32)
408 abi_flag=abi_mips_o32;;
409 *)
410 die "Header wrapping for ${ABI} not supported yet";;
411 esac
412
413 # Note: match a space afterwards to avoid collision potential.
414 sed -e "/${abi_flag} /s&error.*&include <${CHOST}${f}>&" \
415 -i "${ED}/tmp/multilib-include${f}" || die
416 fi 430 fi
417 done
418} 431}
419 432
420# @FUNCTION: multilib_install_wrappers 433# @FUNCTION: multilib_install_wrappers
421# @USAGE: [<install-root>] 434# @USAGE: [<install-root>]
422# @DESCRIPTION: 435# @DESCRIPTION:

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

  ViewVC Help
Powered by ViewVC 1.1.20