NAME
PkgConfig::LibPkgConf::Client - Query installed libraries for compiling and linking software
SYNOPSIS
use PkgConfig::LibPkgConf::Client;
my $client = PkgConfig::LibPkgConf::Client->new;
$client->env;
my $pkg = $client->find('libarchive');
my $cflags = $pkg->cflags;
my $libs = $pkg->libs;
DESCRIPTION
The PkgConfig::LibPkgConf::Client objects store all necessary state for libpkgconf
allowing for multiple instances to run in parallel.
CONSTRUCTOR
new
my $client = PkgConfig::LibPkgConf::Client->new(%opts);
my $client = PkgConfig::LibPkgConf::Client->new(\%opts);
Creates an instance of PkgConfig::LibPkgConf::Client. Possible options include:
- path
-
The search path to look for
.pc
files. This may be specified either as a string with the appropriate path separator character, or as a list reference. This will override thepkgconf
compiled in defaults and the environment variables forPKG_CONFIG_PATH
orPKG_CONFIG_LIBDIR
. - filter_lib_dirs
-
List of directories to filter for libraries. This overrides the
pkgconf
compiled in default and environment variable forPKG_CONFIG_SYSTEM_LIBRARY_PATH
. - filter_include_dirs
-
List of directories to filter for include. This overrides the
pkgconf
compiled in default and environment variable forPKG_CONFIG_SYSTEM_INCLUDE_PATH
.
environment variables honored:
- PKG_CONFIG_PATH
- PKG_CONFIG_LIBDIR
- PKG_CONFIG_SYSTEM_LIBRARY_PATH
- PKG_CONFIG_SYSTEM_INCLUDE_PATH
- PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
- PKG_CONFIG_ALLOW_SYSTEM_LIBS
ATTRIBUTES
path
my @path = $client->path;
The search path to look for .pc
files.
filter_lib_dirs
my @dirs = $client->filter_lib_dirs;
List of directories to filter for libraries.
filter_include_dirs
my @dirs = $client->filter_include_dirs;
List of directories to filter for includes.
sysroot_dir
my $dir = $client->sysroot_dir;
$client->sysroot_dir($dir);
Get or set the sysroot directory.
buildroot_dir
my $dir = $client->buildroot_dir;
$client->buildroot_dir($dir);
Get or set the buildroot directory.
maxdepth
my $int = $client->maxdepth;
$client->maxdepth($int);
Get or set the maximum dependency depth. This is 2000 by default.
METHODS
env
my $client->env;
This method loads settings for the client object from the environment using the standard pkg-config
or pkgconf
environment variables. It honors the following list of environment variables:
- PKG_CONFIG_LOG
find
my $pkg = $client->find($package_name);
Searches the <.pc> file for the package with the given $package_name
. If found returns an instance of PkgConfig::LibPkgConf::Package. If not found returns undef
.
package_from_file
my $pkg = $client->package_from_file($filename);
Load the specific <.pc> file.
scan_all
$client->scan_all(sub {
my($client, $package) = @_;
...
return $bool;
});
Iterates through all packages and calls the given subroutine reference for each package. $package
isa PkgConfig::LibPkgConf::Package. The scan will continue so long as a non true value is returned (as $bool
).
global
$client->global($key => $value);
my $value = $client->global($key);
Define or get the global variable.
error
my $client->error($message);
Called when libpkgconf
comes across a non-fatal error. By default the error is simply displayed as a warning using Carp. The intention of this method is if you want to override that behavior, you will subclass PkgConfig::LibPkgConf::Client and implement your own version of the error
method.
audit_set_log
$client->audit_set_log($filename, $mode);
Opens a file with the C fopen
style $mode
, and uses it for the audit log. The file is managed entirely by the client class and will be closed when the object falls out of scope. Examples:
$client->audit_set_log("audit.log", "a"); # append to existing file
$client->audit_set_log("audit2.log", "w"); # new or replace file
SUPPORT
IRC #native on irc.perl.org
Project GitHub tracker:
https://github.com/plicease/PkgConfig-LibPkgConf/issues
If you want to contribute, please open a pull request on GitHub:
https://github.com/plicease/PkgConfig-LibPkgConf/pulls
SEE ALSO
For additional related modules, see PkgConfig::LibPkgConf
AUTHOR
Graham Ollis
For additional contributors see PkgConfig::LibPkgConf
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 Graham Ollis.
This is free software; you may redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.