| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 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.85 2009/01/27 23:35:04 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.90 2009/04/05 07:50:08 grobian 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 |
| … | |
… | |
| 70 | tc-getNM() { tc-getPROG NM nm "$@"; } |
70 | tc-getNM() { tc-getPROG NM nm "$@"; } |
| 71 | # @FUNCTION: tc-getRANLIB |
71 | # @FUNCTION: tc-getRANLIB |
| 72 | # @USAGE: [toolchain prefix] |
72 | # @USAGE: [toolchain prefix] |
| 73 | # @RETURN: name of the archiver indexer |
73 | # @RETURN: name of the archiver indexer |
| 74 | tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; } |
74 | tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; } |
|
|
75 | # @FUNCTION: tc-getOBJCOPY |
|
|
76 | # @USAGE: [toolchain prefix] |
|
|
77 | # @RETURN: name of the object copier |
|
|
78 | tc-getOBJCOPY() { tc-getPROG OBJCOPY objcopy "$@"; } |
| 75 | # @FUNCTION: tc-getF77 |
79 | # @FUNCTION: tc-getF77 |
| 76 | # @USAGE: [toolchain prefix] |
80 | # @USAGE: [toolchain prefix] |
| 77 | # @RETURN: name of the Fortran 77 compiler |
81 | # @RETURN: name of the Fortran 77 compiler |
| 78 | tc-getF77() { tc-getPROG F77 f77 "$@"; } |
82 | tc-getF77() { tc-getPROG F77 f77 "$@"; } |
| 79 | # @FUNCTION: tc-getFC |
83 | # @FUNCTION: tc-getFC |
| … | |
… | |
| 420 | dosym "/${libdir}/${lib}" "/usr/${libdir}/${lib}" |
424 | dosym "/${libdir}/${lib}" "/usr/${libdir}/${lib}" |
| 421 | else |
425 | else |
| 422 | local tlib |
426 | local tlib |
| 423 | if ${auto} ; then |
427 | if ${auto} ; then |
| 424 | lib="lib${lib}${suffix}" |
428 | lib="lib${lib}${suffix}" |
|
|
429 | tlib=$(scanelf -qF'%S#F' "${D}"/usr/${libdir}/${lib}) |
| 425 | mv "${D}"/usr/${libdir}/${lib}* "${D}"/${libdir}/ || die |
430 | mv "${D}"/usr/${libdir}/${lib}* "${D}"/${libdir}/ || die |
| 426 | tlib=$(scanelf -qF'%S#F' "${D}"/${libdir}/${lib}) |
431 | # some SONAMEs are funky: they encode a version before the .so |
|
|
432 | if [[ ${tlib} != ${lib}* ]] ; then |
|
|
433 | mv "${D}"/usr/${libdir}/${tlib}* "${D}"/${libdir}/ || die |
|
|
434 | fi |
| 427 | [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" |
435 | [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" |
| 428 | rm -f "${D}"/${libdir}/${lib} |
436 | rm -f "${D}"/${libdir}/${lib} |
| 429 | else |
437 | else |
| 430 | tlib=${lib} |
438 | tlib=${lib} |
| 431 | fi |
439 | fi |
| 432 | cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT |
440 | cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT |
| 433 | /* GNU ld script |
441 | /* GNU ld script |
| 434 | Since Gentoo has critical dynamic libraries |
442 | Since Gentoo has critical dynamic libraries in /lib, and the static versions |
| 435 | in /lib, and the static versions in /usr/lib, |
443 | in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we |
| 436 | we need to have a "fake" dynamic lib in /usr/lib, |
444 | run into linking problems. This "fake" dynamic lib is a linker script that |
| 437 | otherwise we run into linking problems. |
445 | redirects the linker to the real lib. And yes, this works in the cross- |
|
|
446 | compiling scenario as the sysroot-ed linker will prepend the real path. |
| 438 | |
447 | |
| 439 | See bug http://bugs.gentoo.org/4411 for more info. |
448 | See bug http://bugs.gentoo.org/4411 for more info. |
| 440 | */ |
449 | */ |
| 441 | ${output_format} |
450 | ${output_format} |
| 442 | GROUP ( /${libdir}/${tlib} ) |
451 | GROUP ( /${libdir}/${tlib} ) |