build: add Libs/Cflags to libzpc.pc and fix libdir substitution - #51
Open
plusky wants to merge 1 commit into
Open
build: add Libs/Cflags to libzpc.pc and fix libdir substitution#51plusky wants to merge 1 commit into
plusky wants to merge 1 commit into
Conversation
libzpc.pc shipped without Libs: and Cflags:, so `pkg-config --libs libzpc`
returned nothing and consumers linked without -lzpc. libdir and includedir
were declared and then never referenced by any field.
configure_file() also ran before include(GNUInstallDirs), so
@CMAKE_INSTALL_LIBDIR@/@CMAKE_INSTALL_INCLUDEDIR@ expanded empty unless the
caller set them on the command line — move the include first, otherwise
${libdir} in the new Libs: line is wrong for a plain build.
No API or ABI change.
Link: https://bugzilla.suse.com/show_bug.cgi?id=1279335
Signed-off-by: Martin Pluskal <martin@pluskal.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libzpc.pcis installed with noLibs:and noCflags:, sopkg-config --libs libzpcreturns nothing for a package that does ship a linkable shared library. A consumer built withgcc $(pkg-config --cflags --libs libzpc) prog.cgets no library on the link line and fails with undefined references tozpc_*.libdirandincludedirare declared in the template and then never referenced by any field.This is reachable in practice: SUSE Linux Enterprise ships
libzpc-develfrom the 1.x line (1.3.0 on SLE 15 SP7, 1.5.0 on SLE 16.0) and the shipped.pchas this shape. Tracked downstream as https://bugzilla.suse.com/show_bug.cgi?id=1279335.Two hunks, because the one-liner alone would be wrong:
libzpc.pc.ingainsLibs: -L${libdir} -lzpcandCflags: -I${includedir}.include(GNUInstallDirs)moves aboveconfigure_file(libzpc.pc.in ...). It currently runs after, so@CMAKE_INSTALL_LIBDIR@and@CMAKE_INSTALL_INCLUDEDIR@expand to nothing unless the caller passes-DCMAKE_INSTALL_LIBDIR/-DCMAKE_INSTALL_INCLUDEDIR. Distro builds usually do, which is why the shippedlibdirlooks correct, but a plaincmake -DCMAKE_INSTALL_PREFIX=/usrdoes not — and then the newLibs:line would point at${exec_prefix}/.Before, plain
cmake -DCMAKE_INSTALL_PREFIX=/usr:After, same invocation:
(
-L/usr/lib64and-I/usr/includeare correctly elided by pkg-config as default search paths.)Targeted at
libzpc-1.5.yrather thanmain: onmain,e91faa1removed the shared-library, header and pkg-config installs, solibzpc.pc.inis no longer used there and this fix would be a no-op.No API or ABI change. No regression test added — the project's test suite is a gtest binary for the library API and has no hook for checking generated build metadata; happy to add one if you'd like it somewhere.