Commit graph

355 commits

Author SHA1 Message Date
Dan Nicholson
02ca585fa6 Make sure recursion only happens with requires
The function recursive_fill_list() is designed to descend lists of
packages, so it only makes sense to use with Requires and
Requires.private. Ensure it to make later code additions simpler.
2012-10-13 08:14:35 -07:00
Dan Nicholson
6b07296902 Install pkg-config link with $host- prefix
If pkg-config is used in a multiarch or cross-compiling scenario it's
likely pkg-config needs to behave differently for each of them. It's
possible to handle this through environment variables with one
pkg-config, but another option is to have one pkg-config per platform,
each with the host alias prefixed to the program.

PKG_PROG_PKG_CONFIG supports this type of installation, and this is also
how autoconf/libtool handle other build tools like compilers and
linkers.

The host-prefixed tool is installed as a hardlink where supported and a
copy otherwise. This is how gcc handles it's host-prefixed versions.
This feature can be turned off by passing --disable-host-tool to
configure.

Freedesktop #130
2012-10-13 08:08:42 -07:00
Dan Nicholson
65e37fe303 check: Test version comparisons within Requires fields
Verification of versions in Requires and friends happens differently
than the version comparison for command-line packages.
2012-10-03 05:33:32 -07:00
Dan Nicholson
e12f8f17a2 Kill a bunch of unused code
From what I can tell, these single package variants have never been used
going back to pkg-config-0.4.0. pkg-config always uses the multipackage
versions that loop over the list of supplied packages.
2012-10-03 05:33:32 -07:00
Dan Nicholson
9a54c588a5 check: Test all variants of --cflags and --libs
Make sure that the --*-only-* variants of --cflags and --libs do the
right thing. This should probably be extended to cover a chain of
packages to get the ordering right, but this is good for now.
2012-10-03 05:33:31 -07:00
Dan Nicholson
0a5d54d091 check: Ensure unknown options fail 2012-10-03 05:33:31 -07:00
Dan Nicholson
d4c0c14ba8 check: Ensure debugging output works correctly
This might be a little fragile, but it makes sure to exercise the
debug_spew function.
2012-10-03 05:33:31 -07:00
Dan Nicholson
4f7d2a1b28 check: Test -uninstalled functionality
Test the usage of -uninstalled packages with two .pc files: inst.pc and
inst-uninstalled.pc. pkg-config should prefer the -uninstalled version
unless PKG_CONFIG_DISABLE_UNINSTALLED is set. It should also use the
default value of pc_top_builddir unless PKG_CONFIG_TOP_BUILD_DIR is set.
2012-10-03 05:33:31 -07:00
Dan Nicholson
83aef0efd9 Fix formatting for --print-provides in man page 2012-10-03 05:33:31 -07:00
Dan Nicholson
4426d487eb check: Test sysroot support
Checks that pkg-config prepends PKG_CONFIG_SYSROOT_DIR to -I and -L when
they don't point to system directories.
2012-10-03 05:33:31 -07:00
Dan Nicholson
42f30aee2e check: Test pkg-config version
Test that --version prints the current version and
--atleast-pkgconfig-version validates it.
2012-10-02 05:51:22 -07:00
Dan Nicholson
aba2c047cf check: Enhance --print-requires tests
Make the --print-requires and --print-requires-private tests actually
resolve Requires and output a specific version test.
2012-10-02 05:51:22 -07:00
Dan Nicholson
0e6ea44d68 check: Check path handling
Add a test for pkg-config's path handling. The first test covers
PKG_CONFIG_PATH, and the second covers the built-in path. For this one
we need to unset the PKG_CONFIG_LIBDIR that normally is set during the
tests. Since we can't rely on the contents of the default path, we just
check to see that the built-in path matches what was specified in
configure. To do this, we need to add a bunch of variables to config.sh
so the variable resolves. These variables don't need to be exported,
though.
2012-10-02 05:51:22 -07:00
Dan Nicholson
c7e12356bc check: Exercise all printing options
Add tests for checking the output of various options that print
information. For --list-all, a subdirectory with only two packages has
been added so that its output doesn't change when more test packages are
added to the check directory.
2012-09-29 09:57:46 -07:00
Dan Nicholson
31a9f900e1 check: Test --define-variable corner cases 2012-09-29 09:09:30 -07:00
Dan Nicholson
397d414a6a check: Pass args to test function instead of setting in variable
The run_test shell function was running pkg-config with arguments stored
in an environment variable. This has problems when trying to pass shell
special characters with the proper escaping. Instead, pass the arguments
to the test where they can maintain correct formatting through use of
the special variable "$@".
2012-09-29 08:50:57 -07:00
Dan Nicholson
e68baa7463 Add optional usage of gcov for test coverage
Use gcov to find how much code coverage our current testing gets. This
can be enabled by passing --with-gcov to configure and running "make
gcov". This is limited to gcc. Here's a run from the current code (for
some reason, gcov insists on profiling gstring.h).

/usr/bin/gcov pkg.h pkg.c parse.h parse.c main.c
File 'pkg.c'
Lines executed:73.16% of 611
pkg.c:creating 'pkg.c.gcov'

File '/usr/include/glib-2.0/glib/gstring.h'
Lines executed:100.00% of 6
/usr/include/glib-2.0/glib/gstring.h:creating 'gstring.h.gcov'

File 'parse.c'
Lines executed:79.67% of 492
parse.c:creating 'parse.c.gcov'

File 'main.c'
Lines executed:57.34% of 293
main.c:creating 'main.c.gcov'
2012-09-28 05:45:37 -07:00
Dan Nicholson
a35c3fc95e Update news and bump version for release 2012-08-24 06:03:54 -07:00
Dan Nicholson
1baefdf7d6 Discourage repeated usage of VARIABLE-PREFIX in PKG_CHECK_MODULES
When the VARIABLE-PREFIX tag is used more than once in PKG_CHECK_MODULES
it can result in later runs reporting success without actually running
pkg-config. This is because PKG_CHECK_MODULES looks for FOO_CFLAGS and
FOO_LIBS from the environment as a way to allow users to override the
test. PKG_CHECK_MODULES also sets these variables, though, and
subsequent calls will simply use these values.

Although there are legitimate ways to use the same VARIABLE-PREFIX
(e.g., they're all under conditionals meaning only one will be used),
document that repeated usage is not recommended.

Freedesktop #3550
2012-08-22 11:35:13 -07:00
Dan Nicholson
617963c55e glib: Update snapshot to 2.32.4
This gets us to the latest stable release for glib and probably a good
stopping point for a while since the 2.32 series seems to be slowing
down.
2012-08-22 05:53:32 -07:00
Dan Nicholson
f8978af7bf glib: Really force static only building
Making --enable-static --disable-shared the default fixes most cases,
but build environments often pass --enable-shared --disable-static for
all autotooled projects. Force static building by setting the
appropriate variables as if they've come from the command line
parameters.
2012-08-21 06:32:16 -07:00
John Stumpo
f57fafe1d1 Escape spaces in autodetected ${prefix} values on Windows
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.
2012-08-21 05:49:07 -07:00
Dan Nicholson
78b419a3df Specify pkg-config to test with from make
By specifying the pkg-config to use for testing from make, we can easily
control its path and add the .exe extension for Windows. It also allows
easy testing of another pkg-config from make:

  make check TESTS_PKG_CONFIG=/usr/bin/pkg-config
2012-08-19 08:49:58 -07:00
Dan Nicholson
305913a6b1 Handle POSIX shell for tests in configure and Makefile
Although the trick of finding a POSIX shell in the system PATH works
fine most of the time, it has some drawbacks.

* The commands must be copied into every test script.
* The scripts are always forced to re-execute themselves.
* There's no guarantee the sh found in `getconf PATH` is a POSIX shell
  and there's no way to override it.

Move the handling of this shell to configure where we can detect it
once. This gives preference to bash and ksh since they're typically
POSIX compatible. It also uses the current PATH with the getconf PATH at
the end which should allow things to work on platforms where getconf
might not be available like mingw/msys.

By specifying the shell in TESTS_ENVIRONMENT, automake will run each
script with this shell and we can drop the re-exec dance.
2012-08-19 08:03:00 -07:00
Dan Nicholson
4bce8b46b2 Exit on errors for check-missing like others
This ensures that the make shows FAIL in case one test fails and a
subsequent one succeeds.
2012-08-19 07:34:35 -07:00
Dan Nicholson
cf9089f5ec glib: Fix static usage of glib on win32
When glib is built static, the threads and clock code are not
initialized since DllMain is never run. Instead, initialize them from
the glib constructor.

https://bugzilla.gnome.org/show_bug.cgi?id=678387
2012-08-17 11:37:04 -07:00
Dan Nicholson
f0e821fed2 glib: Remove usage of gettext/libintl/iconv
pkg-config doesn't use message translation, so there's no need to build
it into the bundled glib. Furthermore, when not using glibc, this drags
in extra dependencies on gettext, libintl and iconv. Remove their usage
in two steps:

1. Don't include libintl.h directly from code. glibintl.h
conditionalizes the include of libintl.h based on the ENABLE_NLS define
and creates fallback macros when it's unwanted.

2. Remove the usage of the gettext macros in glib's configure.ac. This
ensures that the unwanted dependencies aren't searched for. Two defines
are kept around to keep the code happy.
2012-08-17 09:03:55 -07:00
Dan Nicholson
51468f2a9b Ignore patch backup files
When reapplying the glib patches we often end up with .orig files when
the hunks have moved. Any backup suffix is possible, but this is the
default from patch(1).
2012-08-17 08:18:40 -07:00
Dan Nicholson
b168e4f843 Ignore generated config.cache files 2012-08-17 08:16:16 -07:00
Dan Nicholson
f95579d268 glib: Ensure only static build is performed
Since we're going to use glib as a convenience library, we need to make
sure it builds as if --enable-static was passed. This only matters on
Windows where a couple extra macros are defined and the DLL machinery is
disabled.
2012-08-17 08:12:49 -07:00
Dan Nicholson
58b6b2d995 glib: Don't install charset.alias file
On non-glibc systems a charset.alias file is installed, but we don't
need this for our purposes.
2012-08-16 09:36:16 -07:00
Dan Nicholson
8bdf2df690 Ignore Windows executables 2012-08-16 09:30:03 -07:00
Dan Nicholson
a870b63b31 Document failure to build internal glib as OS X universal binary
GLib out of the box does not support being built for multiple arches.
This means pkg-config using the internal glib can't be built as a
universal binary on OS X. Document this and available workarounds.

Freedesktop #52032
2012-08-14 16:39:47 -07:00
Dan Nicholson
7178b2e041 glib: Remove check for tracing support
If dtrace or systemtap is installed glib will enable tracing
automatically. Remove the check to always disable tracing.

Freedesktop #53493
2012-08-14 15:16:35 -07:00
Dan Nicholson
40dc57fb41 glib: Don't install m4 macros
Freedesktop #52031
2012-08-13 20:40:27 -07:00
Dan Nicholson
234da3983b Update NEWS and bump version for 0.27 2012-07-11 05:28:10 -07:00
Dan Nicholson
3ead3dfb78 Enable Requires and Requires.private for --exists
Prior to pkg-config 0.24, --exists honored Requires and
Requires.private. This was regressed in commits 02d5ae3f and 669bfe2e,
which split the handling of Requires and Requires.private out more
correctly for other options. This adds exists to the group of options
that enable the Requires functionality.

Freedesktop #43149
2012-07-11 05:24:23 -07:00
Dan Nicholson
a077e02430 Make check-missing test more explicit with --exists
Currently the check-missing passes the packages on the command line with
no options prior to running through --cflags/--libs, etc. Make this more
explicitly pass --exists since this is a much more common operation
performed from PKG_CHECK_MODULES.

The expected result of 0 when Requires or Requires.private is missing is
a regression from pre-0.24 pkg-config.
2012-07-11 05:24:23 -07:00
Dan Nicholson
6c27d5051b glib: Restore gettext with libintl support
Until the needed surgery is done to remove gettext support from the
internal glib (since pkg-config doesn't need it), make sure that libintl
is linked in when necessary.
2012-06-04 15:21:25 -07:00
Dan Nicholson
533de22bae Add a configure message about internal glib to tip people off 2012-06-04 11:01:03 -07:00
Dan Nicholson
c47c09177f glib: Update snapshot to 2.32.3
There doesn't appear to be any changes in the code pkg-config uses. Just
keeping in sync.
2012-06-04 09:08:33 -07:00
Dan Nicholson
d11df7ffe0 Ensure test search path is confined to check directory
If only PKG_CONFIG_PATH is set when running the tests, we'll still pick
up packages from the system default path. By overriding that with
PKG_CONFIG_LIBDIR and unsetting PKG_CONFIG_PATH, the path is forced to
the check directory.
2012-05-30 05:49:14 -07:00
Dan Nicholson
5345892b8e Always use g_free when allocating memory from glib 2012-05-29 17:17:55 -07:00
Dan Nicholson
fd77d7690b Remove unneeded checks for setresuid & setreuid
These were used in the popt code a long time ago. pkg-config has no need
to be checking your uid.
2012-05-29 17:17:16 -07:00
Dan Nicholson
dfd03ae23e Use g_alloca instead of fooling around with platforms ourselves
Glib has been providing a g_alloca wrapper that handles all the platform
specifics since at least glib-1.3. Use it.
2012-05-29 16:41:17 -07:00
Dan Nicholson
5c219ca67d Makefile cleanup
No functional change, but makes things a little cleaner.
2012-05-23 05:47:26 -07:00
Javier Jardón
7a8cc77163 Update autotools configuration
Replace deprecated macros and use the new libtool syntax. The required
versions of the tools have been bumped up to match the versions of the
bundled glib. This was effectively the requirement, anyway. The new
required autotools versions are:

autoconf-2.62 (released 2008-04-08)
automake-1.11 (released 2009-05-17)
libtool-2.2 (released 2008-03-01)

Also use silent rules to quiet the build a bit.

Freedesktop #34382
2012-05-23 05:45:20 -07:00
Dan Nicholson
d575f1e5ea Remove unneeded acconfig.h, suppressing warnings from autoheader
acconfig.h was being used to undefine some macros, but these aren't
actually used anywhere in the pkg-config code. I suspect this was a
holdover from when glib-1 was used internally. glib does define some
similar macros, but that code is all self-contained there and not
anything we need to worry about in pkg-config.
2012-05-22 05:46:16 -07:00
LRN
7ac6f32625 Don't use deprecated glib function to construct path on win32
g_win32_get_package_installation_subdirectory() has been deprecated
since GLib 2.18 and in recent (2.31) GLib versions disabled entirely by
default. This patch replaces usage of that function by
g_win32_get_package_installation_directory_of_module() and
g_build_filename(). Use the new functions and rework the code a bit so
it leaks less memory.

g_win32_get_package_installation_directory_of_module() is supported
since GLib 2.16. The minimal GLib version is bumped accordingly.

Freedesktop #45742
2012-05-21 21:08:49 -07:00
Dan Nicholson
b87359cc9b Kill unused result variable
Gets rid of a compiler warning.
2012-05-18 09:44:49 -07:00