diff options
author | Alexander Smorkalov <alexander.smorkalov@itseez.com> | 2016-05-10 14:53:19 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-13 10:46:03 -0400 |
commit | 3a55a0e72c216cfe6536e7d8e5c72e3f3e5d65b4 (patch) | |
tree | 5f81972310037f4b737e618678b8d2bee4c330e2 /Modules | |
parent | c7f388e723b85b48a1d0d462a8f2f7d962314421 (diff) | |
download | cmake-3a55a0e72c216cfe6536e7d8e5c72e3f3e5d65b4.tar.gz |
CPack/Deb proper component packages file naming
Proper Debian packages file naming for multi-component setup
(breaks compatibility with previous versions)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CPackDeb.cmake | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index d38751fcb3..3e5758bd3c 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -453,6 +453,17 @@ if(NOT UNIX) message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") endif() +function(get_component_package_name var component) + string(TOUPPER "${component}" component_upcase) + if(CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME) + string(TOLOWER "${CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME}" package_name) + else() + string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${component}" package_name) + endif() + + set("${var}" "${package_name}" PARENT_SCOPE) +endfunction() + #extract library name and version for given shared object function(extract_so_info shared_object libname version) if(READELF_EXECUTABLE) @@ -775,12 +786,7 @@ function(cpack_deb_prepare_package_vars) set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}") endif() endforeach() - - if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME) - string(TOLOWER "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) - else() - string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEB_PACKAGE_COMPONENT}" CPACK_DEBIAN_PACKAGE_NAME) - endif() + get_component_package_name(CPACK_DEBIAN_PACKAGE_NAME ${_local_component_name}) endif() set(CPACK_DEBIAN_PACKAGE_SHLIBS_LIST "") @@ -810,6 +816,15 @@ function(cpack_deb_prepare_package_vars) endif() endif() + # Patch package file name to be in corrent form + if(CPACK_DEB_PACKAGE_COMPONENT) + set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") + set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_OUTPUT_FILE_NAME}") + + get_filename_component(BINARY_DIR "${CPACK_OUTPUT_FILE_PATH}" DIRECTORY) + set(CPACK_OUTPUT_FILE_PATH "${BINARY_DIR}/${CPACK_OUTPUT_FILE_NAME}") + endif() + # add ldconfig call in default postrm and postint set(CPACK_ADD_LDCONFIG_CALL 0) foreach(_FILE ${CPACK_DEB_SHARED_OBJECT_FILES}) @@ -866,6 +881,8 @@ function(cpack_deb_prepare_package_vars) #endif() # move variables to parent scope so that they may be used to create debian package + set(GEN_CPACK_OUTPUT_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}" PARENT_SCOPE) + set(GEN_CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TEMPORARY_PACKAGE_FILE_NAME}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_DEBIAN_PACKAGE_SECTION}" PARENT_SCOPE) |