2009-10-30 19:06:53 +03:00
|
|
|
# - The builtin (binary) CPack Deb generator (Unix only)
|
|
|
|
# CPackDeb may be used to create Deb package using CPack.
|
|
|
|
# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
|
|
|
|
# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration
|
|
|
|
#
|
|
|
|
# However CPackRPM has specific features which are controlled by
|
|
|
|
# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on
|
|
|
|
# the wiki:
|
|
|
|
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
|
|
|
|
# However as a handy reminder here comes the list of specific variables:
|
|
|
|
#
|
|
|
|
# CPACK_DEBIAN_PACKAGE_NAME
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : CPACK_PACKAGE_NAME (lower case)
|
|
|
|
# The debian package summary
|
|
|
|
# CPACK_DEBIAN_PACKAGE_VERSION
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : CPACK_PACKAGE_VERSION
|
|
|
|
# The debian package version
|
|
|
|
# CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : Output of dpkg --print-architecture or i386
|
|
|
|
# The debian package architecture
|
|
|
|
# CPACK_DEBIAN_PACKAGE_DEPENDS
|
|
|
|
# Mandatory : NO
|
|
|
|
# Default : -
|
|
|
|
# May be used to set deb dependencies.
|
|
|
|
# CPACK_DEBIAN_PACKAGE_MAINTAINER
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : CPACK_PACKAGE_CONTACT
|
|
|
|
# The debian package maintainer
|
|
|
|
# CPACK_DEBIAN_PACKAGE_DESCRIPTION
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
|
|
|
# The debian package description
|
|
|
|
# CPACK_DEBIAN_PACKAGE_SECTION
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : 'devel'
|
|
|
|
# The debian package section
|
|
|
|
# CPACK_DEBIAN_PACKAGE_PRIORITY
|
|
|
|
# Mandatory : YES
|
|
|
|
# Default : 'optional'
|
|
|
|
# The debian package priority
|
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.
|
|
|
|
#=============================================================================
|
|
|
|
# (To distributed this file outside of CMake, substitute the full
|
|
|
|
# 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
|
|
|
|
|
2007-07-25 18:57:33 +04:00
|
|
|
IF(CMAKE_BINARY_DIR)
|
|
|
|
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
|
|
|
|
ENDIF(CMAKE_BINARY_DIR)
|
|
|
|
|
|
|
|
IF(NOT UNIX)
|
|
|
|
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
|
|
|
|
ENDIF(NOT UNIX)
|
|
|
|
|
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)
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_NAME)
|
|
|
|
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME)
|
2007-07-27 16:59:59 +04:00
|
|
|
|
2007-08-08 22:18:13 +04:00
|
|
|
# Version: (mandatory)
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
|
2007-07-27 16:59:59 +04:00
|
|
|
IF(NOT CPACK_PACKAGE_VERSION)
|
2007-08-03 23:26:30 +04:00
|
|
|
MESSAGE(FATAL_ERROR "Debian package requires a package version")
|
2007-07-27 16:59:59 +04:00
|
|
|
ENDIF(NOT CPACK_PACKAGE_VERSION)
|
2007-10-25 21:26:54 +04:00
|
|
|
SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
|
2007-07-27 16:59:59 +04:00
|
|
|
|
2007-08-08 22:18:13 +04:00
|
|
|
# Architecture: (mandatory)
|
2007-10-25 21:26:54 +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
|
2008-03-28 18:49:48 +03:00
|
|
|
FIND_PROGRAM(DPKG_CMD dpkg)
|
|
|
|
IF(NOT DPKG_CMD)
|
2008-03-29 02:09:39 +03:00
|
|
|
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
|
2008-03-28 21:08:07 +03:00
|
|
|
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
|
2008-03-28 18:49:48 +03:00
|
|
|
ENDIF(NOT DPKG_CMD)
|
|
|
|
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
|
2008-04-01 17:56:41 +04:00
|
|
|
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2007-10-25 21:26:54 +04:00
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
2007-07-27 16:59:59 +04:00
|
|
|
|
2008-01-18 01:19:13 +03: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'
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
|
|
|
|
MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
|
2007-07-27 16:59:59 +04:00
|
|
|
|
2007-08-08 22:18:13 +04:00
|
|
|
# Maintainer: (mandatory)
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
|
2007-07-27 16:59:59 +04:00
|
|
|
IF(NOT CPACK_PACKAGE_CONTACT)
|
2007-10-25 21:26:54 +04:00
|
|
|
MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
|
2007-07-27 16:59:59 +04:00
|
|
|
ENDIF(NOT CPACK_PACKAGE_CONTACT)
|
2007-10-25 21:26:54 +04:00
|
|
|
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
|
2007-07-27 16:59:59 +04:00
|
|
|
|
2007-08-08 22:18:13 +04:00
|
|
|
# Description: (mandatory)
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
2007-07-27 16:59:59 +04:00
|
|
|
IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
2007-10-25 21:26:54 +04:00
|
|
|
MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
|
2007-07-27 16:59:59 +04:00
|
|
|
ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
2007-10-25 21:26:54 +04:00
|
|
|
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
2007-08-08 22:18:13 +04:00
|
|
|
|
|
|
|
# Section: (recommended)
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
|
|
|
|
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
|
2007-08-08 22:18:13 +04:00
|
|
|
|
|
|
|
# Priority: (recommended)
|
2007-10-25 21:26:54 +04:00
|
|
|
IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
|
|
|
|
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
|
|
|
ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
|
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)
|
|
|
|
# Typical examples are:
|
|
|
|
# - conffiles
|
|
|
|
# - postinst
|
|
|
|
# - postrm
|
|
|
|
# - prerm"
|
|
|
|
# Usage:
|
|
|
|
# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
|
|
|
# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
|
|
|
|
|
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:
|
2007-10-25 21:26:54 +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"
|
|
|
|
# )
|
2007-10-25 21:26:54 +04:00
|
|
|
#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
|