From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 37FDF198005 for ; Fri, 22 Feb 2013 16:04:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0F9C821C018; Fri, 22 Feb 2013 16:04:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1ECCF21C00B for ; Fri, 22 Feb 2013 16:04:44 +0000 (UTC) Received: from pomiocik.lan (unknown [213.195.173.220]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 8155433E18E; Fri, 22 Feb 2013 16:04:42 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback. Date: Fri, 22 Feb 2013 17:04:52 +0100 Message-Id: <1361549092-1785-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.8.1.4 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 54af2aa8-3b3e-4f02-9a6e-8da2893c754a X-Archives-Hash: f117c821912597c2b7469d26357f45cc --- gx86/eclass/eutils.eclass | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass index f662041..a8bf512 100644 --- a/gx86/eclass/eutils.eclass +++ b/gx86/eclass/eutils.eclass @@ -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} "$@" @@ -1470,14 +1471,30 @@ prune_libtool_files() { if [[ ! ${removing_all} ]]; then local pc local tf=${T}/prune-lt-files.pc - local pkgconf=$(tc-getPKG_CONFIG) + local pkgconf=$(tc-getPKG_CONFIG)1 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) -- 1.8.1.4