Commit graph

67 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
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
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
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
02d99c6ab1 Use glib to parse argv strings instead of popt
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.
2012-05-14 14:19:10 -07:00
Tollef Fog Heen
b02c40bca4 Only treat real files (or symlinks to real files) as .pc files
Ignore any dangling symlinks.  Thanks to Ciaran Anscomb for patch
inspiration.

Fixes Freedesktop #23922
2011-05-15 14:08:21 +02:00
Tollef Fog Heen
7c45ef3c84 Drop dead code 2011-05-15 11:05:42 +02:00
Simon McVittie
01005bbbd0 Add --with-system-include-path etc.
Instead of hard-coding /usr/include, we now use the environment variable
PKG_CONFIG_SYSTEM_INCLUDE_PATH, defaulting to the argument of
./configure --with-system-include-path, which in turn defaults to
/usr/include.

Similarly, PKG_CONFIG_SYSTEM_LIBRARY_PATH defaults to /usr/lib or
/usr/lib:/usr/lib64 as appropriate.

(As currently implemented, this causes a behaviour change on Win32 -
the option -I/usr/include will now be filtered out.)

The intended usage is for Debian to configure pkg-config with
--with-system-include-path=/usr/include/$(DEB_HOST_GNU_TYPE):/usr/include
and the corresponding library path, for multiarch support
(<http://bugs.debian.org/482884>).

Based on work by Colin Walters <walters@verbum.org>
2011-04-13 22:56:53 +02:00
Tollef Fog Heen
03bd4a5528 Drop support for legacy -config scripts
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.
2010-09-01 20:48:57 +02:00
Tollef Fog Heen
726f8e4c13 Update rpmvercmp with bugfixes from RPM
Grab two minor bugfixes from RPM's rpmvercmp.
2010-05-08 22:15:36 +02:00
Tollef Fog Heen
66d49f1375 Clean up sysroot support a little bit
This should fix bug #16905 properly.
2009-12-06 22:40:13 +01:00
Tollef Fog Heen
2896188180 Constify a variable
Thanks to J.H.M. Dassen (Ray)
Bug #190
2009-12-06 22:08:21 +01:00
Tollef Fog Heen
e170895bc6 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* pkg.c (add_virtual_pkgconfig_package): Add pc_path as a variable
	which you can use to get at the compiled-in PKG_CONFIG_PC_PATH.
2009-03-30 21:17:43 +02:00
Tollef Fog Heen
c5b07b4720 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* pkg.c (add_virtual_pkgconfig_package): Fix URL to pkg-config.
2009-03-30 21:04:42 +02:00
Tollef Fog Heen
2e0493a343 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* poptparse.c, popthelp.c, poptconfig.c, popt.c, pkg.c, findme.c,
	configure.in: Check for malloc.h and use that if it exists.
	Apparently this makes Win32 happier.  Thanks to Carlo Bramini for
	the patch.
2009-03-30 21:00:14 +02:00
Tollef Fog Heen
669bfe2e0d 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* pkg.[ch], main.c, check/check-missing: Don't recurse Requires at
	all unless we need to.  Add check.  Again, thanks to Loïc Minier
	for most of the idea and the implementation.
2009-03-30 20:49:17 +02:00
Tollef Fog Heen
02d5ae3fb6 2009-03-30 Tollef Fog Heen <tfheen@err.no>
* 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
2009-03-30 20:40:53 +02:00
Tollef Fog Heen
69dafea1c8 2008-03-23 Tollef Fog Heen <tfheen@err.no>
* check/check-conflicts, check/conflicts-test.pc: New test,
       testing that conflicts work as they should.

       * pkg.c (verify_package): Make the conflicts check not only check
       package versions, but also package names.  This makes conflicts
       functional, something they were not before.
2008-03-23 21:39:07 +01:00
Tollef Fog Heen
3e6c5da35a pkg.c (string_list_to_string): Patch from Paul Bender so flags other
than -I and -L are passed through (with mangling) when
PKG_CONFIG_SYSROOT_DIR is set.
2008-01-31 02:27:33 +01:00
Tollef Fog Heen
ed75a7dd4b 2008-01-16 Tollef Fog Heen <tfheen@err.no>
* pkg.h, pkg.c (string_list_to_string), pkg-config.1, main.c
             (main): Add sysroot support and document same.  Triggered by
             setting PKG_CONFIG_SYSROOT_DIR in the environment.
2008-01-16 23:10:25 +01:00
Tollef Fog Heen
138f9219b4 * pkg.c (internal_get_package): Don't add the internal-only
pkg-config package twice.
2007-12-29 17:49:50 +01:00
Tollef Fog Heen
a376c715ea * pkg.c (verify_package): Apply patch from Matthias Clasen of
RedHat to prevent segfaults if a Conflicts line is encountered.
2007-12-29 16:46:25 +01:00
Tollef Fog Heen
8ac159cd5e * pkg.c (recursive_fill_list): Make sure to act recursively with
Requires.private, making them much more useful.  Special thanks to
Matthias Clasen for lots and lots of nagging.  Freedesktop #8788
2007-06-18 23:19:27 +02:00
Tollef Fog Heen
92d4e25061 2007-02-25 Tollef Fog Heen <tfheen@err.no>
* pkg.c (scan_dir): Use g_malloc, not malloc for pkgname.
2007-02-25 15:12:40 +01:00
Tollef Fog Heen
eae3abf93e 2006-08-16 Tollef Fog Heen <tfheen@err.no>
* pkg.c: Add internal pkg-config package which can be queried for
	version number, name and URL for now.  More information will be
	added later.
2006-08-16 21:04:56 +02:00
Tollef Fog Heen
0936824bf0 2006-08-16 Tollef Fog Heen <tfheen@err.no>
* pkg.c (packages_get_other_cflags, package_get_other_cflags)
	(packages_get_I_cflags): Always add all cflags.  Debian #340904
2006-08-16 20:42:38 +02:00
Tollef Fog Heen
ec5f06d60f Add --short-errors
2005-10-16  Tollef Fog Heen  <tfheen@err.no>

	* pkg.c (get_package_quiet): Add get_package_quiet which is just
	the same as get_package except it sets warn to false.

	* pkg.h: Add prototype for get_package_quiet.

	* main.c (main): Add --short-errors flag to suppress most of the
	output when a module is not found.
2005-10-16 17:31:41 +00:00
Tollef Fog Heen
6b35e49c2d Handle \ correctly on win32
2005-10-01  Tollef Fog Heen  <tfheen@err.no>

        * pkg.c(scan_dir): Turn backslashes into slashes or
        poptParseArgvString() will eat them when ${prefix} has been
        expanded in parse_libs().  Thanks to j^ for the patch.
2005-10-01 10:24:02 +00:00
Tollef Fog Heen
6d840e7046 Fix possible off-by-one
Apply last part of patch from freedesktop #4034 so we don't do silly
things if len is zero.
2005-10-01 10:13:57 +00:00
Arch Librarian
f4ef194406 2005-07-15 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-07-15 08:22:55 GMT
2005-07-15  Tollef Fog Heen  <tfheen@err.no>

        * pkg.c (package_get_var): Make sure to g_strdup all the return
        values and not return some values which should not be freed and
        some which should.  Yay valgrind.  Freedesktop #3682
2005-07-15 13:08:02 +00:00
Arch Librarian
29afc67918 2005-06-27 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-06-27 19:53:05 GMT
2005-06-27  Tollef Fog Heen  <tfheen@err.no>

    All those Requires.private changes are thanks to James
    Henstridge.  Thanks!

    * check/private-dep.pc, check/public-dep.pc,
      check/requires-test.pc: New files, data for the
    check-requires-private test.

    * check/check-requires-private: New test to check for
    Requires.private support.

    * check/Makefile.am (EXTRA_DIST, TESTS): Add Requires.private
    test.

    * pkg.h (struct _Package): Add requires_private

    * pkg.c (get_requires_private, fill_list_single_package)
    (fill_list, verify_package, verify_package, get_merged)
    (get_merged_from_back, get_multi_merged)
    (get_multi_merged_from_back, package_get_l_libs)
    (packages_get_l_libs, package_get_L_libs, packages_get_L_libs)
    (package_get_other_libs, packages_get_other_libs)
    (package_get_I_cflags, packages_get_I_cflags)
    (package_get_other_cflags, packages_get_other_cflags): Handle
    private requires and cascading changes.

    * parse.c (parse_requires_private, parse_conflicts)
    (parse_package_file): Handle Requires.private
2005-07-14 13:07:31 +00:00
Arch Librarian
20d118d57a 2005-05-21 Tollef Fog Heen <tfheen@err.no>
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.
2005-07-14 13:07:18 +00:00
Arch Librarian
6c3ec8f447 2005-04-13 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-04-13 15:47:18 GMT
2005-04-13  Tollef Fog Heen  <tfheen@err.no>

    * pkg.c (packages_get_l_libs, packages_get_L_libs): Duplicate
    singly linked list before putting it on list passed to
    string_list_strip_duplicates_from_back to avoid infinite loop when
    g_slist_copy tries to copy self-linked list.  This happens if the
    user specifies the same name on the command line twice.
2005-07-14 13:07:07 +00:00
Arch Librarian
986e4ebb03 2005-04-01 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-04-01 21:46:07 GMT
2005-04-01  Tollef Fog Heen  <tfheen@err.no>

    * configure.in: Try to detect whether this architecture supports
    inter-library dependencies.  If so, we default to assuming that
    this support is used and link to the minimal set of libraries
    rather than traversing the full depends set.

    * main.c (main): Only recurse if we want a static library list or
    if this architecture doesn't support inter-library dependencies.
    This will probably expose bugs for libraries which declare
    dependencies in their .pc files but don't actually link against
    each other.

    * pkg.c (packages_get_all_libs): Add recurse option
    (packages_get_L_libs): Add recurse option
    (package_get_L_libs): Add recurse option
    (packages_get_l_libs): Add recurse option
    (package_get_l_libs): Add recurse option

    * pkg.h: Update prototypes to handle the recurse option.
2005-07-14 13:06:42 +00:00
Arch Librarian
d2080ec6d8 2005-03-18 Tollef Fog Heen <tfheen@err.no>
Author: tfheen
Date: 2005-03-26 14:59:26 GMT
 2005-03-18  Tollef Fog Heen  <tfheen@err.no>

       * main.c (main): Use add_search_dirs for both the compile-time
       defined pc_path and the run-time defined PKG_CONFIG_PATH.

       * pkg.h: Add prototype for add_search_dirs.

       * pkg.c (add_search_dirs): Add new function which takes a
       delimiter-separated list as input and add_search_dir's it.
       (package_init): Remove knowledge about which dirs should be
       initially added.  Moved this to main.c(main)

       * ChangeLog: Add emacs variables to set the date to this
       ChangeLog's standard format

       * Makefile.am (INCLUDES): Pass PKG_CONFIG_PCPATH on to main.c

       * configure.in: Add --with-pc-path to define the default search
       path for .pc files.  (Freedesktop #119, #648)
2005-07-14 13:06:23 +00:00
Arch Librarian
03723d4caa 2005-03-18 Tollef Fog Heen <tfheen@debian.org>
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)
2005-07-14 13:06:19 +00:00
Arch Librarian
7d74866d21 2003-04-30 James Henstridge <james@daa.com.au>
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.
2005-07-14 13:05:55 +00:00
Arch Librarian
3fe3dde617 2003-02-22 James Henstridge <james@daa.com.au>
Author: jamesh
Date: 2003-02-22 14:04:21 GMT
2003-02-22  James Henstridge  <james@daa.com.au>

    * pkg.c (add_virtual_pkgconfig_package): function to add a virtual
    "pkg-config" package to the packages hash table.
    (package_init): add the "pkg-config" package while initing the
    hash table.
2005-07-14 13:05:53 +00:00
Arch Librarian
7fcc493228 2003-02-19 Tor Lillqvist <tml@iki.fi>
Author: tml
Date: 2003-02-19 19:24:14 GMT
2003-02-19  Tor Lillqvist  <tml@iki.fi>

	* pkg.c (add_env_variable_to_list): Use G_SEARCHPATH_SEPARATOR_S
	instead of hardcoded ":".
	(verify_package): Don't use /usr/include on Win32.
2005-07-14 13:05:44 +00:00
Arch Librarian
0e1fdf32ac 2003-02-15 Havoc Pennington <hp@pobox.com>
Author: hp
Date: 2003-02-15 15:37:04 GMT
2003-02-15  Havoc Pennington  <hp@pobox.com>

	* pkg.c (verify_package): patch from Nalin to use /usr/lib64 as
	the system libdir on systems where that's appropriate
2005-07-14 13:05:43 +00:00
Arch Librarian
7207c289d8 2003-02-15 Havoc Pennington <hp@pobox.com>
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
2005-07-14 13:05:41 +00:00
Arch Librarian
bc990e9be1 2003-01-15 Havoc Pennington <hp@pobox.com>
Author: hp
Date: 2003-01-15 04:02:47 GMT
2003-01-15  Havoc Pennington  <hp@pobox.com>

	* pkg.c (package_init): honor a PKG_CONFIG_LIBDIR to move default
	search dir, useful in cross-compilation for example, bug
	#103545 fix from David Schleef
2005-07-14 13:05:36 +00:00
Arch Librarian
759b7dcd40 2002-10-11 Havoc Pennington <hp@redhat.com>
Author: hp
Date: 2002-10-11 20:40:38 GMT
2002-10-11  Havoc Pennington  <hp@redhat.com>

	* pkg.c (verify_package): fix to properly cast iter->data to char*
	before doing pointer arithmetic, from David Robins
2005-07-14 13:05:30 +00:00
Arch Librarian
5568e32942 2002-10-02 Anders Carlsson <andersca@gnu.org>
Author: andersca
Date: 2002-10-02 09:10:10 GMT
2002-10-02  Anders Carlsson  <andersca@gnu.org>

	* pkg.c (add_env_variable_to_list): Don't return NULL, return
	the new list.
	(verify_package): break if we've removed the variable.
2005-07-14 13:05:28 +00:00
Arch Librarian
5c5ede8ed4 2002-09-26 Anders Carlsson <andersca@gnu.org>
Author: andersca
Date: 2002-09-26 07:09:38 GMT
2002-09-26  Anders Carlsson  <andersca@gnu.org>

	* pkg.c (verify_package): Use strncmp when checking for
	the -I prefix.
2005-07-14 13:05:25 +00:00
Arch Librarian
e913db3d5b 2002-09-19 Anders Carlsson <andersca@gnu.org>
Author: andersca
Date: 2002-09-19 14:23:55 GMT
2002-09-19  Anders Carlsson  <andersca@gnu.org>

	* pkg.c: (verify_package):
	Don't call g_free on strings returned from g_getenv.
2005-07-14 13:05:23 +00:00
Arch Librarian
56221beea3 Tue Sep 17 14:11:51 2002 Jonathan Blandford <jrb@redh...
Author: jrb
Date: 2002-09-17 17:40:19 GMT
Tue Sep 17 14:11:51 2002  Jonathan Blandford  <jrb@redhat.com>

        * pkg.c: strip out C_INCLUDE_PATH and CPLUS_INCLUDE_PATH if they
        exist, as this can break -Werror on some newer gcc versions.
2005-07-14 13:05:22 +00:00
Arch Librarian
d2c6c3cccb 2002-09-09 Havoc Pennington <hp@pobox.com>
Author: hp
Date: 2002-09-10 02:59:21 GMT
2002-09-09  Havoc Pennington  <hp@pobox.com>

	* pkg.c (fill_list_single_package): fix uninitialized variable,
	patch from Andrea Suatoni
2005-07-14 13:05:18 +00:00
Arch Librarian
fcb804effe 2002-09-06 Havoc Pennington <hp@redhat.com>
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
2005-07-14 13:05:17 +00:00
Arch Librarian
e3b14fd5e8 add copyright notices to files
Author: hp
Date: 2002-09-06 19:32:18 GMT
add copyright notices to files
2005-07-14 13:05:14 +00:00