1# pkgconf [](https://github.com/pkgconf/pkgconf/actions/workflows/test.yml) 2 3`pkgconf` is a program which helps to configure compiler and linker flags for 4development libraries. It is a superset of the functionality provided by 5pkg-config from freedesktop.org, but does not provide bug-compatibility with 6the original pkg-config. 7 8`libpkgconf` is a library which provides access to most of `pkgconf`'s functionality, 9to allow other tooling such as compilers and IDEs to discover and use libraries 10configured by pkgconf. 11 12## release tarballs 13 14Release tarballs are available on [distfiles.ariadne.space][distfiles]. 15 16 [distfiles]: https://distfiles.ariadne.space/pkgconf/ 17 18## build system setup 19 20If you would like to use the git sources directly, or a snapshot of the 21sources from GitHub, you will need to regenerate the autotools build 22system artifacts yourself, or use Meson instead. For example, on Alpine: 23 24 $ apk add autoconf automake libtool build-base 25 $ sh ./autogen.sh 26 27## pkgconf-lite 28 29If you only need the original pkg-config functionality, there is also pkgconf-lite, 30which builds the `pkgconf` frontend and relevant portions of `libpkgconf` functionality 31into a single binary: 32 33 $ make -f Makefile.lite 34 35## why `pkgconf` over original `pkg-config`? 36 37pkgconf builds a flattened directed dependency graph, which allows for more insight 38into relationships between dependencies, allowing for some link-time dependency 39optimization, which allows for the user to more conservatively link their binaries, 40which may be helpful in some environments, such as when prelink(1) is being used. 41 42The solver is also optimized to handle large dependency graphs with hundreds of 43thousands of edges, which can be seen in any project using the Abseil frameworks 44for example. 45 46In addition, pkgconf has full support for virtual packages, while the original 47pkg-config does not, as well as fully supporting `Conflicts` at dependency 48resolution time, which is more efficient than checking for `Conflicts` while 49walking the dependency graph. 50 51## linker flags optimization 52 53pkgconf, when used effectively, can make optimizations to avoid overlinking binaries. 54 55This functionality depends on the pkg-config module properly declaring its dependency 56tree instead of using `Libs` and `Cflags` fields to directly link against other modules 57which have pkg-config metadata files installed. 58 59The practice of using `Libs` and `Cflags` to describe unrelated dependencies is 60not recommended in [Dan Nicholson's pkg-config tutorial][fd-tut] for this reason. 61 62 [fd-tut]: http://people.freedesktop.org/~dbn/pkg-config-guide.html 63 64## bug compatibility with original pkg-config 65 66In general, we do not provide bug-level compatibility with pkg-config. 67 68What that means is, if you feel that there is a legitimate regression versus pkg-config, 69do let us know, but also make sure that the .pc files are valid and follow the rules of 70the [pkg-config tutorial][fd-tut], as most likely fixing them to follow the specified 71rules will solve the problem. 72 73## debug output 74 75Please use only the stable interfaces to query pkg-config. Do not screen-scrape the 76output from `--debug`: this is sent to `stderr` for a reason, it is not intended to be 77scraped. The `--debug` output is **not** a stable interface, and should **never** be 78depended on as a source of information. If you need a stable interface to query pkg-config 79which is not covered, please get in touch. 80 81## compiling `pkgconf` and `libpkgconf` on UNIX 82 83pkgconf is basically compiled the same way any other autotools-based project is 84compiled: 85 86 $ ./configure 87 $ make 88 $ sudo make install 89 90If you are installing pkgconf into a custom prefix, such as `/opt/pkgconf`, you will 91likely want to define the default system includedir and libdir for your toolchain. 92To do this, use the `--with-system-includedir` and `--with-system-libdir` configure 93flags like so: 94 95 $ ./configure \ 96 --prefix=/opt/pkgconf \ 97 --with-system-libdir=/lib:/usr/lib \ 98 --with-system-includedir=/usr/include 99 $ make 100 $ sudo make install 101 102## compiling `pkgconf` and `libpkgconf` with Meson (usually for Windows) 103 104pkgconf is compiled using [Meson](https://mesonbuild.com) on Windows. In theory, you could also use 105Meson to build on UNIX, but this is not recommended at this time as pkgconf is typically built 106much earlier than Meson. 107 108 $ meson setup build -Dtests=disabled 109 $ meson compile -C build 110 $ meson install -C build 111 112There are a few defines such as `SYSTEM_LIBDIR`, `PKGCONFIGDIR` and `SYSTEM_INCLUDEDIR`. 113However, on Windows, the default `PKGCONFIGDIR` value is usually overridden at runtime based 114on path relocation. 115 116## pkg-config symlink 117 118If you want pkgconf to be used when you invoke `pkg-config`, you should install a 119symlink for this. We do not do this for you, as we believe it is better for vendors 120to make this determination themselves. 121 122 $ ln -sf pkgconf /usr/bin/pkg-config 123 124## contacts 125 126You can report bugs at <https://github.com/pkgconf/pkgconf/issues>. 127 128There is a mailing list at <https://lists.sr.ht/~kaniini/pkgconf>. 129 130You can contact us via IRC at `#pkgconf` at `irc.oftc.net`. 131