ENH: patch from Mathieu: more entries in the debian control file
Alex
This commit is contained in:
parent
9deca5887d
commit
4ba24ce474
|
@ -1,3 +1,9 @@
|
||||||
|
|
||||||
|
# CPack script for creating Debian package
|
||||||
|
# Author: Mathieu Malaterre
|
||||||
|
#
|
||||||
|
# http://wiki.debian.org/HowToPackageForDebian
|
||||||
|
|
||||||
IF(CMAKE_BINARY_DIR)
|
IF(CMAKE_BINARY_DIR)
|
||||||
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
|
MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
|
||||||
ENDIF(CMAKE_BINARY_DIR)
|
ENDIF(CMAKE_BINARY_DIR)
|
||||||
|
@ -15,13 +21,17 @@ ENDIF(NOT AR_EXECUTABLE)
|
||||||
|
|
||||||
# Let's define the control file found in debian package:
|
# Let's define the control file found in debian package:
|
||||||
|
|
||||||
# Package:
|
# Binary package:
|
||||||
|
# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
|
||||||
|
|
||||||
|
# DEBIAN/control
|
||||||
# debian policy enforce lower case for package name
|
# debian policy enforce lower case for package name
|
||||||
|
# Package: (mandatory)
|
||||||
IF(NOT DEBIAN_PACKAGE_NAME)
|
IF(NOT DEBIAN_PACKAGE_NAME)
|
||||||
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" DEBIAN_PACKAGE_NAME)
|
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" DEBIAN_PACKAGE_NAME)
|
||||||
ENDIF(NOT DEBIAN_PACKAGE_NAME)
|
ENDIF(NOT DEBIAN_PACKAGE_NAME)
|
||||||
|
|
||||||
# Version:
|
# Version: (mandatory)
|
||||||
IF(NOT DEBIAN_PACKAGE_VERSION)
|
IF(NOT DEBIAN_PACKAGE_VERSION)
|
||||||
IF(NOT CPACK_PACKAGE_VERSION)
|
IF(NOT CPACK_PACKAGE_VERSION)
|
||||||
MESSAGE(FATAL_ERROR "Debian package requires a package version")
|
MESSAGE(FATAL_ERROR "Debian package requires a package version")
|
||||||
|
@ -29,21 +39,21 @@ IF(NOT DEBIAN_PACKAGE_VERSION)
|
||||||
SET(DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
SET(DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||||
ENDIF(NOT DEBIAN_PACKAGE_VERSION)
|
ENDIF(NOT DEBIAN_PACKAGE_VERSION)
|
||||||
|
|
||||||
# Architecture:
|
# Architecture: (mandatory)
|
||||||
IF(NOT DEBIAN_PACKAGE_ARCHITECTURE)
|
IF(NOT DEBIAN_PACKAGE_ARCHITECTURE)
|
||||||
# There is no such thing as i686 architecture on debian, you should use i386 instead
|
# There is no such thing as i686 architecture on debian, you should use i386 instead
|
||||||
# $ dpkg --print-architecture
|
# $ dpkg --print-architecture
|
||||||
SET(DEBIAN_PACKAGE_ARCHITECTURE i386)
|
SET(DEBIAN_PACKAGE_ARCHITECTURE i386)
|
||||||
ENDIF(NOT DEBIAN_PACAKGE_ARCHITECTURE)
|
ENDIF(NOT DEBIAN_PACAKGE_ARCHITECTURE)
|
||||||
|
|
||||||
|
# have a look at GET_PROPERTY(result GLOBAL ENABLED_FEATURES), this returns
|
||||||
|
# the successful FIND_PACKAGE() calls, maybe this can help
|
||||||
# Depends:
|
# Depends:
|
||||||
IF(NOT DEBIAN_PACKAGE_DEPENDS)
|
IF(NOT DEBIAN_PACKAGE_DEPENDS)
|
||||||
SET(DEBIAN_PACKAGE_DEPENDS
|
MESSAGE(STATUS "DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
|
||||||
"libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)"
|
|
||||||
)
|
|
||||||
ENDIF(NOT DEBIAN_PACKAGE_DEPENDS)
|
ENDIF(NOT DEBIAN_PACKAGE_DEPENDS)
|
||||||
|
|
||||||
# Maintainer:
|
# Maintainer: (mandatory)
|
||||||
IF(NOT DEBIAN_PACKAGE_MAINTAINER)
|
IF(NOT DEBIAN_PACKAGE_MAINTAINER)
|
||||||
IF(NOT CPACK_PACKAGE_CONTACT)
|
IF(NOT CPACK_PACKAGE_CONTACT)
|
||||||
MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or DEBIAN_PACKAGE_MAINTAINER")
|
MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or DEBIAN_PACKAGE_MAINTAINER")
|
||||||
|
@ -51,10 +61,41 @@ IF(NOT DEBIAN_PACKAGE_MAINTAINER)
|
||||||
SET(DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
SET(DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
||||||
ENDIF(NOT DEBIAN_PACKAGE_MAINTAINER)
|
ENDIF(NOT DEBIAN_PACKAGE_MAINTAINER)
|
||||||
|
|
||||||
# Description:
|
# Description: (mandatory)
|
||||||
IF(NOT DEBIAN_PACKAGE_DESCRIPTION)
|
IF(NOT DEBIAN_PACKAGE_DESCRIPTION)
|
||||||
IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||||
MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or DEBIAN_PACKAGE_DESCRIPTION")
|
MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or DEBIAN_PACKAGE_DESCRIPTION")
|
||||||
ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
|
||||||
SET(DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
SET(DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||||
ENDIF(NOT DEBIAN_PACKAGE_DESCRIPTION)
|
ENDIF(NOT DEBIAN_PACKAGE_DESCRIPTION)
|
||||||
|
|
||||||
|
# Section: (recommended)
|
||||||
|
IF(NOT DEBIAN_PACKAGE_SECTION)
|
||||||
|
SET(DEBIAN_PACKAGE_SECTION "devel")
|
||||||
|
ENDIF(NOT DEBIAN_PACKAGE_SECTION)
|
||||||
|
|
||||||
|
# Priority: (recommended)
|
||||||
|
IF(NOT DEBIAN_PACKAGE_PRIORITY)
|
||||||
|
SET(DEBIAN_PACKAGE_PRIORITY "optional")
|
||||||
|
ENDIF(NOT DEBIAN_PACKAGE_PRIORITY )
|
||||||
|
|
||||||
|
# Recommends:
|
||||||
|
# You should set: DEBIAN_PACKAGE_RECOMMENDS
|
||||||
|
|
||||||
|
# Suggests:
|
||||||
|
# You should set: DEBIAN_PACKAGE_SUGGESTS
|
||||||
|
|
||||||
|
|
||||||
|
# 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 DEBIAN_PACKAGE_BUILDS_DEPENDS)
|
||||||
|
# SET(DEBIAN_PACKAGE_BUILDS_DEPENDS
|
||||||
|
# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
|
||||||
|
# )
|
||||||
|
#ENDIF(NOT DEBIAN_PACKAGE_BUILDS_DEPENDS)
|
||||||
|
|
|
@ -58,22 +58,40 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
|
||||||
ctlfilename += "/control";
|
ctlfilename += "/control";
|
||||||
|
|
||||||
// debian policy enforce lower case for package name
|
// debian policy enforce lower case for package name
|
||||||
|
// mandatory entries:
|
||||||
std::string debian_pkg_name =
|
std::string debian_pkg_name =
|
||||||
cmsys::SystemTools::LowerCase( this->GetOption("DEBIAN_PACKAGE_NAME") );
|
cmsys::SystemTools::LowerCase( this->GetOption("DEBIAN_PACKAGE_NAME") );
|
||||||
const char* debian_pkg_version = this->GetOption("DEBIAN_PACKAGE_VERSION");
|
const char* debian_pkg_version = this->GetOption("DEBIAN_PACKAGE_VERSION");
|
||||||
|
const char* debian_pkg_section = this->GetOption("DEBIAN_PACKAGE_SECTION");
|
||||||
|
const char* debian_pkg_priority = this->GetOption("DEBIAN_PACKAGE_PRIORITY");
|
||||||
const char* debian_pkg_arch = this->GetOption("DEBIAN_PACKAGE_ARCHITECTURE");
|
const char* debian_pkg_arch = this->GetOption("DEBIAN_PACKAGE_ARCHITECTURE");
|
||||||
const char* debian_pkg_dep = this->GetOption("DEBIAN_PACKAGE_DEPENDS");
|
|
||||||
const char* maintainer = this->GetOption("DEBIAN_PACKAGE_MAINTAINER");
|
const char* maintainer = this->GetOption("DEBIAN_PACKAGE_MAINTAINER");
|
||||||
const char* desc = this->GetOption("DEBIAN_PACKAGE_DESCRIPTION");
|
const char* desc = this->GetOption("DEBIAN_PACKAGE_DESCRIPTION");
|
||||||
|
|
||||||
|
// optional entries
|
||||||
|
const char* debian_pkg_dep = this->GetOption("DEBIAN_PACKAGE_DEPENDS");
|
||||||
|
const char* debian_pkg_rec = this->GetOption("DEBIAN_PACKAGE_RECOMMENDS");
|
||||||
|
const char* debian_pkg_sug = this->GetOption("DEBIAN_PACKAGE_SUGGESTS");
|
||||||
|
|
||||||
{ // the scope is needed for cmGeneratedFileStream
|
{ // the scope is needed for cmGeneratedFileStream
|
||||||
cmGeneratedFileStream out(ctlfilename.c_str());
|
cmGeneratedFileStream out(ctlfilename.c_str());
|
||||||
out << "Package: " << debian_pkg_name << "\n";
|
out << "Package: " << debian_pkg_name << "\n";
|
||||||
out << "Version: " << debian_pkg_version << "\n";
|
out << "Version: " << debian_pkg_version << "\n";
|
||||||
out << "Section: devel\n";
|
out << "Section: " << debian_pkg_section << "\n";
|
||||||
out << "Priority: optional\n";
|
out << "Priority: " << debian_pkg_priority << "\n";
|
||||||
out << "Architecture: " << debian_pkg_arch << "\n";
|
out << "Architecture: " << debian_pkg_arch << "\n";
|
||||||
out << "Depends: " << debian_pkg_dep << "\n";
|
if(debian_pkg_dep)
|
||||||
|
{
|
||||||
|
out << "Depends: " << debian_pkg_dep << "\n";
|
||||||
|
}
|
||||||
|
if(debian_pkg_rec)
|
||||||
|
{
|
||||||
|
out << "Recommends: " << debian_pkg_rec << "\n";
|
||||||
|
}
|
||||||
|
if(debian_pkg_sug)
|
||||||
|
{
|
||||||
|
out << "Suggests: " << debian_pkg_sug << "\n";
|
||||||
|
}
|
||||||
out << "Maintainer: " << maintainer << "\n";
|
out << "Maintainer: " << maintainer << "\n";
|
||||||
out << "Description: " << desc << "\n";
|
out << "Description: " << desc << "\n";
|
||||||
out << " " << debian_pkg_name << " was packaged by CMake.\n";
|
out << " " << debian_pkg_name << " was packaged by CMake.\n";
|
||||||
|
@ -93,6 +111,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
|
||||||
tmpFile += "/Deb.log";
|
tmpFile += "/Deb.log";
|
||||||
cmGeneratedFileStream ofs(tmpFile.c_str());
|
cmGeneratedFileStream ofs(tmpFile.c_str());
|
||||||
ofs << "# Run command: " << cmd.c_str() << std::endl
|
ofs << "# Run command: " << cmd.c_str() << std::endl
|
||||||
|
<< "# Working directory: " << toplevel << std::endl
|
||||||
<< "# Output:" << std::endl
|
<< "# Output:" << std::endl
|
||||||
<< output.c_str() << std::endl;
|
<< output.c_str() << std::endl;
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: "
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: "
|
||||||
|
@ -142,6 +161,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
|
||||||
tmpFile += "/Deb.log";
|
tmpFile += "/Deb.log";
|
||||||
cmGeneratedFileStream ofs(tmpFile.c_str());
|
cmGeneratedFileStream ofs(tmpFile.c_str());
|
||||||
ofs << "# Run command: " << cmd.c_str() << std::endl
|
ofs << "# Run command: " << cmd.c_str() << std::endl
|
||||||
|
<< "# Working directory: " << toplevel << std::endl
|
||||||
<< "# Output:" << std::endl
|
<< "# Output:" << std::endl
|
||||||
<< output.c_str() << std::endl;
|
<< output.c_str() << std::endl;
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: "
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: "
|
||||||
|
|
Loading…
Reference in New Issue