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

Diff of /eclass/eutils.eclass

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

Revision 1.402 Revision 1.407
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.402 2012/08/29 13:42:42 mgorny 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
17 17
18if [[ ${___ECLASS_ONCE_EUTILS} != "recur -_+^+_- spank" ]] ; then 18if [[ ${___ECLASS_ONCE_EUTILS} != "recur -_+^+_- spank" ]] ; then
19___ECLASS_ONCE_EUTILS="recur -_+^+_- spank" 19___ECLASS_ONCE_EUTILS="recur -_+^+_- spank"
20 20
21inherit multilib toolchain-funcs user 21inherit multilib toolchain-funcs user
22
23DESCRIPTION="Based on the ${ECLASS} eclass"
24 22
25if has "${EAPI:-0}" 0 1 2; then 23if has "${EAPI:-0}" 0 1 2; then
26 24
27# @FUNCTION: epause 25# @FUNCTION: epause
28# @USAGE: [seconds] 26# @USAGE: [seconds]
551 549
552# @FUNCTION: epatch_user 550# @FUNCTION: epatch_user
553# @USAGE: 551# @USAGE:
554# @DESCRIPTION: 552# @DESCRIPTION:
555# Applies user-provided patches to the source tree. The patches are 553# Applies user-provided patches to the source tree. The patches are
556# taken from /etc/portage/patches/<CATEGORY>/<PF|P|PN>/, where the first 554# taken from /etc/portage/patches/<CATEGORY>/<PF|P|PN>[:SLOT]/, where the first
557# of these three directories to exist will be the one to use, ignoring 555# of these three directories to exist will be the one to use, ignoring
558# any more general directories which might exist as well. They must end 556# any more general directories which might exist as well. They must end
559# in ".patch" to be applied. 557# in ".patch" to be applied.
560# 558#
561# User patches are intended for quick testing of patches without ebuild 559# User patches are intended for quick testing of patches without ebuild
583 local applied="${T}/epatch_user.log" 581 local applied="${T}/epatch_user.log"
584 [[ -e ${applied} ]] && return 2 582 [[ -e ${applied} ]] && return 2
585 583
586 # don't clobber any EPATCH vars that the parent might want 584 # don't clobber any EPATCH vars that the parent might want
587 local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches 585 local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
588 for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}; do 586 for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}}; do
589 EPATCH_SOURCE=${base}/${CTARGET}/${check} 587 EPATCH_SOURCE=${base}/${CTARGET}/${check}
590 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check} 588 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check}
591 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check} 589 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check}
592 if [[ -d ${EPATCH_SOURCE} ]] ; then 590 if [[ -d ${EPATCH_SOURCE} ]] ; then
593 EPATCH_SOURCE=${EPATCH_SOURCE} \ 591 EPATCH_SOURCE=${EPATCH_SOURCE} \
1371} 1369}
1372 1370
1373# @FUNCTION: usex 1371# @FUNCTION: usex
1374# @USAGE: <USE flag> [true output] [false output] [true suffix] [false suffix] 1372# @USAGE: <USE flag> [true output] [false output] [true suffix] [false suffix]
1375# @DESCRIPTION: 1373# @DESCRIPTION:
1374# Proxy to declare usex for package managers or EAPIs that do not provide it
1375# and use the package manager implementation when available (i.e. EAPI >= 5).
1376# If USE flag is set, echo [true output][true suffix] (defaults to "yes"), 1376# If USE flag is set, echo [true output][true suffix] (defaults to "yes"),
1377# otherwise echo [false output][false suffix] (defaults to "no"). 1377# otherwise echo [false output][false suffix] (defaults to "no").
1378if has "${EAPI:-0}" 0 1 2 3 4; then
1378usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 1379 usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963
1380fi
1379 1381
1380# @FUNCTION: prune_libtool_files 1382# @FUNCTION: prune_libtool_files
1381# @USAGE: [--all] 1383# @USAGE: [--all]
1382# @DESCRIPTION: 1384# @DESCRIPTION:
1383# Locate unnecessary libtool files (.la) and libtool static archives 1385# Locate unnecessary libtool files (.la) and libtool static archives
1410 die "Invalid argument to ${FUNCNAME}(): ${opt}" 1412 die "Invalid argument to ${FUNCNAME}(): ${opt}"
1411 esac 1413 esac
1412 done 1414 done
1413 1415
1414 local f 1416 local f
1417 local queue=()
1415 while IFS= read -r -d '' f; do # for all .la files 1418 while IFS= read -r -d '' f; do # for all .la files
1416 local archivefile=${f/%.la/.a} 1419 local archivefile=${f/%.la/.a}
1417 1420
1418 [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' 1421 [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed'
1419 1422
1420 # Remove static libs we're not supposed to link against. 1423 # Remove static libs we're not supposed to link against.
1421 if grep -q '^shouldnotlink=yes$' "${f}"; then 1424 if grep -q '^shouldnotlink=yes$' "${f}"; then
1422 if [[ -f ${archivefile} ]]; then 1425 if [[ -f ${archivefile} ]]; then
1423 einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" 1426 einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)"
1424 rm -f "${archivefile}" 1427 queue+=( "${archivefile}" )
1425 fi 1428 fi
1426 1429
1427 # 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
1428 # unless explicitly requested. 1431 # unless explicitly requested.
1429 [[ ${removing_all} ]] || continue 1432 [[ ${removing_all} ]] || continue
1470 has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' 1473 has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
1471 fi 1474 fi
1472 1475
1473 if [[ ${reason} ]]; then 1476 if [[ ${reason} ]]; then
1474 einfo "Removing unnecessary ${f#${D%/}} (${reason})" 1477 einfo "Removing unnecessary ${f#${D%/}} (${reason})"
1475 rm -f "${f}" 1478 queue+=( "${f}" )
1476 fi 1479 fi
1477 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
1478} 1485}
1479 1486
1480check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } 1487check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
1481 1488
1482fi 1489fi

Legend:
Removed from v.1.402  
changed lines
  Added in v.1.407

  ViewVC Help
Powered by ViewVC 1.1.20