summaryrefslogtreecommitdiff
path: root/Modules/CPackDeb.cmake
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2015-04-20 20:48:24 +0200
committerBrad King <brad.king@kitware.com>2015-04-21 08:47:18 -0400
commitc8375e15eb9338d79b9decb55f1ebbf1d68fad71 (patch)
tree73cabe5b22fab57a32ee854c2545fe1d26458f6c /Modules/CPackDeb.cmake
parentb2289ff6542b79772e874c6dba157f72bb17c8be (diff)
downloadcmake-c8375e15eb9338d79b9decb55f1ebbf1d68fad71.tar.gz
CPackDeb: Refactor package variable lookup by generator
Preparation for per component variables. Patch makes sure we know which variables will be set for per component generator and also prevents accidental overflows of variable values between components.
Diffstat (limited to 'Modules/CPackDeb.cmake')
-rw-r--r--Modules/CPackDeb.cmake419
1 files changed, 223 insertions, 196 deletions
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 8a4fa49c12..f248a674c4 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -223,233 +223,260 @@ if(NOT UNIX)
message(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
endif()
-# CPACK_DEBIAN_PACKAGE_SHLIBDEPS
-# If specify OFF, only user depends are used
-if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
- set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
-endif()
+function(cpack_deb_prepare_package_vars)
+ # CPACK_DEBIAN_PACKAGE_SHLIBDEPS
+ # If specify OFF, only user depends are used
+ if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
+ endif()
-find_program(FAKEROOT_EXECUTABLE fakeroot)
-if(FAKEROOT_EXECUTABLE)
- set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
-endif()
+ find_program(FAKEROOT_EXECUTABLE fakeroot)
+ if(FAKEROOT_EXECUTABLE)
+ set(CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${FAKEROOT_EXECUTABLE})
+ endif()
-if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
- # dpkg-shlibdeps is a Debian utility for generating dependency list
- find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps)
-
- # Check version of the dpkg-shlibdeps tool using CPackRPM method
- if(SHLIBDEPS_EXECUTABLE)
- execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version
- OUTPUT_VARIABLE _TMP_VERSION
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)"
- SHLIBDEPS_EXECUTABLE_VERSION
- ${_TMP_VERSION})
- set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>")
- endif()
+ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
+ # dpkg-shlibdeps is a Debian utility for generating dependency list
+ find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps)
+
+ # Check version of the dpkg-shlibdeps tool using CPackRPM method
+ if(SHLIBDEPS_EXECUTABLE)
+ execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version
+ OUTPUT_VARIABLE _TMP_VERSION
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)"
+ SHLIBDEPS_EXECUTABLE_VERSION
+ ${_TMP_VERSION})
+ set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>")
+ endif()
- # Generating binary list - Get type of all install files
- execute_process(COMMAND find -type f
- COMMAND xargs file
- WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
- OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES)
-
- # Convert to CMake list
- string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES})
-
- # Only dynamically linked ELF files are included
- # Extract only file name infront of ":"
- foreach ( _FILE ${CPACK_DEB_INSTALL_FILES})
- if ( ${_FILE} MATCHES "ELF.*dynamically linked")
- string(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE})
- list(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1})
+ # Generating binary list - Get type of all install files
+ execute_process(COMMAND find -type f
+ COMMAND xargs file
+ WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
+ OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES)
+
+ # Convert to CMake list
+ string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES})
+
+ # Only dynamically linked ELF files are included
+ # Extract only file name infront of ":"
+ foreach ( _FILE ${CPACK_DEB_INSTALL_FILES})
+ if ( ${_FILE} MATCHES "ELF.*dynamically linked")
+ string(REGEX MATCH "(^.*):" _FILE_NAME ${_FILE})
+ list(APPEND CPACK_DEB_BINARY_FILES ${CMAKE_MATCH_1})
+ endif()
+ endforeach()
+
+ message( "CPackDeb: - Generating dependency list")
+
+ # Create blank control file for running dpkg-shlibdeps
+ # There might be some other way to invoke dpkg-shlibdeps without creating this file
+ # but standard debian package should not have anything that can collide with this file or directory
+ file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian)
+ file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "")
+
+ # Execute dpkg-shlibdeps
+ # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package
+ # -O : print to STDOUT
+ execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES}
+ WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
+ OUTPUT_VARIABLE SHLIBDEPS_OUTPUT
+ RESULT_VARIABLE SHLIBDEPS_RESULT
+ ERROR_VARIABLE SHLIBDEPS_ERROR
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ # dpkg-shlibdeps will throw some warnings if some input files are not binary
+ message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}")
endif()
- endforeach()
-
- message( "CPackDeb: - Generating dependency list")
-
- # Create blank control file for running dpkg-shlibdeps
- # There might be some other way to invoke dpkg-shlibdeps without creating this file
- # but standard debian package should not have anything that can collide with this file or directory
- file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian)
- file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "")
-
- # Execute dpkg-shlibdeps
- # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package
- # -O : print to STDOUT
- execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} --ignore-missing-info -O ${CPACK_DEB_BINARY_FILES}
- WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
- OUTPUT_VARIABLE SHLIBDEPS_OUTPUT
- RESULT_VARIABLE SHLIBDEPS_RESULT
- ERROR_VARIABLE SHLIBDEPS_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE )
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- # dpkg-shlibdeps will throw some warnings if some input files are not binary
- message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}")
- endif()
- if (NOT SHLIBDEPS_RESULT EQUAL 0)
- message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}")
- endif ()
+ if (NOT SHLIBDEPS_RESULT EQUAL 0)
+ message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}")
+ endif ()
- #Get rid of prefix generated by dpkg-shlibdeps
- string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT})
+ #Get rid of prefix generated by dpkg-shlibdeps
+ string (REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${SHLIBDEPS_OUTPUT})
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
- endif()
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
+ endif()
+
+ # Remove blank control file
+ # Might not be safe if package actual contain file or directory named debian
+ file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian")
- # Remove blank control file
- # Might not be safe if package actual contain file or directory named debian
- file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian")
+ # Append user depend if set
+ if (CPACK_DEBIAN_PACKAGE_DEPENDS)
+ set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
+ else ()
+ set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
+ endif ()
- # Append user depend if set
- if (CPACK_DEBIAN_PACKAGE_DEPENDS)
- set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
else ()
- set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}")
- endif ()
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.")
+ endif()
+ endif()
else ()
if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found.")
+ message( "CPackDeb Debug: Using only user-provided depends")
endif()
endif()
-else ()
- if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message( "CPackDeb Debug: Using only user-provided depends")
- endif()
-endif()
-
-# Let's define the control file found in debian package:
+ # Let's define the control file found in debian package:
-# Binary package:
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
+ # Binary package:
+ # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
-# DEBIAN/control
-# debian policy enforce lower case for package name
-# Package: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_NAME)
- string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
-endif()
-
-# Version: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
- if(NOT CPACK_PACKAGE_VERSION)
- message(FATAL_ERROR "CPackDeb: Debian package requires a package version")
+ # DEBIAN/control
+ # debian policy enforce lower case for package name
+ # Package: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_NAME)
+ string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
endif()
- set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
-endif()
-# Architecture: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
- # There is no such thing as i686 architecture on debian, you should use i386 instead
- # $ dpkg --print-architecture
- find_program(DPKG_CMD dpkg)
- if(NOT DPKG_CMD)
- message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
- set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
+ # Version: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
+ if(NOT CPACK_PACKAGE_VERSION)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a package version")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
endif()
- execute_process(COMMAND "${DPKG_CMD}" --print-architecture
- OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-endif()
-# have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
-# this returns the successful find_package() calls, maybe this can help
-# Depends:
-# You should set: DEBIAN_PACKAGE_DEPENDS
-# TODO: automate 'objdump -p | grep NEEDED'
-if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
- message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
-endif()
+ # Architecture: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+ # There is no such thing as i686 architecture on debian, you should use i386 instead
+ # $ dpkg --print-architecture
+ find_program(DPKG_CMD dpkg)
+ if(NOT DPKG_CMD)
+ message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
+ endif()
+ execute_process(COMMAND "${DPKG_CMD}" --print-architecture
+ OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif()
-# Maintainer: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
- if(NOT CPACK_PACKAGE_CONTACT)
- message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
+ # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
+ # this returns the successful find_package() calls, maybe this can help
+ # Depends:
+ # You should set: DEBIAN_PACKAGE_DEPENDS
+ # TODO: automate 'objdump -p | grep NEEDED'
+ if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
+ message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
endif()
- set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
-endif()
-# Description: (mandatory)
-if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
- if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
+ # Maintainer: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
+ if(NOT CPACK_PACKAGE_CONTACT)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
endif()
- set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
-endif()
-# Section: (recommended)
-if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
- set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
-endif()
+ # Description: (mandatory)
+ if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
+ message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
+ endif()
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ endif()
-# Priority: (recommended)
-if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
- set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
-endif()
+ # Section: (recommended)
+ if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
+ set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
+ endif()
-# Compression: (recommended)
-if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
- set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
-endif()
+ # Priority: (recommended)
+ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
+ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
+ endif()
+ # Compression: (recommended)
+ if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
+ set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
+ endif()
-# Recommends:
-# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
-
-# Suggests:
-# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
-
-# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
-# Typical examples are:
-# - conffiles
-# - postinst
-# - postrm
-# - prerm"
-# Usage:
-# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
-# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
-
-# Are we packaging components ?
-if(CPACK_DEB_PACKAGE_COMPONENT)
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
- string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
-else()
- set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
-endif()
-set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
-
-# Print out some debug information if we were asked for that
-if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
- message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
- message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
- message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
- message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
- message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
- message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
- message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
-endif()
+ # Recommends:
+ # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
+
+ # Suggests:
+ # You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
+
+ # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+ # This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
+ # Typical examples are:
+ # - conffiles
+ # - postinst
+ # - postrm
+ # - prerm"
+ # Usage:
+ # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+ # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+
+ # Are we packaging components ?
+ if(CPACK_DEB_PACKAGE_COMPONENT)
+ set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
+ string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+ else()
+ set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
+ endif()
-# For debian source packages:
-# debian/control
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
+ set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
-# .dsc
-# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
+ # Print out some debug information if we were asked for that
+ if(CPACK_DEBIAN_PACKAGE_DEBUG)
+ message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
+ message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
+ message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
+ message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
+ message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
+ message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
+ message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+ message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
+ endif()
-# Builds-Depends:
-#if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
-# set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
-# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
-# )
-#endif()
+ # For debian source packages:
+ # debian/control
+ # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
+
+ # .dsc
+ # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
+
+ # Builds-Depends:
+ #if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
+ # set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
+ # "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
+ # )
+ #endif()
+
+ # move variables to parent scope so that they may be used to create debian package
+ 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)
+ set(GEN_CPACK_DEBIAN_PACKAGE_PRIORITY "${CPACK_DEBIAN_PACKAGE_PRIORITY}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_FAKEROOT_EXECUTABLE "${CPACK_DEBIAN_FAKEROOT_EXECUTABLE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_DEBIAN_PACKAGE_HOMEPAGE}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS "${CPACK_DEBIAN_PACKAGE_PREDEPENDS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_ENHANCES "${CPACK_DEBIAN_PACKAGE_ENHANCES}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_BREAKS "${CPACK_DEBIAN_PACKAGE_BREAKS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS "${CPACK_DEBIAN_PACKAGE_CONFLICTS}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE)
+ set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE)
+ set(GEN_WDIR "${WDIR}" PARENT_SCOPE)
+endfunction()
+
+cpack_deb_prepare_package_vars()