1
0
Fork 0
mirror of https://github.com/pkgconf/pkgconf.git synced 2025-12-05 20:45:39 +00:00
package compiler and linker metadata toolkit
Find a file
Ariadne Conill 90f9186e10 cli: use a single fragment list for all collected CFLAGS and linker flags
This cleans up --cflags and --libs handling a bit, making the code less
repetitive.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
2025-12-02 14:01:55 -08:00
.github github: add some extra jobs to publish tarball/msi on github 2025-08-18 10:22:05 -07:00
cli cli: use a single fragment list for all collected CFLAGS and linker flags 2025-12-02 14:01:55 -08:00
doc Fix it's -> its 2023-11-29 12:02:44 -08:00
libpkgconf libpkgconf: fragment: allow user to specify inter-fragment delimiter 2025-12-02 13:27:51 -08:00
m4 Update AX_CHECK_COMPILE_FLAG to serial 6 2023-10-08 22:50:31 +00:00
man man/pkgconf.1: document --newlines option 2025-12-02 13:39:52 -08:00
tests tests: add personality handling tests 2025-12-02 13:09:50 -08:00
.gitattributes Add .gitattributes file to force dos-lineendings.pc to match CRLF style always 2012-05-04 03:15:07 +00:00
.gitignore add test for symlinked ${pcfiledir} 2024-10-09 19:06:06 +02:00
.mailmap add mailmap 2019-07-11 03:27:15 -05:00
AUTHORS update AUTHORS using git shortlog -e 2019-07-11 03:30:56 -05:00
autogen.sh autogen: run libtoolize first 2025-10-22 13:41:19 -07:00
CODE_OF_CONDUCT.md add mailmap 2019-07-11 03:27:15 -05:00
configure.ac build: check for readlinkat presence 2025-07-30 11:59:38 -07:00
COPYING bump copyrights to 2018 2017-12-31 10:41:32 -06:00
Kyuafile.in Add Kyua tests 2016-09-18 23:29:30 +02:00
libpkgconf.pc.in libpkgconf.pc.in: Add License.file-tag 2025-11-01 15:21:32 -07:00
Makefile.am tests: add fixture for i386-linux-gnu personality 2025-12-02 12:58:33 -08:00
Makefile.lite build: add buffer.c to SRCS in Makefile.lite 2025-09-03 09:59:16 -07:00
meson.build Add SPDX Lite profile 3.0 generator 2025-11-01 15:31:55 -07:00
meson_options.txt meson: Add with-system options 2023-10-08 22:49:22 +00:00
NEWS pkgconf 2.5.1. 2025-06-24 15:49:00 -07:00
pkg.m4 pkg.m4: bump serial 2025-12-02 10:59:54 -08:00
pkgconf.wxs.in meson: add MSI build target 2025-05-29 15:50:14 -07:00
README.md README: simplify, improve tone to be less grumpy 2025-05-29 10:47:47 -07:00
txt2rtf.py meson: add MSI build target 2025-05-29 15:50:14 -07:00

pkgconf test

pkgconf is a program which helps to configure compiler and linker flags for development libraries. It is a superset of the functionality provided by pkg-config from freedesktop.org, but does not provide bug-compatibility with the original pkg-config.

libpkgconf is a library which provides access to most of pkgconf's functionality, to allow other tooling such as compilers and IDEs to discover and use libraries configured by pkgconf.

release tarballs

Release tarballs are available on distfiles.ariadne.space.

build system setup

If you would like to use the git sources directly, or a snapshot of the sources from GitHub, you will need to regenerate the autotools build system artifacts yourself, or use Meson instead. For example, on Alpine:

$ apk add autoconf automake libtool build-base
$ sh ./autogen.sh

pkgconf-lite

If you only need the original pkg-config functionality, there is also pkgconf-lite, which builds the pkgconf frontend and relevant portions of libpkgconf functionality into a single binary:

$ make -f Makefile.lite

why pkgconf over original pkg-config?

pkgconf builds a flattened directed dependency graph, which allows for more insight into relationships between dependencies, allowing for some link-time dependency optimization, which allows for the user to more conservatively link their binaries, which may be helpful in some environments, such as when prelink(1) is being used.

The solver is also optimized to handle large dependency graphs with hundreds of thousands of edges, which can be seen in any project using the Abseil frameworks for example.

In addition, pkgconf has full support for virtual packages, while the original pkg-config does not, as well as fully supporting Conflicts at dependency resolution time, which is more efficient than checking for Conflicts while walking the dependency graph.

linker flags optimization

pkgconf, when used effectively, can make optimizations to avoid overlinking binaries.

This functionality depends on the pkg-config module properly declaring its dependency tree instead of using Libs and Cflags fields to directly link against other modules which have pkg-config metadata files installed.

The practice of using Libs and Cflags to describe unrelated dependencies is not recommended in Dan Nicholson's pkg-config tutorial for this reason.

bug compatibility with original pkg-config

In general, we do not provide bug-level compatibility with pkg-config.

What that means is, if you feel that there is a legitimate regression versus pkg-config, do let us know, but also make sure that the .pc files are valid and follow the rules of the pkg-config tutorial, as most likely fixing them to follow the specified rules will solve the problem.

debug output

Please use only the stable interfaces to query pkg-config. Do not screen-scrape the output from --debug: this is sent to stderr for a reason, it is not intended to be scraped. The --debug output is not a stable interface, and should never be depended on as a source of information. If you need a stable interface to query pkg-config which is not covered, please get in touch.

compiling pkgconf and libpkgconf on UNIX

pkgconf is basically compiled the same way any other autotools-based project is compiled:

$ ./configure
$ make
$ sudo make install

If you are installing pkgconf into a custom prefix, such as /opt/pkgconf, you will likely want to define the default system includedir and libdir for your toolchain. To do this, use the --with-system-includedir and --with-system-libdir configure flags like so:

$ ./configure \
     --prefix=/opt/pkgconf \
     --with-system-libdir=/lib:/usr/lib \
     --with-system-includedir=/usr/include
$ make
$ sudo make install

compiling pkgconf and libpkgconf with Meson (usually for Windows)

pkgconf is compiled using Meson on Windows. In theory, you could also use Meson to build on UNIX, but this is not recommended at this time as pkgconf is typically built much earlier than Meson.

$ meson setup build -Dtests=disabled
$ meson compile -C build
$ meson install -C build

There are a few defines such as SYSTEM_LIBDIR, PKGCONFIGDIR and SYSTEM_INCLUDEDIR. However, on Windows, the default PKGCONFIGDIR value is usually overridden at runtime based on path relocation.

If you want pkgconf to be used when you invoke pkg-config, you should install a symlink for this. We do not do this for you, as we believe it is better for vendors to make this determination themselves.

$ ln -sf pkgconf /usr/bin/pkg-config

contacts

You can report bugs at https://github.com/pkgconf/pkgconf/issues.

There is a mailing list at https://lists.sr.ht/~kaniini/pkgconf.

You can contact us via IRC at #pkgconf at irc.oftc.net.