text
stringlengths
0
834k
'debug' => \my $Debug,
'with-path=s', => \my @ExtraPaths,
'env-only', => \my $EnvOnly,
'guess-paths', => \my $GuessPaths,
'h|help|?' => \my $WantHelp
) or pod2usage(@POD_USAGE_OPTIONS);
if($^O eq 'msys' && !$ENV{PKG_CONFIG_NO_OS_CUSTOMIZATION}) {
$UseStatic = 1;
}
if($WantHelp) {
pod2usage(@POD_USAGE_OPTIONS, -exitval => 0);
}
if($Debug) {
eval {
Log::Fu::set_log_level('PkgConfig', 'DEBUG');
};
$PkgConfig::UseDebugging = 1;
}
if($GuessPaths) {
PkgConfig->GuessPaths();
}
if($PrintAPIversion) {
print '0.', $compat_version, ""\n"";
exit(0);
}
if($AtLeastPkgConfigVersion) {
my($major,$minor,$patch) = split /\./, $AtLeastPkgConfigVersion;
exit 1 if $major > 0;
exit 1 if $minor > $compat_version;
exit 1 if $minor == $compat_version && $patch > 0;
exit 0;
}
if($PrintRealVersion) {
printf STDOUT (""ppkg-config - cruftless pkg-config\n"" .
""Version: %s\n"", $PkgConfig::VERSION);
exit(0);
}
if($PrintErrors) {
$print_errors = 1;
}
if($SilenceErrors) {
$print_errors = 0;
}
# This option takes precedence over all other options
# be it:
# --silence-errors
# or
# --print-errors
if ($ErrToStdOut) {
$print_errors = 2;
}
my $WantFlags = ($PrintCflags || $PrintLibs || $PrintLibsOnlyL || $PrintCflagsOnlyI || $PrintCflagsOnlyOther || $PrintLibsOnlyOther || $PrintLibsOnlyl || $PrintVersion);
if($WantFlags) {
$print_errors = 1 unless $SilenceErrors;
}
my %pc_options;
if($PrintExists || $AtLeastVersion || $ExactVersion || $MaxVersion || $PrintVersion) {
$pc_options{no_recurse} = 1;
}
$pc_options{static} = $UseStatic;
$pc_options{search_path} = \@ExtraPaths;
if($EnvOnly) {
delete $pc_options{search_path};
$pc_options{search_path_override} = [ @ExtraPaths, @ENV_SEARCH_PATH];
}
$pc_options{print_variables} = $PrintVariables;
$pc_options{print_values} = $PrintValues;
$pc_options{VARS} = \%UserVariables;
if($ListAll) {
my $o = PkgConfig->find([], %pc_options);
my @list = $o->get_list();
# can't use List::Util::max as it wasn't core until Perl 5.8
my $max_length = 0;
foreach my $length (map { length $_->[0] } @list) {
$max_length = $length if $length > $max_length;
}
printf ""%-${max_length}s %s\n"", $_->[0], $_->[1] for @list;
exit(0);