public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback.
@ 2013-02-22 16:04 Michał Górny
  2013-02-22 19:46 ` Thomas Sachau
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2013-02-22 16:04 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback.
  2013-02-22 16:04 [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback Michał Górny
@ 2013-02-22 19:46 ` Thomas Sachau
  2013-02-22 20:51   ` Michał Górny
  2013-02-22 20:51   ` Michał Górny
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Sachau @ 2013-02-22 19:46 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

Michał Górny schrieb:
> ---
>  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

Typo?


-- 

Thomas Sachau
Gentoo Linux Developer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 379 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback.
  2013-02-22 19:46 ` Thomas Sachau
@ 2013-02-22 20:51   ` Michał Górny
  2013-02-22 20:51   ` Michał Górny
  1 sibling, 0 replies; 4+ messages in thread
From: Michał Górny @ 2013-02-22 20:51 UTC (permalink / raw
  To: gentoo-dev; +Cc: tommy

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

On Fri, 22 Feb 2013 20:46:57 +0100
Thomas Sachau <tommy@gentoo.org> wrote:

> Michał Górny schrieb:
> > ---
> >  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
> 
> Typo?

Ah, thanks for catching it.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback.
  2013-02-22 19:46 ` Thomas Sachau
  2013-02-22 20:51   ` Michał Górny
@ 2013-02-22 20:51   ` Michał Górny
  1 sibling, 0 replies; 4+ messages in thread
From: Michał Górny @ 2013-02-22 20:51 UTC (permalink / raw
  To: gentoo-dev; +Cc: tommy

[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

On Fri, 22 Feb 2013 20:46:57 +0100
Thomas Sachau <tommy@gentoo.org> wrote:

> Michał Górny schrieb:
> > ---
> >  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
> 
> Typo?
> 
> 



-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-22 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22 16:04 [gentoo-dev] [PATCH eutils] prune_libtool_files: make pkg-config optional, add a sed fallback Michał Górny
2013-02-22 19:46 ` Thomas Sachau
2013-02-22 20:51   ` Michał Górny
2013-02-22 20:51   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox