2013-10-15 19:17:36 +04:00
#.rst:
# CPackDeb
# --------
#
# The builtin (binary) CPack Deb generator (Unix only)
#
2013-10-15 21:23:23 +04:00
# Variables specific to CPack Debian (DEB) generator
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# CPackDeb may be used to create Deb package using CPack.
2009-10-30 19:06:53 +03:00
# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
2010-07-28 20:24:20 +04:00
# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration.
2013-10-15 19:17:36 +04:00
# CPackDeb generator should work on any linux host but it will produce
# better deb package when Debian specific tools 'dpkg-xxx' are usable on
# the build system.
#
# CPackDeb has specific features which are controlled by the specifics
# CPACK_DEBIAN_XXX variables.You'll find a detailed usage on the wiki:
2013-10-15 21:23:23 +04:00
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
2013-10-15 19:17:36 +04:00
#
2009-10-30 19:06:53 +03:00
# However as a handy reminder here comes the list of specific variables:
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_NAME
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : CPACK_PACKAGE_NAME (lower case)
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The debian package summary
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : CPACK_PACKAGE_VERSION
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The debian package version
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : Output of dpkg --print-architecture (or i386 if dpkg is not found)
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The debian package architecture
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# May be used to set deb dependencies.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : CPACK_PACKAGE_CONTACT
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The debian package maintainer
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The debian package description
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_SECTION
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : 'devel'
2013-10-15 19:17:36 +04:00
#
2014-03-10 09:37:26 +04:00
# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
#
# * Mandatory : YES
# * Default : 'gzip'
#
# Possible values are: lzma, xz, bzip2 and gzip.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : YES
# * Default : 'optional'
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The debian package priority
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# The URL of the web site for this package, preferably (when applicable) the
# site from which the original source can be obtained and any additional
# upstream documentation or information may be found.
# The content of this field is a simple URL without any surrounding
# characters such as <>.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : OFF
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# May be set to ON in order to use dpkg-shlibdeps to generate
# better package dependency list.
# You may need set CMAKE_INSTALL_RPATH toi appropriate value
# if you use this feature, because if you don't dpkg-shlibdeps
# may fail to find your own shared libs.
# See http://www.cmake.org/Wiki/CMake_RPATH_handling.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# May be set when invoking cpack in order to trace debug information
# during CPackDeb run.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# This field is like Depends, except that it also forces dpkg to complete installation of
# the packages named before even starting the installation of the package which declares
# the pre-dependency.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# This field is similar to Suggests but works in the opposite direction.
# It is used to declare that a package can enhance the functionality of another package.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# When one binary package declares that it breaks another, dpkg will refuse to allow the
# package which declares Breaks be installed unless the broken package is deconfigured first,
# and it will refuse to allow the broken package to be reconfigured.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# When one binary package declares a conflict with another using a Conflicts field,
# dpkg will refuse to allow them to be installed on the system at the same time.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# A virtual package is one which appears in the Provides control field of another package.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# Packages can declare in their control file that they should overwrite
# files in certain other packages, or completely replace other packages.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# Allows packages to declare a strong, but not absolute, dependency on other packages.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps
# Allows packages to declare a suggested package install grouping.
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# * Mandatory : NO
# * Default : -
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# This variable allow advanced user to add custom script to the
# control.tar.gz Typical usage is for conffiles, postinst, postrm, prerm.
# Usage::
2013-10-15 19:17:36 +04:00
#
2013-10-15 21:23:23 +04:00
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
2012-06-18 18:15:43 +04:00
2007-08-08 22:18:13 +04:00
2009-09-28 19:46:51 +04:00
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
2009-10-30 19:06:53 +03:00
# Copyright 2007-2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
2009-09-28 19:46:51 +04:00
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
2010-08-07 04:48:47 +04:00
# (To distribute this file outside of CMake, substitute the full
2009-09-28 19:46:51 +04:00
# License text for the above reference.)
2007-08-08 22:18:13 +04:00
# CPack script for creating Debian package
# Author: Mathieu Malaterre
#
# http://wiki.debian.org/HowToPackageForDebian
2012-08-13 21:47:32 +04:00
if ( CMAKE_BINARY_DIR )
message ( FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally." )
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-25 18:57:33 +04:00
2012-08-13 21:47:32 +04:00
if ( NOT UNIX )
message ( FATAL_ERROR "CPackDeb.cmake may only be used under UNIX." )
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-25 18:57:33 +04:00
2010-07-28 20:24:20 +04:00
# CPACK_DEBIAN_PACKAGE_SHLIBDEPS
# If specify OFF, only user depends are used
2012-08-13 21:47:32 +04:00
if ( NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS )
set ( CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-28 20:24:20 +04:00
2012-08-13 21:47:32 +04:00
find_program ( FAKEROOT_EXECUTABLE fakeroot )
if ( FAKEROOT_EXECUTABLE )
set ( CPACK_DEBIAN_FAKEROOT_EXECUTABLE ${ FAKEROOT_EXECUTABLE } )
2012-08-13 21:50:14 +04:00
endif ( )
2011-09-06 00:43:45 +04:00
2012-08-13 21:47:32 +04:00
if ( CPACK_DEBIAN_PACKAGE_SHLIBDEPS )
2010-07-28 20:24:20 +04:00
# dpkg-shlibdeps is a Debian utility for generating dependency list
2012-08-13 21:47:32 +04:00
find_program ( SHLIBDEPS_EXECUTABLE dpkg-shlibdeps )
2010-07-28 20:24:20 +04:00
# Check version of the dpkg-shlibdeps tool using CPackRPM method
2012-08-13 21:47:32 +04:00
if ( SHLIBDEPS_EXECUTABLE )
2014-05-28 15:17:57 +04:00
execute_process ( COMMAND env LC_ALL=C ${ SHLIBDEPS_EXECUTABLE } --version
2010-07-28 20:24:20 +04:00
O U T P U T _ V A R I A B L E _ T M P _ V E R S I O N
E R R O R _ Q U I E T
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2012-08-13 21:47:32 +04:00
string ( REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)"
2010-07-28 20:24:20 +04:00
S H L I B D E P S _ E X E C U T A B L E _ V E R S I O N
$ { _ T M P _ V E R S I O N } )
2012-08-13 21:47:32 +04:00
set ( SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}" )
if ( CPACK_DEBIAN_PACKAGE_DEBUG )
message ( "CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>" )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-28 20:24:20 +04:00
# Generating binary list - Get type of all install files
2012-08-13 21:47:32 +04:00
execute_process ( COMMAND find -type f
2010-07-28 20:24:20 +04:00
C O M M A N D x a r g s f i l e
W O R K I N G _ D I R E C T O R Y " $ { C P A C K _ T E M P O R A R Y _ D I R E C T O R Y } "
O U T P U T _ V A R I A B L E C P A C K _ D E B _ I N S T A L L _ F I L E S )
# Convert to CMake list
2014-04-06 23:51:33 +04:00
string ( REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${ CPACK_DEB_INSTALL_FILES } )
2010-07-28 20:24:20 +04:00
# Only dynamically linked ELF files are included
# Extract only file name infront of ":"
2012-08-13 21:47:32 +04:00
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 ( )
2010-07-28 20:24:20 +04:00
2012-08-13 21:47:32 +04:00
message ( "CPackDeb: - Generating dependency list" )
2010-07-28 20:24:20 +04:00
# 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
2012-08-13 21:47:32 +04:00
file ( MAKE_DIRECTORY ${ CPACK_TEMPORARY_DIRECTORY } /debian )
file ( WRITE ${ CPACK_TEMPORARY_DIRECTORY } /debian/control "" )
2010-07-28 20:24:20 +04:00
# 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
2012-08-13 21:47:32 +04:00
execute_process ( COMMAND ${ SHLIBDEPS_EXECUTABLE } --ignore-missing-info -O ${ CPACK_DEB_BINARY_FILES }
2010-07-28 20:24:20 +04:00
W O R K I N G _ D I R E C T O R Y " $ { C P A C K _ T E M P O R A R Y _ D I R E C T O R Y } "
O U T P U T _ V A R I A B L E S H L I B D E P S _ O U T P U T
R E S U L T _ V A R I A B L E S H L I B D E P S _ R E S U L T
E R R O R _ V A R I A B L E S H L I B D E P S _ E R R O R
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2012-08-13 21:47:32 +04:00
if ( CPACK_DEBIAN_PACKAGE_DEBUG )
2010-07-28 20:24:20 +04:00
# dpkg-shlibdeps will throw some warnings if some input files are not binary
2012-08-13 21:47:32 +04:00
message ( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
if ( NOT SHLIBDEPS_RESULT EQUAL 0 )
message ( FATAL_ERROR "CPackDeb: dpkg-shlibdeps: ${SHLIBDEPS_ERROR}" )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-28 20:24:20 +04:00
#Get rid of prefix generated by dpkg-shlibdeps
string ( REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS ${ SHLIBDEPS_OUTPUT } )
2012-08-13 21:47:32 +04:00
if ( CPACK_DEBIAN_PACKAGE_DEBUG )
message ( "CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}" )
2012-08-13 21:50:14 +04:00
endif ( )
2010-07-28 20:24:20 +04:00
# Remove blank control file
# Might not be safe if package actual contain file or directory named debian
2012-08-13 21:47:32 +04:00
file ( REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian" )
2010-07-28 20:24:20 +04:00
# Append user depend if set
2012-08-13 21:47:32 +04:00
if ( CPACK_DEBIAN_PACKAGE_DEPENDS )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}" )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
if ( CPACK_DEBIAN_PACKAGE_DEBUG )
message ( "CPackDeb Debug: Using only user-provided depends because dpkg-shlibdeps is not found." )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2012-08-13 21:47:32 +04:00
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
if ( CPACK_DEBIAN_PACKAGE_DEBUG )
message ( "CPackDeb Debug: Using only user-provided depends" )
2012-08-13 21:50:14 +04:00
endif ( )
endif ( )
2010-07-28 20:24:20 +04:00
2007-07-27 16:59:59 +04:00
# Let's define the control file found in debian package:
2007-08-08 22:18:13 +04:00
# Binary package:
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
# DEBIAN/control
2007-07-27 16:59:59 +04:00
# debian policy enforce lower case for package name
2007-08-08 22:18:13 +04:00
# Package: (mandatory)
2012-08-13 21:47:32 +04:00
if ( NOT CPACK_DEBIAN_PACKAGE_NAME )
string ( TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME )
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-27 16:59:59 +04:00
2007-08-08 22:18:13 +04:00
# Version: (mandatory)
2012-08-13 21:47:32 +04:00
if ( NOT CPACK_DEBIAN_PACKAGE_VERSION )
if ( NOT CPACK_PACKAGE_VERSION )
message ( FATAL_ERROR "CPackDeb: Debian package requires a package version" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
set ( CPACK_DEBIAN_PACKAGE_VERSION ${ CPACK_PACKAGE_VERSION } )
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-27 16:59:59 +04:00
2007-08-08 22:18:13 +04:00
# Architecture: (mandatory)
2012-08-13 21:47:32 +04:00
if ( NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE )
2008-03-28 18:47:24 +03:00
# There is no such thing as i686 architecture on debian, you should use i386 instead
# $ dpkg --print-architecture
2012-08-13 21:47:32 +04:00
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 )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
execute_process ( COMMAND "${DPKG_CMD}" --print-architecture
2008-04-01 17:56:41 +04:00
O U T P U T _ V A R I A B L E C P A C K _ D E B I A N _ P A C K A G E _ A R C H I T E C T U R E
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-27 16:59:59 +04:00
2012-08-13 21:47:32 +04:00
# have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
# this returns the successful find_package() calls, maybe this can help
2007-07-27 16:59:59 +04:00
# Depends:
2008-03-28 18:47:24 +03:00
# You should set: DEBIAN_PACKAGE_DEPENDS
# TODO: automate 'objdump -p | grep NEEDED'
2012-08-13 21:47:32 +04:00
if ( NOT CPACK_DEBIAN_PACKAGE_DEPENDS )
message ( STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies." )
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-27 16:59:59 +04:00
2007-08-08 22:18:13 +04:00
# Maintainer: (mandatory)
2012-08-13 21:47:32 +04:00
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" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
set ( CPACK_DEBIAN_PACKAGE_MAINTAINER ${ CPACK_PACKAGE_CONTACT } )
2012-08-13 21:50:14 +04:00
endif ( )
2007-07-27 16:59:59 +04:00
2007-08-08 22:18:13 +04:00
# Description: (mandatory)
2012-08-13 21:47:32 +04:00
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" )
2012-08-13 21:50:14 +04:00
endif ( )
2012-08-13 21:47:32 +04:00
set ( CPACK_DEBIAN_PACKAGE_DESCRIPTION ${ CPACK_PACKAGE_DESCRIPTION_SUMMARY } )
2012-08-13 21:50:14 +04:00
endif ( )
2007-08-08 22:18:13 +04:00
# Section: (recommended)
2012-08-13 21:47:32 +04:00
if ( NOT CPACK_DEBIAN_PACKAGE_SECTION )
set ( CPACK_DEBIAN_PACKAGE_SECTION "devel" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-08-08 22:18:13 +04:00
# Priority: (recommended)
2012-08-13 21:47:32 +04:00
if ( NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
set ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-08-08 22:18:13 +04:00
2014-03-10 09:37:26 +04:00
# Compression: (recommended)
if ( NOT CPACK_DEBIAN_COMPRESSION_TYPE )
set ( CPACK_DEBIAN_COMPRESSION_TYPE "gzip" )
endif ( )
2007-08-08 22:18:13 +04:00
# Recommends:
2007-10-25 21:26:54 +04:00
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
2007-08-08 22:18:13 +04:00
# Suggests:
2007-10-25 21:26:54 +04:00
# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
2007-08-08 22:18:13 +04:00
2008-04-02 01:51:18 +04:00
# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
2010-07-28 20:24:20 +04:00
# Typical examples are:
2008-04-02 01:51:18 +04:00
# - conffiles
# - postinst
# - postrm
# - prerm"
# Usage:
2012-08-13 21:47:32 +04:00
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
2008-04-02 01:51:18 +04:00
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
2011-03-11 10:47:15 +03:00
# Are we packaging components ?
2012-08-13 21:47:32 +04:00
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 )
2012-08-13 21:50:14 +04:00
else ( )
2012-08-13 21:47:32 +04:00
set ( CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "" )
2012-08-13 21:50:14 +04:00
endif ( )
2011-03-11 10:47:15 +03:00
2012-10-24 23:37:18 +04:00
set ( WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}" )
2011-03-11 10:47:15 +03:00
# Print out some debug information if we were asked for that
2012-08-13 21:47:32 +04:00
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}" )
2012-08-13 21:50:14 +04:00
endif ( )
2007-08-08 22:18:13 +04:00
# 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:
2012-08-13 21:47:32 +04:00
#if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
# set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
2007-08-08 22:18:13 +04:00
# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
# )
2012-08-13 21:50:14 +04:00
#endif()