From b41189563b65b6adc16c0bfd2c4289db3db19ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 5 Apr 2024 12:06:45 +0200 Subject: [PATCH] Add a private dependency on zck to librepo.pc if zchunk support is enabled If librepo is built with zchunk support, zchunk's zck.h header file is included from librepo public header files, thus applications building against librepo needs zchunk header files available at build time. Those who only use pkg-config for tracking dependencies, reported build failures: /usr/include/librepo/downloadtarget.h:27:10: fatal error: zck.h: No such file or directory This patch adds the dependency on zck to librepo.pc. It enhances Requires.private instead of Requires to prevent from contaminating "pkgconf --libs librepo" with -lzck. Contrary, "pkgconf --cflags librepo" correctly appends include path to zck header files. The dependency on zck.pc is only checked and enforced with "pkgconf --cflags librepo" invocation. This behaviour is a feature. See and . Fixes: #305 --- README.md | 5 +++++ librepo/CMakeLists.txt | 1 + librepo/librepo.pc.cmake | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 27e6d526a..1c058bc98 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ Fedora/Ubuntu name * Built with Sequoia * Built with an internal OpenPGP parser - buggy (https://github.com/rpm-software-management/rpm/issues/2512) +* Optional dependencies: + * zchunk (https://github.com/zchunk/zchunk) - zchunk-devel/libzck-dev - disable + with -DWITH\_ZCHUNK=OFF + * If you build librepo with zchunk support, your application might + transitively include zchunk headers. * **Test requires:** pygpgme (https://pypi.python.org/pypi/pygpgme/0.1) - python3-pygpgme/python3-gpgme * **Test requires:** python3-pyxattr (https://github.com/xattr/xattr) - python3-pyxattr/python3-pyxattr diff --git a/librepo/CMakeLists.txt b/librepo/CMakeLists.txt index 7615d6881..68d78677b 100644 --- a/librepo/CMakeLists.txt +++ b/librepo/CMakeLists.txt @@ -80,6 +80,7 @@ ENDIF (USE_GPGME) IF (WITH_ZCHUNK) TARGET_LINK_LIBRARIES(librepo ${ZCHUNKLIB_LIBRARIES}) + SET(PKGCONF_DEPENDENCY_ZCK "zck") ENDIF (WITH_ZCHUNK) SET_TARGET_PROPERTIES(librepo PROPERTIES OUTPUT_NAME "repo") diff --git a/librepo/librepo.pc.cmake b/librepo/librepo.pc.cmake index 6ac4e3259..f486ed9fd 100644 --- a/librepo/librepo.pc.cmake +++ b/librepo/librepo.pc.cmake @@ -6,7 +6,7 @@ Name: librepo Description: Repodata downloading library. Version: @VERSION@ Requires: glib-2.0 -Requires.private: libcurl openssl libxml-2.0 +Requires.private: libcurl openssl libxml-2.0 @PKGCONF_DEPENDENCY_ZCK@ Libs: -L${libdir} -lrepo Libs.private: -lgpgme -lgpg-error Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64