text
stringlengths
0
834k
}
my @FINDLIBS = @ARGV or die ""Must specify at least one library"";
if($AtLeastVersion) {
@FINDLIBS = map { ""$_ >= $AtLeastVersion"" } @FINDLIBS;
} elsif($MaxVersion) {
@FINDLIBS = map { ""$_ <= $MaxVersion"" } @FINDLIBS;
} elsif($ExactVersion) {
@FINDLIBS = map { ""$_ = $ExactVersion"" } @FINDLIBS;
}
my $o = PkgConfig->find(\@FINDLIBS, %pc_options);
if($o->errmsg) {
# --errors-to-stdout
if ($print_errors == 2) {
print STDOUT $o->errmsg;
# --print-errors
} elsif ($print_errors == 1) {
print STDERR $o->errmsg;
}
# --silence-errors
exit(1);
}
if($o->print_variables) {
while (my ($k,$v) = each %{$o->defined_variables}) {
print $k;
if($o->print_values) {
print ""=$v"";
} else {
print ""\n"";
}
}
}
if($OutputVariableValue) {
my $val = ($o->_pc_var($OutputVariableValue) or """");
print $val . ""\n"";
}
if(!$WantFlags) {
exit(0);
}
if($PrintVersion) {
print $o->pkg_version . ""\n"";
exit(0);
}
my @print_flags;
if($PrintCflags) {
@print_flags = $o->get_cflags;
}
if($PrintCflagsOnlyI) {
@print_flags = grep /^-I/, $o->get_cflags;
}
if($PrintCflagsOnlyOther) {
@print_flags = grep /^-[^I]/, $o->get_cflags;
}
if($PrintLibs) {
@print_flags = $o->get_ldflags;
}
if ($PrintLibsOnlyOther) {
@print_flags = grep /^-[^LRl]/, $o->get_ldflags;
}
# handle --libs-only-L and --libs-only-l but watch the case when
# we got 'ppkg-config --libs-only-L --libs-only-l foo' which must behave just like
# 'ppkg-config --libs-only-l foo'
if($PrintLibsOnlyl or ($PrintLibsOnlyl and $PrintLibsOnlyL)) {
@print_flags = grep /^-l/, $o->get_ldflags;
} elsif ($PrintLibsOnlyL) {
@print_flags = grep /^-[LR]/, $o->get_ldflags;
}
print scalar PkgConfig::_return_context(@print_flags);
print ""\n"";
exit(0);
__END__
=head1 NAME
PkgConfig - Pure-Perl Core-Only replacement for pkg-config
=head1 SYNOPSIS
=head2 As a replacement for C<pkg-config>
$ ppkg-config --libs --cflags --static gio-2.0
#outputs (lines artificially broken up for readability):