Re: Missing pkgconfig dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 30 Mar 2005 09:23:54 -0500, Matthias Clasen wrote:

> On Wed, 2005-03-30 at 16:01 +0200, Miloslav Trmac wrote:
> > On Wed, Mar 30, 2005 at 08:43:38AM -0500, Matthias Clasen wrote:
> > > .pc files contain dependencies, e.g. the gdk-pixbuf-2.0.pc file has the
> > > line
> > > 
> > > Requires: gobject-2.0,gmodule-no-export-2.0
> > > 
> > > which means you'll get errors from pgk-config if you try to use the gdk-
> > > pixbuf-2.0.pc file without having glib-devel installed (which contains
> > > the gobject-2.0.pc and gmodule-no-export-2.0.pc files). Since rpm does
> > > not pick up these dependencies on its own,
> > Wouldn't It Be Cool(tm) if rpm did pick these dependencies automatically?
> > 
> > for i in $RPM_BUILD_DIR{%{_libdir},%{_datadir}}/pkgconfig/*.pc; do
> > 	set -- $(sed -n 's/^Requires: //p' < "$i")
> > 	for dep; do
> > 		f=%{_libdir}/pkgconfig/$dep.pc
> > 		[ -f "$f" ] && { rpm -qf "$f"; continue; }
> > 		f=%{_datadir}/pkgconfig/$dep.pc
> > 		[ -f "$f" ] && { rpm -qf "$f"; continue; }
> > 		echo "pkg-config file $dep.pc not found" >&2
> > 	done
> > done
> > 
> 
> Nice idea, but you'll run into difficulties with things like:
> 
> Requires: gdk-${target}-2.0 atk

Also with comma-separated lists and versioned ones like:

  Requires: atk >= 2.0, glib-2.0

The Perl fragment I use to parse pkgconfig files has not been changed
for a long time:

        open (PCFILE, "< $pc") or die "Unable to open: $pc\n";
        while ( <PCFILE> ) {
            chomp;
            # Crude hack to collect and substitute macros.
            if ( /([a-z_]+)=(.*)/ ) {
                $macros{$1} = $2;
            }
            while ( /(\${([a-z_]+)})/ ) {
                $a = $1;
                $b = $2;
                $a =~ s/\$/\\\$/g;
                s/$a/$macros{$b}/g;
            }
            /^Requires/ or next;
            s/^Requires:\s*//;
            s/,/ /g;  # pkgconfig permits space/comma separate lists
            s/>*=\s+\d+(\.\d+)*//g;  # get rid of versions like "foo >= 1.0"
            (my @req) = split;
            push @requires, @req;
        }


[Index of Archives]     [Fedora Users]     [Fedora Development]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux