@@ -628,51 +628,23 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
628628 set (CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON )
629629 set (CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON )
630630 set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
631- set (CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE )
632631 # set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
633632 # see above assignments
634633 # to CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS or CMAKE_INSTALL_RPATH
635634
636- # CPack 4.4+ generates the ldconfig trigger itself. Older versions need
637- # explicit control files and do not classify triggers as executable scripts.
638- if (CMAKE_VERSION VERSION_LESS "4.4.0" )
639- set (_debian_control_dir "${CMAKE_CURRENT_BINARY_DIR } /debian-control" )
640- set (_debian_control_triggers "${_debian_control_dir} /triggers" )
641- set (_debian_control_postinst "${_debian_control_dir} /postinst" )
642- set (_debian_control_postrm "${_debian_control_dir} /postrm" )
643- file (MAKE_DIRECTORY "${_debian_control_dir} " )
644- foreach (_debian_control_file IN ITEMS triggers postinst postrm)
645- configure_file (
646- "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/${_debian_control_file} "
647- "${_debian_control_dir} /${_debian_control_file} " COPYONLY )
648- endforeach ()
649- execute_process (
650- COMMAND chmod 0644 "${_debian_control_triggers} "
651- RESULT_VARIABLE _debian_control_chmod_result )
652- if (NOT _debian_control_chmod_result EQUAL 0)
653- message (FATAL_ERROR "Failed to set permissions on ${_debian_control_triggers} " )
654- endif ()
655- execute_process (
656- COMMAND chmod 0755 "${_debian_control_postinst} " "${_debian_control_postrm} "
657- RESULT_VARIABLE _debian_control_chmod_result )
658- if (NOT _debian_control_chmod_result EQUAL 0)
659- message (FATAL_ERROR "Failed to set permissions on maintainer scripts" )
660- endif ()
661- set (_debian_control_extra
662- "${_debian_control_triggers} "
663- "${_debian_control_postinst} "
664- "${_debian_control_postrm} " )
665- endif ()
666-
667635 set (CPACK_DEBIAN_LIBRARY_RUNTIME_PACKAGE_NAME "libgencmp2" )
668636 set (CPACK_DEBIAN_LIBRARY_RUNTIME_FILE_NAME DEB-DEFAULT)
669637 set (CPACK_DEBIAN_LIBRARY_RUNTIME_PACKAGE_SECTION "libs" )
670- # see also https://gitlab.kitware.com/cmake/cmake/-/issues/21834
671- if (CMAKE_VERSION VERSION_LESS "4.4.0" )
672- set (CPACK_DEBIAN_LIBRARY_RUNTIME_PACKAGE_CONTROL_EXTRA
673- ${_debian_control_extra} )
674- set (CPACK_DEBIAN_LIBRARY_RUNTIME_PACKAGE_CONTROL_STRICT_PERMISSION TRUE )
675- endif ()
638+ # CPack 4.4+ generates the ldconfig trigger itself; supplying it as an
639+ # extra control file would incorrectly make it executable in strict mode.
640+ if (CMAKE_VERSION VERSION_LESS "4.4" )
641+ # Older CPack versions need a custom trigger to avoid direct ldconfig calls.
642+ set (CPACK_DEBIAN_LIBRARY_RUNTIME_PACKAGE_CONTROL_EXTRA
643+ "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/triggers"
644+ "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/postinst"
645+ "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/postrm" )
646+ set (CPACK_DEBIAN_LIBRARY_RUNTIME_PACKAGE_CONTROL_STRICT_PERMISSION TRUE )
647+ endif ()
676648
677649 if (FALSE ) # for now, disable dependencies to libs of subprojectx because their .so files for some reason already get included in the package:
678650 if (NOT DEFINED GENCMP_NO_SECUTILS)
@@ -697,9 +669,15 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
697669 endif ()
698670 # see also https://gitlab.kitware.com/cmake/cmake/-/issues/21834
699671 # CPack Deb does not create postinst when installing to /usr/lib/x86_64-linux-gnu
700- if (CMAKE_VERSION VERSION_LESS "4.4.0" )
701- set (CPACK_DEBIAN_LIB_PACKAGE_CONTROL_EXTRA ${_debian_control_extra} )
702- set (CPACK_DEBIAN_LIB_PACKAGE_CONTROL_STRICT_PERMISSION TRUE )
672+ # CPack 4.4+ generates the ldconfig trigger itself; supplying it as an
673+ # extra control file would incorrectly make it executable in strict mode.
674+ if (CMAKE_VERSION VERSION_LESS "4.4" )
675+ # Older CPack versions need a custom trigger to avoid direct ldconfig calls.
676+ set (CPACK_DEBIAN_LIB_PACKAGE_CONTROL_EXTRA
677+ "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/triggers"
678+ "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/postinst"
679+ "${CMAKE_CURRENT_SOURCE_DIR } /debian/extra/postrm" )
680+ set (CPACK_DEBIAN_LIB_PACKAGE_CONTROL_STRICT_PERMISSION TRUE )
703681 endif ()
704682
705683else (Linux )
0 commit comments