/[gentoo-x86]/eclass/toolchain-funcs.eclass
Gentoo

Diff of /eclass/toolchain-funcs.eclass

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

Revision 1.111 Revision 1.118
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 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/toolchain-funcs.eclass,v 1.111 2012/06/09 06:56:14 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.118 2012/09/27 19:34:28 axs Exp $
4 4
5# @ECLASS: toolchain-funcs.eclass 5# @ECLASS: toolchain-funcs.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Toolchain Ninjas <toolchain@gentoo.org> 7# Toolchain Ninjas <toolchain@gentoo.org>
8# @BLURB: functions to query common info about the toolchain 8# @BLURB: functions to query common info about the toolchain
15 15
16if [[ ${___ECLASS_ONCE_TOOLCHAIN_FUNCS} != "recur -_+^+_- spank" ]] ; then 16if [[ ${___ECLASS_ONCE_TOOLCHAIN_FUNCS} != "recur -_+^+_- spank" ]] ; then
17___ECLASS_ONCE_TOOLCHAIN_FUNCS="recur -_+^+_- spank" 17___ECLASS_ONCE_TOOLCHAIN_FUNCS="recur -_+^+_- spank"
18 18
19inherit multilib 19inherit multilib
20
21DESCRIPTION="Based on the ${ECLASS} eclass"
22 20
23# tc-getPROG <VAR [search vars]> <default> [tuple] 21# tc-getPROG <VAR [search vars]> <default> [tuple]
24_tc-getPROG() { 22_tc-getPROG() {
25 local tuple=$1 23 local tuple=$1
26 local v var vars=$2 24 local v var vars=$2
213 211
214 # *MiNT doesn't have shared libraries, only platform so far 212 # *MiNT doesn't have shared libraries, only platform so far
215 return $([[ ${host} == *-mint* ]]) 213 return $([[ ${host} == *-mint* ]])
216} 214}
217 215
216# @FUNCTION: tc-export_build_env
217# @USAGE: [compiler variables]
218# @DESCRIPTION:
219# Export common build related compiler settings.
220tc-export_build_env() {
221 tc-export "$@"
222 : ${BUILD_CFLAGS:=-O1 -pipe}
223 : ${BUILD_CXXFLAGS:=-O1 -pipe}
224 : ${BUILD_CPPFLAGS:=}
225 : ${BUILD_LDFLAGS:=}
226 export BUILD_{C,CXX,CPP,LD}FLAGS
227}
228
218# @FUNCTION: tc-env_build 229# @FUNCTION: tc-env_build
219# @USAGE: <command> [command args] 230# @USAGE: <command> [command args]
220# @INTERNAL 231# @INTERNAL
221# @DESCRIPTION: 232# @DESCRIPTION:
222# Setup the compile environment to the build tools and then execute the 233# Setup the compile environment to the build tools and then execute the
223# specified command. We use tc-getBUILD_XX here so that we work with 234# specified command. We use tc-getBUILD_XX here so that we work with
224# all of the semi-[non-]standard env vars like $BUILD_CC which often 235# all of the semi-[non-]standard env vars like $BUILD_CC which often
225# the target build system does not check. 236# the target build system does not check.
226tc-env_build() { 237tc-env_build() {
238 tc-export_build_env
227 CFLAGS=${BUILD_CFLAGS:--O1 -pipe} \ 239 CFLAGS=${BUILD_CFLAGS} \
228 CXXFLAGS=${BUILD_CXXFLAGS:--O1 -pipe} \ 240 CXXFLAGS=${BUILD_CXXFLAGS} \
229 CPPFLAGS=${BUILD_CPPFLAGS} \ 241 CPPFLAGS=${BUILD_CPPFLAGS} \
230 LDFLAGS=${BUILD_LDFLAGS} \ 242 LDFLAGS=${BUILD_LDFLAGS} \
231 AR=$(tc-getBUILD_AR) \ 243 AR=$(tc-getBUILD_AR) \
232 AS=$(tc-getBUILD_AS) \ 244 AS=$(tc-getBUILD_AS) \
233 CC=$(tc-getBUILD_CC) \ 245 CC=$(tc-getBUILD_CC) \
343 355
344 local type=$1 356 local type=$1
345 local host=$2 357 local host=$2
346 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} 358 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
347 359
360 local KV=${KV:-${KV_FULL}}
361 [[ -z ${KV} ]] && die "toolchain-funcs.eclass: Kernel version could not be determined, please inherit kernel-2 or linux-info"
362
348 case ${host} in 363 case ${host} in
364 aarch64*) ninj aarch64 arm;;
349 alpha*) echo alpha;; 365 alpha*) echo alpha;;
350 arm*) echo arm;; 366 arm*) echo arm;;
351 avr*) ninj avr32 avr;; 367 avr*) ninj avr32 avr;;
352 bfin*) ninj blackfin bfin;; 368 bfin*) ninj blackfin bfin;;
353 cris*) echo cris;; 369 cris*) echo cris;;
430 local host=$1 446 local host=$1
431 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}} 447 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
432 host=${host%%-*} 448 host=${host%%-*}
433 449
434 case ${host} in 450 case ${host} in
451 aarch64*be) echo big;;
452 aarch64) echo little;;
435 alpha*) echo big;; 453 alpha*) echo big;;
436 arm*b*) echo big;; 454 arm*b*) echo big;;
437 arm*) echo little;; 455 arm*) echo little;;
438 cris*) echo little;; 456 cris*) echo little;;
439 hppa*) echo big;; 457 hppa*) echo big;;
596 local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname) 614 local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname)
597 [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/ 615 [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/
598 616
599 tc-is-static-only && return 617 tc-is-static-only && return
600 618
619 # Eventually we'd like to get rid of this func completely #417451
620 case ${CTARGET:-${CHOST}} in
621 *-darwin*) ;;
622 *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
623 use prefix && return 0 ;;
624 *) return 0 ;;
625 esac
626
601 # Just make sure it exists 627 # Just make sure it exists
602 dodir /usr/${libdir} 628 dodir /usr/${libdir}
603 629
604 if [[ $1 == "-a" ]] ; then 630 if [[ $1 == "-a" ]] ; then
605 auto=true 631 auto=true
662 # understand linker scripts, just create a symlink. 688 # understand linker scripts, just create a symlink.
663 pushd "${ED}/usr/${libdir}" > /dev/null 689 pushd "${ED}/usr/${libdir}" > /dev/null
664 ln -snf "../../${libdir}/${tlib}" "${lib}" 690 ln -snf "../../${libdir}/${tlib}" "${lib}"
665 popd > /dev/null 691 popd > /dev/null
666 ;; 692 ;;
667 *-aix*|*-irix*|*64*-hpux*|*-interix*|*-winnt*)
668 if ${auto} ; then
669 mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die
670 # no way to retrieve soname on these platforms (?)
671 tlib=$(readlink "${ED}"/${libdir}/${lib})
672 tlib=${tlib##*/}
673 if [[ -z ${tlib} ]] ; then
674 # ok, apparently was not a symlink, don't remove it and
675 # just link to it
676 tlib=${lib}
677 else
678 rm -f "${ED}"/${libdir}/${lib}
679 fi
680 else
681 tlib=${lib}
682 fi
683
684 # we don't have GNU binutils on these platforms, so we symlink
685 # instead, which seems to work fine. Keep it relative, otherwise
686 # we break some QA checks in Portage
687 # on interix, the linker scripts would work fine in _most_
688 # situations. if a library links to such a linker script the
689 # absolute path to the correct library is inserted into the binary,
690 # which is wrong, since anybody linking _without_ libtool will miss
691 # some dependencies, since the stupid linker cannot find libraries
692 # hardcoded with absolute paths (as opposed to the loader, which
693 # seems to be able to do this).
694 # this has been seen while building shared-mime-info which needs
695 # libxml2, but links without libtool (and does not add libz to the
696 # command line by itself).
697 pushd "${ED}/usr/${libdir}" > /dev/null
698 ln -snf "../../${libdir}/${tlib}" "${lib}"
699 popd > /dev/null
700 ;;
701 hppa*-hpux*) # PA-RISC 32bit (SOM) only, others (ELF) match *64*-hpux* above.
702 if ${auto} ; then
703 tlib=$(chatr "${ED}"/usr/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}')
704 [[ -z ${tlib} ]] && tlib=${lib}
705 tlib=${tlib##*/} # 'internal name' can have a path component
706 mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die
707 # some SONAMEs are funky: they encode a version before the .so
708 if [[ ${tlib} != ${lib}* ]] ; then
709 mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die
710 fi
711 [[ ${tlib} != ${lib} ]] &&
712 rm -f "${ED}"/${libdir}/${lib}
713 else
714 tlib=$(chatr "${ED}"/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}')
715 [[ -z ${tlib} ]] && tlib=${lib}
716 tlib=${tlib##*/} # 'internal name' can have a path component
717 fi
718 pushd "${ED}"/usr/${libdir} >/dev/null
719 ln -snf "../../${libdir}/${tlib}" "${lib}"
720 # need the internal name in usr/lib too, to be available at runtime
721 # when linked with /path/to/lib.sl (hardcode_direct_absolute=yes)
722 [[ ${tlib} != ${lib} ]] &&
723 ln -snf "../../${libdir}/${tlib}" "${tlib}"
724 popd >/dev/null
725 ;;
726 *) 693 *)
727 if ${auto} ; then 694 if ${auto} ; then
728 tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) 695 tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib})
729 [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" 696 [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"
730 mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die 697 mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die

Legend:
Removed from v.1.111  
changed lines
  Added in v.1.118

  ViewVC Help
Powered by ViewVC 1.1.20