diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-02-26 14:36:40 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-02-26 14:36:40 +0000 |
commit | 7889bcfddb48c52e2b5f8c1f330b444e51dc763c (patch) | |
tree | 4e0f1a87105d82781f9455fd8b3a0b4c0c348316 /eclass/eutils.eclass | |
parent | Re-enable split logs, now directly handled by python*_foreach_impl(). (diff) | |
download | historical-7889bcfddb48c52e2b5f8c1f330b444e51dc763c.tar.gz historical-7889bcfddb48c52e2b5f8c1f330b444e51dc763c.tar.bz2 historical-7889bcfddb48c52e2b5f8c1f330b444e51dc763c.zip |
prune_libtool_files: support running without pkg-config installed, using sed fallback.
Diffstat (limited to 'eclass/eutils.eclass')
-rw-r--r-- | eclass/eutils.eclass | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index f6620412d6e7..587bc10b4521 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.410 2013/02/10 11:42:48 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.411 2013/02/26 14:36:40 mgorny Exp $ # @ECLASS: eutils.eclass # @MAINTAINER: @@ -1407,8 +1407,9 @@ fi # that they should not be linked to, i.e. whenever these files # correspond to plugins. # -# Note: if your package installs both static libraries and .pc files, -# you need to add pkg-config to your DEPEND. +# Note: if your package installs both static libraries and .pc files +# which use variable substitution for -l flags, you need to add +# pkg-config to your DEPEND. prune_libtool_files() { debug-print-function ${FUNCNAME} "$@" @@ -1473,11 +1474,27 @@ prune_libtool_files() { local pkgconf=$(tc-getPKG_CONFIG) while IFS= read -r -d '' pc; do # for all .pc files - local arg - - sed -e '/^Requires:/d' "${pc}" > "${tf}" - for arg in $("${pkgconf}" --libs "${tf}"); do - [[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) + local arg libs + + # Use pkg-config if available (and works), + # fallback to sed. + if ${pkgconf} --exists "${pc}" &>/dev/null; then + sed -e '/^Requires:/d' "${pc}" > "${tf}" + libs=$(${pkgconf} --libs "${tf}") + else + libs=$(sed -ne 's/^Libs://p' "${pc}") + fi + + for arg in ${libs}; do + if [[ ${arg} == -l* ]]; then + if [[ ${arg} == '*$*' ]]; then + eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}" + eqawarn "(arg: ${arg})" + eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND." + fi + + pc_libs+=( lib${arg#-l}.la ) + fi done done < <(find "${D}" -type f -name '*.pc' -print0) |