| 1 | # Copyright 1999-2012 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/eutils.eclass,v 1.406 2012/10/07 06:22:01 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.407 2012/10/11 16:50:53 mgorny Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: eutils.eclass |
5 | # @ECLASS: eutils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
| … | |
… | |
| 1412 | die "Invalid argument to ${FUNCNAME}(): ${opt}" |
1412 | die "Invalid argument to ${FUNCNAME}(): ${opt}" |
| 1413 | esac |
1413 | esac |
| 1414 | done |
1414 | done |
| 1415 | |
1415 | |
| 1416 | local f |
1416 | local f |
|
|
1417 | local queue=() |
| 1417 | while IFS= read -r -d '' f; do # for all .la files |
1418 | while IFS= read -r -d '' f; do # for all .la files |
| 1418 | local archivefile=${f/%.la/.a} |
1419 | local archivefile=${f/%.la/.a} |
| 1419 | |
1420 | |
| 1420 | [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' |
1421 | [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' |
| 1421 | |
1422 | |
| 1422 | # Remove static libs we're not supposed to link against. |
1423 | # Remove static libs we're not supposed to link against. |
| 1423 | if grep -q '^shouldnotlink=yes$' "${f}"; then |
1424 | if grep -q '^shouldnotlink=yes$' "${f}"; then |
| 1424 | if [[ -f ${archivefile} ]]; then |
1425 | if [[ -f ${archivefile} ]]; then |
| 1425 | einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" |
1426 | einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" |
| 1426 | rm -f "${archivefile}" |
1427 | queue+=( "${archivefile}" ) |
| 1427 | fi |
1428 | fi |
| 1428 | |
1429 | |
| 1429 | # The .la file may be used by a module loader, so avoid removing it |
1430 | # The .la file may be used by a module loader, so avoid removing it |
| 1430 | # unless explicitly requested. |
1431 | # unless explicitly requested. |
| 1431 | [[ ${removing_all} ]] || continue |
1432 | [[ ${removing_all} ]] || continue |
| … | |
… | |
| 1472 | has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' |
1473 | has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' |
| 1473 | fi |
1474 | fi |
| 1474 | |
1475 | |
| 1475 | if [[ ${reason} ]]; then |
1476 | if [[ ${reason} ]]; then |
| 1476 | einfo "Removing unnecessary ${f#${D%/}} (${reason})" |
1477 | einfo "Removing unnecessary ${f#${D%/}} (${reason})" |
| 1477 | rm -f "${f}" |
1478 | queue+=( "${f}" ) |
| 1478 | fi |
1479 | fi |
| 1479 | done < <(find "${D}" -type f -name '*.la' -print0) |
1480 | done < <(find "${D}" -xtype f -name '*.la' -print0) |
|
|
1481 | |
|
|
1482 | if [[ ${queue[@]} ]]; then |
|
|
1483 | rm -f "${queue[@]}" |
|
|
1484 | fi |
| 1480 | } |
1485 | } |
| 1481 | |
1486 | |
| 1482 | check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } |
1487 | check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } |
| 1483 | |
1488 | |
| 1484 | fi |
1489 | fi |