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)
|
|
|
|
MESSAGE(FATAL_ERROR "Can not find dpkg in your path.")
|
|
|
|
ENDIF(NOT DPKG_CMD)
|
|
|
|
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
|
2008-03-28 18:47:24 +03:00
|
|
|
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
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
|
|
|
|
|
|
|
|
|
|
|
# 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)
|