1PkgConfig::LibPkgConf::UPsaecrkaCgoen(t3r)ibuted Perl DoPckugmCeonntfaitgi:o:nLibPkgConf::Package(3)
2
3
4

NAME

6       PkgConfig::LibPkgConf::Package - Represents a package
7

SYNOPSIS

9        use PkgConfig::LibPkgConf::Client;
10
11        my $client = PkgConfig::LibPkgConf::Client->new;
12        $client->env;
13
14        my $pkg = $client->find('libarchive');
15
16        # use with system in scalar form:
17        my $cflags = $pkg->cflags;
18        my $libs = $pkg->libs;
19        system "$cc $cflags foo.c";
20        system "$cc -o foo foo.o $libs";
21
22        # use with system in list form:
23        my @cflags = $pkg->list_cflags;
24        my @libs   = $pkg->list_libs;
25        system $cc, @cflags, 'foo.c';
26        system $cc, -p => 'foo', 'foo.o', @libs;
27

DESCRIPTION

29       The PkgConfig::LibPkgConf::Package object stores package information.
30       Part of the package information is the compiler and linker flags.  This
31       can be fetched as strings with "cflags" and "libs" and as a list with
32       "list_cflags" and "list_libs".  In the string form, escapes are
33       retained, but in list form the white space escapes are converted into
34       spaces.  That means if you are using the string form of "system"/"exec"
35       you should use the string accessors, and if you are using the list form
36       of "system"/"exec" you should use the list accessors.
37

ATTRIBUTES

39   refcount
40       Internal reference count used by "pkgconf".
41
42   id
43       The id of the package.
44
45   filename
46       The filename of the ".pc" file.
47
48   realname
49       The real name for the package.
50
51   version
52       The version of the package.
53
54   description
55       Description of the package.
56
57   url
58       URL for the package.
59
60   pc_filedir
61       TODO
62

METHODS

64   libs
65       Library flags.  This usually includes things like "-L/foo/lib" and
66       "-lfoo".
67
68   libs_static
69       Static library flags.
70
71   cflags
72       Compiler flags.  This usually includes things like "-I/foo/include" and
73       "-DFOO=1".
74
75   cflags_static
76       Static compiler flags.
77
78   list_libs
79        my @fragments = $package->list_libs;
80
81       Library flags as a list of fragments PkgConfig::LibPkgConf::Fragment.
82       This is similar to the "libs" method above, but since it returns a list
83       instead of a single string, it can be used to filter for specific
84       flags.  For example:
85
86        # equivalent to pkgconf --libs-only-L
87        my @lib_dirs = grep { $_->type eq 'L' } $package->list_libs;
88        # equivalent to pkgconf --libs-only-l
89        my @libs = grep { $_->type eq 'l' } $package->list_libs;
90
91   list_libs_static
92        my @fragments = $package->list_libs_static;
93
94       Similar to "list_libs", but for the static libs flags.
95
96   list_cflags
97        my @fragments = $package->list_cflags;
98
99       Compiler flags as a list of fragments PkgConfig::LibPkgConf::Fragment.
100       This is similar to the "cflags" method above, but since it returns a
101       list instead of a single string, it can be used to filter for specific
102       flags.  For example:
103
104        # equivalent to pkgconf --cflags-only-I
105        my @include_dirs = grep { $_->type eq 'I' } $package->list_cflags;
106        # equivalent to pkgconf --cflags-only-other
107        my @other_cflags = grep { $_->type ne 'I' } $package->list_cflags;
108
109   list_cflags_static
110        my @fragments = $package->list_cflags_static;
111
112       Similar to "list_cflags", but for the static compiler flags.
113
114   variable
115        my $value = $package->variable($key);
116
117       Look up the value for the given variable.  Returns the value if found,
118       otherwise it will return undef (technically empty list).
119

SUPPORT

121       IRC #native on irc.perl.org
122
123       Project GitHub tracker:
124
125       <https://github.com/plicease/PkgConfig-LibPkgConf/issues>
126
127       If you want to contribute, please open a pull request on GitHub:
128
129       <https://github.com/plicease/PkgConfig-LibPkgConf/pulls>
130

SEE ALSO

132       For additional related modules, see PkgConfig::LibPkgConf
133

AUTHOR

135       Graham Ollis
136
137       For additional contributors see PkgConfig::LibPkgConf
138
140       This software is copyright (c) 2016 Graham Ollis.
141
142       This is free software; you may redistribute it and/or modify it under
143       the same terms as the Perl 5 programming language system itself.
144
145
146
147perl v5.30.1                      2020-01-30 PkgConfig::LibPkgConf::Package(3)
Impressum