Requires.private and Libs.private are skipped unless --static is in use.
However, the parser was checking for Libs.private and this option in a
single conditional unlike Requires.private. This was making the check
fall through to the else and emit an "Unknown keyword" debug message
when --static was not used. This was harmless but not true.
https://bugs.freedesktop.org/show_bug.cgi?id=99770
Treat -isystem and -idirafter as -I Cflags since they control the
compiler search path. Adjust the sysroot handling so that the arguments
to these options have the sysroot prefixed. However, leave them out of the
system Cflags handling since these directives are explicitly trying to
adjust the compiler's system header search behavior.
The special-flags test case output needs adjustment since all the flags
are now considered -I flags and come out in the order specified in the
pc file.
https://bugs.freedesktop.org/show_bug.cgi?id=97337
If the original prefix setting is empty, skip prepending the redefined
prefix to other variables. This works the same as if the pc file doesn't
have a prefix variable at all.
https://bugs.freedesktop.org/show_bug.cgi?id=97453-empty
The change to unquote values in the --variable output broke users that
had shell special characters in the variable. Instead, only unquote if
the value starts with " or '. A larger fix to do a full unquote, split
and escaping like --cflags/--libs is possible, but that might break the
old semantics even further.
Add a new function, parse_package_variable(), to handle that logic.
https://bugs.freedesktop.org/show_bug.cgi?id=93284
Rather than responding to the pcfiledir variable specially, store it
in the hash table with all the other package specific variables. This
does result in pcfiledir showing up in the --print-variables output.
Normally, the parser will exit immediately when it encounters errors in
.pc files. This is good most of the time, but for --list-all, the
purpose is to just get a quick list of packages and not to validate .pc
files. This is especially the case for pkg-config wrappers such as the
Ruby or Bash completion modules that scrape the output from --list-all
and don't expect to encounter errors there.
Freedesktop #26615 (https://bugs.freedesktop.org/show_bug.cgi?id=26615)
Allowing pkg-config to override the prefix variable in .pc files is a
useful feature for making packages relocatable. There's nothing Windows
specific about it.
Freedesktop #63602 (https://bugs.freedesktop.org/show_bug.cgi?id=63602)
The prefix redefinition feature on Windows to make packages relocatable
was being confined only to locations where the .pc file was in a
directory ending in lib/pkgconfig or share/pkgconfig. This is too
restrictive as it's quite common for the libdir to have a different name
such as lib64. This keeps the convention that the feature will only be
enabled when the .pc file is in a pkgconfig directory, and it continues
to define the prefix to the grandparent of the pkgconfig directory.
The path handling is switched over to standard glib functions
g_path_get_basename and g_path_get_dirname to avoid handrolled handling
of Windows paths.
Currently the native Win32 builds default to redefining the prefix
variable in .pc files based on their installation paths. This behavior
is not always desired when pkg-config is being used in a traditional
fixed path environment (e.g., /mingw like /usr).
Allow the default to be set via configure switch
--enable/disable-define-prefix, and allow it to be set both ways at
runtime through the --[dont-]define-prefix pkg-config option.
Commit 9bf6277b reworked how Libs arguments are parsed but unfortunately
added an extra library suffix component into -L arguments. This only
affects MSVC syntax where the suffix is .libs. All other platforms use a
blank suffix in linker commands.
Instead of splitting to -l/-L/other and -I/other, keep the args together
and mark each argument with its type. Then we can maintain order all the
way through.
Using a doubly-linked list allows it to be easily traversed in both
directions and makes removing nodes in place much simpler. This adds an
extra pointer to each node and associated manipulation during any list
processing, but this trade seems acceptable over the repeated hacks to
work with singly-linked lists.
When the parser encounters Requires or Requires.private, it immediately
tries to sees if we have a parsed package for that entry. If not it
tries to locate the needed file and parse it out. If there's a circular
dependency, this will eventually error opening too many files.
Instead, just store the requires entries so the parsing completes and
the package is added to the database. After parsing, the entries can be
resolved into Packages and any circular requires entries will find the
first package in the database.
This is a partial fix for Freedesktop #7331.
Without this, if the new ${prefix} path contains spaces, they are not
properly quoted in pkg-config's output. Besides the problems this causes
with things using the output, this also causes nonsensical results when
pkg-config splits such options to combine equal options.
Glib's g_shell_parse_argv offers basically a 1:1 replacement for
poptParseArgvString except that you have to free all the elements of
the array explicitly.
We used to call gnome-config, gtk-config, glib-config and so on, which
was useful in the beginning of pkg-config. This hasn't served any
practical purpose in recent years, so drop the support.
The bundled popt handled the case of Cflags or Libs with no value, but
newer popt linked through --with-installed-popt chokes parsing it into
a vector. This is arguably a popt bug in poptParseArgvString, but I
guess they expect you not to ask it to split an empty string.
Allow paths and other components to contain shell metacharacters, but
escape them on output. White space has to be escaped in the input
files using quotes or backslashes
Freedesktop.org #3571
* parse.c: On Win32, if the value of a a variable other than the
"prefix" one starts with the non-overridden value of "prefix",
then replace that prefix, too, with the run-time one.
To avoid shadowing warnings, rename a 'p' variable to 'q'.
* pkg-config.1: Corresponding update.
* main.c
* pkg.h: Move the Win32 redefinition of PKG_CONFIG_PC_PATH from
main.c to pkg.h as it now is needed in pkg.c, too.
* pkg.[ch], parse.[ch], main.c, check/Makefile.am,
check/check-missing, check/missing-requires-private.pc:
Skip Requires.private unless we need to look at them for cflags.
Add test case. Thanks to Loïc Minier for most of the idea and the
implementation. Debian #475031
* parse.c (_do_parse_libs): Special-case "-lib:" in the Libs
field; it's not an -l. Yes, this breaks if your library is called
libib:$something, in which case you lose. Gnome #142952
* main.c: Remove the possibility to have a default PKG_CONFIG_PATH
in the Registry. It is much more flexible to just use environment
variables. In general the Registry is not used in the ports of
GTK+ or GNOME libraries and software to Windows.
* parse.c (parse_line): On Windows, handle also .pc files found in
a share/pkgconfig folder when automatically redefining a prefix
variable for the package.
* pkg-config.1: Corresponding changes.
2008-02-18 Tor Lillqvist <tml@novell.com>
* main.c: Fix some bitrot: On Windows, don't use the compile-time
PKG_CONFIG_PC_PATH, but deduce a default one at run-time based on
the location of the executable. This was originally what
pkg-config did on Windows, but it had bit-rotted.
* parse.c: Fix problem on Win32 where the automagic prefix
replacement logic didn't work. I don't know what change had
broken it.
(pathnamecmp): New Win32-only function. Compares two file
paths case insensitively and treating backslashes as equal to
slashes.
(parse_line): Use it instead of g_ascii_strcasecmp().
* parse.c (parse_package_file and others): Move the reversal of
the _libs lists to the end to avoid double-reversing either.
Thanks to J. Scott Berg for both the bug and the fix. Freedesktop
#9132
* parse.c (trim_and_sub): Since %{...} has not been used for a
long time, there is no point in being able to escape %. However,
make the code able to escape $ by doubling the $ to $$.
Debian #378570
Author: tfheen
Date: 2005-05-21 09:14:47 GMT
2005-05-21 Tollef Fog Heen <tfheen@err.no>
* check/check-libs-private: New test to check for support for
private libraries.
* check/simple.pc (prefix): Add Libs.private header.
* check/Makefile.am (TESTS): Add check-libs-private test
* pkg.h: Adjust function prototypes.
* pkg.c: Add global ignore_private_libs variable.
(scan_dir): Use the correct free function. Stop leaking file
descriptors.
(package_get_l_libs, packages_get_l_libs, package_get_L_libs,
packages_get_L_libs): Stop the recursive silliness and go back to
old behaviour.
(packages_get_all_libs): Adjust parameters to packages_get_*_libs
(enable_private_libs, disable_private_libs): Trivial helper
functions.
* pkg-config.1: Update documentation wrt search path (Debian
#308942), update docs for Libs.private and add the problematic
handling of mixing = and non-= arguments to the bugs section.
* parse.h: Adjust parameters for parse_package_file to get private
libs or not.
* parse.c (trim_and_sub): Fix memory leak.
(_do_parse_libs): New function including what's common between
parse_libs and parse_private_libs.
(parse_libs_private): New function. Handle private libraries.
(parse_line): Add . to the list of valid characters in headers (so
Libs.private works correctly.
(parse_line): Fix memory leaks.
(parse_line): Handle Libs.private.
(parse_package_file): Fix memory leak.
* main.c (main): Fix memory leak.
* NEWS: Document changes to inter-library handling.
* main.c (main): Handle inter-library dependencies old-style, but
do private libraries too. Adjust parameters to
packages_get_*_libs.
* configure.in: Change comment wrt inter-library handling to talk
about private libraries instead.
Author: tfheen
Date: 2005-03-22 08:54:08 GMT
2005-03-18 Tollef Fog Heen <tfheen@debian.org>
* pkg.c (print_package_list): Ignore requires when just listing
the available packages.
(internal_get_package): Pass ignore_requires on.
* parse.h: update prototype for parse_package_file.
* parse.c (parse_line): Ignore Requires when told so.
(parse_package_file): Pass ingore_requires on to parse_line.
(Freedesktop #191, Debian #232719)
Author: jamesh
Date: 2003-05-01 01:14:30 GMT
2003-04-30 James Henstridge <james@daa.com.au>
* pkg.c (verify_package): fix up error messages.
* parse.c (parse_line): don't error out on unknown keywords, as
they may represent future extensions to the file format.
Author: hp
Date: 2003-02-15 15:04:07 GMT
2003-02-15 Havoc Pennington <hp@pobox.com>
Fixes suggested by Werner Trobin
* main.c (verbose_error): honor --errors-to-stdout and flush
the same stream we write to
* parse.c (parse_url): support an "url" field so if someone
has a .pc file they can figure out where to go for newer
versions and such
Author: tml
Date: 2002-09-26 17:25:41 GMT
2002-09-26 Tor Lillqvist <tml@iki.fi>
* parse.c (get_compat_package): Return NULL right away on
Windows. There has never been any of these legacy *-config scripts
distributed for Windows as far as I know.
Author: hp
Date: 2002-09-06 20:00:08 GMT
2002-09-06 Havoc Pennington <hp@redhat.com>
* parse.c, pkg.c: handle other_libs other_cflags same
as -l/-L/-I flags, so we pull in from dependent packages.
Closes#85244, #90706, #89851