CPack/DEB: Incorrect detection of necessity of defaulted `postinst` / `postrm` scripts
The CPackDeb.cmake
module tries to analyze the package content finding dynamic libraries like this:
# add ldconfig call in default postrm and postint
set(CPACK_ADD_LDCONFIG_CALL 0)
foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES)
get_filename_component(_DIR ${_FILE} DIRECTORY)
# all files in CPACK_DEB_SHARED_OBJECT_FILES have dot at the beginning
if(_DIR STREQUAL "./lib" OR _DIR STREQUAL "./usr/lib") # <-- ALERT HERE -->
set(CPACK_ADD_LDCONFIG_CALL 1)
endif()
endforeach()
This code snippet doesn't match Linux distributions with multiarch paths (e.g., Debian, Ubuntu, Exherbo, ...). I.e., when the libraries get installed into */lib/$(host-multiarch)
directories. Example, /usr/lib/x86_64-linux-gnu
, /lib/i386-linux-gnu
, ...
Since this scheme is used in modern Debian/Ubuntu/etc. (i.e. the distros where the *.deb
packages are "native"), CPackDeb
in fact doesn't match 'em properly... Meaning that if the user's package installs libraries into it, and doesn't provide any postinst
/prerm
, the defaults won't be generated either (as it supposed to be).
Edited by Alex Turbov