CPack Deb does not create postinst when installing to /usr/lib/x86_64-linux-gnu
As of CMake 3.6, CPack Deb is supposed to create a postinst script to call ldconfig
if the package installs a shared library to a location controlled by ldconfig
.
Unfortunately, the list of locations is far too restrictive. Currently, the code only honors /lib
and /usr/lib
, but the mandated install directory on Ubuntu is /usr/lib/x86_64-linux-gnu
on multi-arch systems. Not generating postinst
in this case leads to a broken package.
The code at issue is here: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Internal/CPack/CPackDeb.cmake#L664-688
There is no reason this shouldn't be user-configurable. "Enabled intelligently" is fine, but there needs to be a switch to force the behavior or otherwise a list of ldconfig
directories.
This causes lintian errors like package-must-activate-ldconfig-trigger
or the newer (renamed) lacks-ldconfig-trigger
.
Moreover, lintian no longer wants you to call ldconfig
from a maintainer script (ie. postinst/rm
), but to use the official trigger. See here: https://lintian.debian.org/tags/maintscript-calls-ldconfig.html
This will cause lintian errors like maintscript-calls-ldconfig
. The workaround I am able to do now is:
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_LIST_DIR}/triggers")
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
Where that triggers
file contains the following contents:
activate-noawait ldconfig