Commit graph

477 commits

Author SHA1 Message Date
Dan Nicholson
8d19fad1a0 Also match -Wl,-framework for OSX framework
Freedesktop #1278 (https://bugs.freedesktop.org/show_bug.cgi?id=1278)
2016-01-29 14:44:34 -08:00
Alexander Larsson
ae0a8b1ad5 Allow overriding package variables with env vars
pkg-config allows a way to override package variables through the
--define-prefix interface, but this is very cumbersome to do in a global
way since it always needs to be passed on the command line and the
override cannot be scoped to a single packge.

Allow overriding package variables using environment variables of the
form PKG_CONFIG_$PACKAGE_$VARIABLE. For example, setting
PKG_CONFIG_GLADEUI_2_0_CATALOGDIR will override the variable
"catalogdir" in the "gladeui-2.0" package.

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2016-01-29 14:32:24 -08:00
Alexander Larsson
9ef2d3475d Pass key into parse_package_key so it can be set early
We will need this to properly pick up environment-overridden
per-package vairables.

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2016-01-29 14:25:21 -08:00
Chun-wei Fan
52baea8489 README.win32: Add info on building with MSVC 2015-10-28 08:39:10 -07:00
Chun-wei Fan
5f70074d46 build: Add NMake makefiles for Visual Studio builds
This adds a set of NMake Makefiles that can be used to build pkg-config on
Windows using Visual Studio.  Note that, since the Visual Studio builds of
GLib does not use pkg-config, this NMake Makefile set does not support the
build of the bundled GLib sources, instead, having GLib built beforehand
is required.
2015-10-26 09:16:56 -07:00
Chun-wei Fan
1ed336759f build: Add a pre-configure config.h template for MSVC builds
This adds a pre-configured config.h(.win32.in) that can be used for builds
on Visual Studio, where autotools is normally not available, so that we
can build pkg-config on Visual Studio.
2015-10-26 09:16:27 -07:00
Chun-wei Fan
56061ef3ef build: Split Out Source Listing
Move the source listing into another Makefile module so that it can be
shared with other Makefile-based build mechanisms.
2015-10-26 09:15:53 -07:00
Chun-wei Fan
dd57ff3547 pkg.c: Port from dirent to GDir
Port the code to use the GDir APIs from dirent so that we don't have to
depend on a dirent implementation on platforms that do not have it, such
as Visual Studio, so that it is possible to build pkg-config out of the
box on any platform that is supported by GLib (and the bundled GLib).
2015-10-26 09:15:53 -07:00
Dan Nicholson
5914edfe96 Update to 0.29 2015-09-26 21:14:47 -07:00
Dan Nicholson
56c9d85369 m4: Change all comment markers to dnl
Using # leaves the comments within the generated configure file, which
is just unnecessary bloat since no one would read the generated
configure file for the documentation of the macros.
2015-09-26 21:08:45 -07:00
Dan Nicholson
5e786130a5 m4: Add Since releases and cleanup comments
Note which release each macro was added in and cleanup the comments to
be more consistent between them.
2015-09-26 20:58:25 -07:00
Dan Nicholson
d5c6358eda m4: Update serial to 11
This was determined by counting the number of changes to pkg.m4 since
the initial serial number was added. The trailing comment is also
updated to have the version number substituted.
2015-09-26 19:56:40 -07:00
Dan Nicholson
b51cd2165d m4: Add PKG_PREREQ version checking macro
While PKG_PROG_PKG_CONFIG checks the version of pkg-config available at
build time, it doesn't check the version of the pkg-config macros being
used. PKG_PREREQ (like AC_PREREQ or LT_PREREQ) can be used to check the
version of the macros in use when configure is being generated by the
developer.

https://bugs.freedesktop.org/show_bug.cgi?id=89267
2015-09-26 15:02:36 -07:00
Dan Nicholson
7e8b0bf6d9 m4: Process pkg.m4 through AC_CONFIG_FILES
Currently there are no substitutions needed in pkg.m4, but this will
allow autoconf values such as the package version to be included.
2015-09-26 15:01:37 -07:00
Dan Nicholson
d377ee6b74 build: Force linking of host tool
In case a reinstall is being performed, ensure than an existing host
tool is overwritten.

https://bugs.freedesktop.org/show_bug.cgi?id=90437
2015-06-13 09:50:14 -07:00
Peter Jones
40342dd0ea Enable large file support
https://bugs.freedesktop.org/show_bug.cgi?id=90078

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-04-20 22:08:22 -07:00
Dan Nicholson
cdaa522911 Fix relocatable test in wine
Wine outputs the paths with carriage returns, which later breaks
commands they're used in. Hopefully this doesn't break the msys case,
but I think it should be safe enough. Really this needs general handling
of Windows paths instead of ad hoc fixes, but that's for another day.

https://bugs.freedesktop.org/show_bug.cgi?id=66939
2015-02-21 11:37:49 -08:00
Dan Nicholson
818aeace3b Sort --print-variables output
Makes the output consistent regardless of how glib puts together the
variables hash table.

https://bugs.freedesktop.org/show_bug.cgi?id=66939
2015-02-21 10:55:00 -08:00
Dan Nicholson
a6e8749ada Quote pc_path virtual variable
Since we unquote variables on printing, we want to quote in before adding
to the database. For all other variables defined in .pc files, we assume
that the user has quoted the variable correctly.

This was broken with the fix for bug 67904, but seems to only affect
Windows builds.
2014-12-09 06:29:26 -08:00
Dan Nicholson
2808a5497c check: Test that the pcfiledir variable is output correctly 2014-12-09 06:23:33 -08:00
Dan Nicholson
9294307b21 Handle pcfiledir variable like normal variable
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.
2014-12-09 05:24:43 -08:00
Daniel Macks
30437b47c8 Use same token for malloc as for string construction
The goal is for pkgname to hold the name without the trailing ".pc"
extension (according to the meaning of EXT_LEN as used in the
ends_in_dotpc() function). But the malloc is hardcoded as 2. If the
extension were to be changed, the number of characters being strncpy'ed
would not match the size of the target buffer. Instead, the malloc
should use the EXT_LEN token (adjusted for the trailing \0).

Freedesktop #80378 (https://bugs.freedesktop.org/show_bug.cgi?id=80378)
2014-11-12 07:47:57 -08:00
Daniel Macks
a4ef3552eb Bump scanned_dir_count even if dir cannot be read
This allows the --debug output to follow the actual order of the
directories specified in the path.

  $ PKG_CONFIG_PATH=/nosuch1:/nosuch2:/dir-with-foo.pc
  $ pkg-config --debug foo
  [...]
  Path position of 'foo' is 1

With this change, the path position above would be 3, matching the
position in PKG_CONFIG_PATH.

Freedesktop #80380 (https://bugs.freedesktop.org/show_bug.cgi?id=80380)
2014-11-12 07:45:19 -08:00
Dan Nicholson
0e847a2201 Add --validate option to check .pc syntax without dependencies
Provide developers a way to check their .pc files prior to release. This
works the same as --exists except that package dependencies are not
processed. That allows the .pc file to be checked in complete isolation
of others.

Freedesktop #7000 (https://bugs.freedesktop.org/show_bug.cgi?id=7000)
2014-09-27 16:45:50 -07:00
Andrew Oakley
ce1a2416ce Strip system library directories reliably
This loop was changed from a while loop to a for loop in commit
9bf6277b, but the iterator is now advanced twice each time round the
loop.
2014-09-27 16:20:37 -07:00
Dan Nicholson
82316c17b4 Ensure usage of serial test driver in automake
Automake has a nice parallel test driver available since 1.12 which
became the default in 1.13. Unfortunately, it breaks the pkg-config
testsuite, so we need to ensure the serial test driver is used. On 1.12,
we can specify the option 'serial-tests', but this doesn't exist on
1.11. Kludge around this by detecting if the automake version is less
than 1.12 and leaving the option out in that case.
2014-09-27 16:20:32 -07:00
Dan Nicholson
29cddacd30 Update overlinking URL in guide
The Mandriva wiki is just being archived now, so point to the active
OpenMandriva article instead.
2014-09-22 12:25:16 -07:00
Dan Nicholson
4f0084d9d3 glib: Fix Makefiles to suppress warnings from automake
With the newly added glib.mk, some of the noinst_* variables need to use
+= in the evaluation to avoid multiple definition warnings from
automake.
2014-02-03 16:07:31 -08:00
Dan Nicholson
90320817dc glib: Update snapshot version to 2.38.2
This is the latest stable release from upstream. Patches have been
refreshed, including putting the removal of most pkg-config checks into
the glib-only patch. A few more files, most notably the large NEWS file,
have also been removed from the repo to keep the size of the snapshot
down.
2014-02-03 15:41:27 -08:00
Dan Nicholson
e1d44d2362 Don't used C reserved identifiers
Seems incredibly unlikely this would ever be an issue, but it's easy
enough to fix it. I fear for the Glib/GObject world where this is a
standard design pattern.

https://www.securecoding.cert.org/confluence/display/seccode/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier

Freedesktop #70690 (https://bugs.freedesktop.org/show_bug.cgi?id=70690)
2013-12-16 05:32:04 -08:00
Dan Nicholson
abdbaba3e0 Ensure -isystem Cflags not compressed like -I
Treat -isystem specially like -idirafter so that multiple arguments
retain the preceding -isystem.

Freedesktop #72584 (https://bugs.freedesktop.org/show_bug.cgi?id=72584)
2013-12-14 10:47:56 -08:00
Dan Nicholson
860cab9a3e check: Rework dirafter test to handle all special cases
Expand the special flags test to check -framework usage and the handling
of multiple arguments.
2013-12-14 10:47:56 -08:00
Matthias Clasen
9f65411341 Add missing options to manual
Freedesktop #66155 (https://bugs.freedesktop.org/show_bug.cgi?id=66155)
2013-09-21 07:58:02 -07:00
Marek Kasik
50c2867f4a Unquote values of requested variables
If a --variable is requested, make sure to remove the quoting since it's
likely the value will be used verbatim in shell command substitution. If
the quotes remain in the value, they'd get embedded in the shell
variable, too.

Freedesktop #67904 (https://bugs.freedesktop.org/show_bug.cgi?id=67904)
2013-09-15 10:27:35 -07:00
Dan Nicholson
f26a505826 Strip trailing space from --cflags/--libs output
pkg-config leaves a trailing space on the flags output as it may have to
do multiple iterations to collect all output and adding the space makes
concatenation simple. However, this leaves a trailing space on the full
returned string unless it's empty. Strip the trailing space after all
the processing is complete.
2013-05-31 05:53:47 -07:00
Dan Nicholson
dbf1b7cd09 check: Convert paths to Windows format when using --define-prefix
When pkg-config redefines the .pc file's prefix variable, it will be in
the platform's native format. Convert the expected results as
necessary. This only affects the relocatable test because it explicitly
sets --define-prefix or uses .pc files in a pkgconfig/ directory. Other
tests do not have their prefixes redefined for this reason.
2013-05-31 05:31:02 -07:00
Dan Nicholson
719abc7910 check: Make relocatable script executable 2013-05-22 05:28:54 -07:00
Dan Nicholson
a65ee007bb Avoid const warning on Win32
scan_dir() alters the directory name in place on Win32 to convert \ to
/, so it can't be treated as const.
2013-05-20 05:56:50 -07:00
Dan Nicholson
0efb668bd5 Add static linking variant of PKG_CHECK_MODULES
PKG_CHECK_MODULES_STATIC is a convenience autoconf macro wrapping
PKG_CHECK_MODULES with --static enabled. This gives developers a way to
get static linking information from a specific set of modules.

Freedesktop #19541 (https://bugs.freedesktop.org/show_bug.cgi?id=19541)
2013-05-18 19:37:24 -07:00
Dan Nicholson
715cc306b0 Allow errors in .pc files for --list-all
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)
2013-05-17 05:53:13 -07:00
Dan Nicholson
2f41b2de42 Silence errors by default with --list-all
When listing all packages, the purpose is to get a quick look at what's
installed and not to scrutinize the validity of each .pc file. To see
errors from the parser during --list-all, the user can just add
--print-errors.
2013-05-17 05:49:02 -07:00
Dan Nicholson
1085ba7377 rpmvercmp: Use helper macros to match upstream code better
Upstream rpm has some convenience inline functions for strcmp and the
character class functions. Define some macros here to make our code look
more like upstream despite being the same functionally.

One difference noted while investigating the inline functions in
upstream is that the rpm character class functions are slightly
different from the standard functions. The rpm functions are independent
of locale, unlike the libc routines. pkg-config should probably do the
same and could easily use the g_ascii_is* macros from glib.
2013-05-17 05:36:12 -07:00
Dan Nicholson
f78b014371 rpmvercmp: Return -1/0/1 as function says it will
strcmp is only guaranteed to return !0 when the strings are unmatched
while rpmvercmp says it will return only -1 or 1 in those cases.

pkg-config currently only checks for !0, so this doesn't actually fix
any issues here. However, this is harmless and helps minimize the diff
with upstream rpmvercmp.

http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=ee64849e
2013-05-17 05:36:12 -07:00
Dan Nicholson
f50ba60ceb rpmvercmp: Formatting & comment updates to reduce upstream diff
No changes to code, only to comments and formatting so that diff with
upstream rpmvercmp is reduced.
2013-05-17 05:36:12 -07:00
Dan Nicholson
4623b5e85a Split rpmvercmp code into separate file
The rpmvercmp code is taken directly from upstream. Moving it to a
separate file allows it to be diffed and synced easily with the upstream
version. It also becomes really easy to switch to the actual rpmlib
version if that's ever desired.
2013-05-17 05:36:12 -07:00
Dan Nicholson
32427bf2c6 check: Test relocatable features
Exercise the ${pcfiledir} and --define-prefix features for allowing
relocation of packages. The --define-prefix test .pc files are put in a
pkgconfig subdirectory since the feature will only be enabled in that
situation.
2013-05-17 05:13:15 -07:00
Dan Nicholson
e7238e823f check: Define all useful build directories in config.sh
Define all the autoconf build directories besides srcdir, which is
required to run the test scripts and set by "make check", and builddir,
which is always assumed to be ".".
2013-05-17 05:13:15 -07:00
Dan Nicholson
925119ce51 Document all pkg-config derived metadata variables
The derived variables pcfiledir, pc_top_builddir and pc_sysrootdir were
lacking in documentation. Rework the "QUERYING PKG-CONFIG'S DEFAULTS"
section to describe these and pc_path.

The example of using "pkg-config --modversion pkg-config" was removed
since it's superfluous to "pkg-config --version".

Freedesktop #62018 (https://bugs.freedesktop.org/show_bug.cgi?id=62018)
2013-05-17 05:13:15 -07:00
Dan Nicholson
43c1e0e4af Make the --define-prefix feature available on all platforms
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)
2013-05-17 05:13:15 -07:00
Dan Nicholson
755639aac0 Remove compat definition of G_IS_DIR_SEPARATOR
This has been available on glib since 2.5.4, and pkg-config requires at
least 2.16.
2013-05-17 05:13:15 -07:00