1PkgConfig::LibPkgConf::UCsleirenCto(n3t)ributed Perl DocPukmgeCnotnaftiigo:n:LibPkgConf::Client(3)
2
3
4
6 PkgConfig::LibPkgConf::Client - Query installed libraries for compiling
7 and linking software
8
10 use PkgConfig::LibPkgConf::Client;
11
12 my $client = PkgConfig::LibPkgConf::Client->new;
13 $client->env;
14
15 my $pkg = $client->find('libarchive');
16 my $cflags = $pkg->cflags;
17 my $libs = $pkg->libs;
18
20 The PkgConfig::LibPkgConf::Client objects store all necessary state for
21 "libpkgconf" allowing for multiple instances to run in parallel.
22
24 new
25 my $client = PkgConfig::LibPkgConf::Client->new(%opts);
26 my $client = PkgConfig::LibPkgConf::Client->new(\%opts);
27
28 Creates an instance of PkgConfig::LibPkgConf::Client. Possible options
29 include:
30
31 path
32 The search path to look for ".pc" files. This may be specified
33 either as a string with the appropriate path separator character,
34 or as a list reference. This will override the "pkgconf" compiled
35 in defaults and the environment variables for "PKG_CONFIG_PATH" or
36 "PKG_CONFIG_LIBDIR".
37
38 filter_lib_dirs
39 List of directories to filter for libraries. This overrides the
40 "pkgconf" compiled in default and environment variable for
41 "PKG_CONFIG_SYSTEM_LIBRARY_PATH".
42
43 filter_include_dirs
44 List of directories to filter for include. This overrides the
45 "pkgconf" compiled in default and environment variable for
46 "PKG_CONFIG_SYSTEM_INCLUDE_PATH".
47
48 environment variables honored:
49
50 PKG_CONFIG_PATH
51 PKG_CONFIG_LIBDIR
52 PKG_CONFIG_SYSTEM_LIBRARY_PATH
53 PKG_CONFIG_SYSTEM_INCLUDE_PATH
54 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
55 PKG_CONFIG_ALLOW_SYSTEM_LIBS
56
58 path
59 my @path = $client->path;
60
61 The search path to look for ".pc" files.
62
63 filter_lib_dirs
64 my @dirs = $client->filter_lib_dirs;
65
66 List of directories to filter for libraries.
67
68 filter_include_dirs
69 my @dirs = $client->filter_include_dirs;
70
71 List of directories to filter for includes.
72
73 sysroot_dir
74 my $dir = $client->sysroot_dir;
75 $client->sysroot_dir($dir);
76
77 Get or set the sysroot directory.
78
79 buildroot_dir
80 my $dir = $client->buildroot_dir;
81 $client->buildroot_dir($dir);
82
83 Get or set the buildroot directory.
84
85 maxdepth
86 my $int = $client->maxdepth;
87 $client->maxdepth($int);
88
89 Get or set the maximum dependency depth. This is 2000 by default.
90
92 env
93 my $client->env;
94
95 This method loads settings for the client object from the environment
96 using the standard "pkg-config" or "pkgconf" environment variables. It
97 honors the following list of environment variables:
98
99 PKG_CONFIG_LOG
100
101 find
102 my $pkg = $client->find($package_name);
103
104 Searches the <.pc> file for the package with the given $package_name.
105 If found returns an instance of PkgConfig::LibPkgConf::Package. If not
106 found returns "undef".
107
108 package_from_file
109 my $pkg = $client->package_from_file($filename);
110
111 Load the specific <.pc> file.
112
113 scan_all
114 $client->scan_all(sub {
115 my($client, $package) = @_;
116 ...
117 return $bool;
118 });
119
120 Iterates through all packages and calls the given subroutine reference
121 for each package. $package isa PkgConfig::LibPkgConf::Package. The
122 scan will continue so long as a non true value is returned (as $bool).
123
124 global
125 $client->global($key => $value);
126 my $value = $client->global($key);
127
128 Define or get the global variable.
129
130 error
131 my $client->error($message);
132
133 Called when "libpkgconf" comes across a non-fatal error. By default
134 the error is simply displayed as a warning using Carp. The intention
135 of this method is if you want to override that behavior, you will
136 subclass PkgConfig::LibPkgConf::Client and implement your own version
137 of the "error" method.
138
139 audit_set_log
140 $client->audit_set_log($filename, $mode);
141
142 Opens a file with the C "fopen" style $mode, and uses it for the audit
143 log. The file is managed entirely by the client class and will be
144 closed when the object falls out of scope. Examples:
145
146 $client->audit_set_log("audit.log", "a"); # append to existing file
147 $client->audit_set_log("audit2.log", "w"); # new or replace file
148
150 IRC #native on irc.perl.org
151
152 Project GitHub tracker:
153
154 <https://github.com/plicease/PkgConfig-LibPkgConf/issues>
155
156 If you want to contribute, please open a pull request on GitHub:
157
158 <https://github.com/plicease/PkgConfig-LibPkgConf/pulls>
159
161 For additional related modules, see PkgConfig::LibPkgConf
162
164 Graham Ollis
165
166 For additional contributors see PkgConfig::LibPkgConf
167
169 This software is copyright (c) 2016 Graham Ollis.
170
171 This is free software; you may redistribute it and/or modify it under
172 the same terms as the Perl 5 programming language system itself.
173
174
175
176perl v5.34.0 2022-01-21 PkgConfig::LibPkgConf::Client(3)