Skip to content

Commit

Permalink
Add a private dependency on zck to librepo.pc if zchunk support is en…
Browse files Browse the repository at this point in the history
…abled

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
<pkgconf/pkgconf#352> and
<pkgconf/pkgconf#300>.

Fixes: #305
  • Loading branch information
ppisar authored and kontura committed Apr 15, 2024
1 parent 4ff11d8 commit b411895
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions librepo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion librepo/librepo.pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b411895

Please sign in to comment.