ultravideo / uvg266

An open-source VVC encoder based on Kvazaar
BSD 3-Clause "New" or "Revised" License
223 stars 16 forks source link

pkg-config gets installed in the wrong/extremely uncommon directory #5

Closed 1480c1 closed 2 years ago

1480c1 commented 2 years ago

https://github.com/ultravideo/uvg266/blob/master/CMakeLists.txt#L227

the .pc file is installed into $PREFIX/share/pkgconfig, however, nothing uses that directory, the most common subdirectory is lib/pkgconfig and is usually used as the default for pkg-config

One option to address this would be something like

-install(FILES ${PROJECT_SOURCE_DIR}/src/uvg266.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig)
+install(FILES ${PROJECT_SOURCE_DIR}/src/uvg266.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)

another would be

-install(FILES ${PROJECT_SOURCE_DIR}/src/uvg266.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig)
+install(FILES src/uvg266.pc DESTINATION lib/pkgconfig)

as according to cmake's docs, https://cmake.org/cmake/help/latest/command/install.html,

DESTINATION

Specify the directory on disk to which a file will be installed. Arguments can be relative or absolute paths.

If a relative path is given it is interpreted relative to the value of the CMAKE_INSTALL_PREFIX variable ... The FILES form specifies rules for installing files for a project. File names given as relative paths are interpreted with respect to the current source directory.

and another alternative that would probably be preferred would be to use the GNUInstallDirs module which has been provided by CMake for a while https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html and it would look something like

include(GNUInstallDirs)
...

install(FILES src/uvg266.pc DESTINATION ${LIBDIR}/pkgconfig)

as that would handle distro specific quirks related to their lib directory such as lib32 or lib64 etc, so long as the distro sends their changes upstream and so on.

1480c1 commented 2 years ago

Generally, $prefix/share/pkgconfig is used to store arch-independent projects.

Courtesy of @biswa96

seems I was wrong, certain arch-independent packages do use share/pkgconfig, however, considering the nature of this project, I would hazard to guess this would not fall under the same conditions since the resulting library is not arch-independent

fador commented 2 years ago

Thanks for the help! I don't have that much experience on CMake so I just followed some random examples, GNUInstallDirs seems like a way to go then.

fador commented 2 years ago

51f7888ca794913ff7be9b46abd25cde0f2a80e2 is now pushed to master to address this, I hope it fixes the problem?

1480c1 commented 2 years ago

That commit does indeed fix the issue, thanks!