diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-10-12 23:33:41 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-10-12 23:33:41 (GMT) |
commit | 6f2a997781d3a55c474c6992398e22dca5390b92 (patch) | |
tree | 9f2ab7eda3d189c62cd81d95c6ce345a4d2bb1da | |
parent | 2458b07464fad0283edc74daf6c75fd2380e6c62 (diff) | |
download | CMake-6f2a997781d3a55c474c6992398e22dca5390b92.zip CMake-6f2a997781d3a55c474c6992398e22dca5390b92.tar.gz CMake-6f2a997781d3a55c474c6992398e22dca5390b92.tar.bz2 |
BUG: fix for bug 5878
-rw-r--r-- | Modules/CPackRPM.cmake | 158 |
1 files changed, 84 insertions, 74 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index ad333be..c6335b6 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1,5 +1,9 @@ # CPack script for creating RPM package -# Author: Eric Noulard with the help of Alexander Neundorf +# Author: Eric Noulard with the help of Alexander Neundorf. +# All variables used by CPackRPM begins with CPACK_RPM_ prefix +# +# Here comes the list of used variables: +# IF(CMAKE_BINARY_DIR) MESSAGE(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") @@ -40,37 +44,37 @@ ENDIF(ALIEN_EXECUTABLE) # The variables which may/should be defined are: # -# RPM_PACKAGE_SUMMARY (mandatory) -IF(NOT RPM_PACKAGE_SUMMARY) +# CPACK_RPM_PACKAGE_SUMMARY (mandatory) +IF(NOT CPACK_RPM_PACKAGE_SUMMARY) # if neither var is defined lets use the name as summary IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - STRING(TOLOWER "${CPACK_PACKAGE_NAME}" RPM_PACKAGE_SUMMARY) + STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) ELSE(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - SET(RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) -ENDIF(NOT RPM_PACKAGE_SUMMARY) +ENDIF(NOT CPACK_RPM_PACKAGE_SUMMARY) -# RPM_PACKAGE_NAME (mandatory) -IF(NOT RPM_PACKAGE_NAME) - STRING(TOLOWER "${CPACK_PACKAGE_NAME}" RPM_PACKAGE_NAME) -ENDIF(NOT RPM_PACKAGE_NAME) +# CPACK_RPM_PACKAGE_NAME (mandatory) +IF(NOT CPACK_RPM_PACKAGE_NAME) + STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) +ENDIF(NOT CPACK_RPM_PACKAGE_NAME) -# RPM_PACKAGE_VERSION (mandatory) -IF(NOT RPM_PACKAGE_VERSION) +# CPACK_RPM_PACKAGE_VERSION (mandatory) +IF(NOT CPACK_RPM_PACKAGE_VERSION) IF(NOT CPACK_PACKAGE_VERSION) MESSAGE(FATAL_ERROR "RPM package requires a package version") ENDIF(NOT CPACK_PACKAGE_VERSION) - SET(RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) -ENDIF(NOT RPM_PACKAGE_VERSION) + SET(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) +ENDIF(NOT CPACK_RPM_PACKAGE_VERSION) -# RPM_PACKAGE_ARCHITECTURE (optional) -IF(NOT RPM_PACKAGE_ARCHITECTURE) +# CPACK_RPM_PACKAGE_ARCHITECTURE (optional) +IF(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) # FIXME This should be obtained through 'arch' command # but is it --really necessary-- ? - SET(RPM_PACKAGE_ARCHITECTURE i386) -ENDIF(NOT RPM_PACKAGE_ARCHITECTURE) + SET(CPACK_RPM_PACKAGE_ARCHITECTURE i386) +ENDIF(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) -# RPM_PACKAGE_RELEASE +# CPACK_RPM_PACKAGE_RELEASE # The RPM release is the numbering of the RPM package ITSELF # this is the version of the PACKAGING and NOT the version # of the CONTENT of the package. @@ -78,93 +82,99 @@ ENDIF(NOT RPM_PACKAGE_ARCHITECTURE) # without changing the version of the packaged software. # This is the case when the packaging is buggy (not) the software :=) # If not set, 1 is a good candidate -IF(NOT RPM_PACKAGE_RELEASE) - SET(RPM_PACKAGE_RELEASE 1) -ENDIF(NOT RPM_PACKAGE_RELEASE) - -# RPM_PACKAGE_LICENSE -IF(NOT RPM_PACKAGE_LICENSE) - SET(RPM_PACKAGE_LICENSE "unknown") -ENDIF(NOT RPM_PACKAGE_LICENSE) - -# RPM_PACKAGE_GROUP -IF(NOT RPM_PACKAGE_GROUP) - SET(RPM_PACKAGE_GROUP "unknown") -ENDIF(NOT RPM_PACKAGE_GROUP) - -# RPM_PACKAGE_SOURCE +IF(NOT CPACK_RPM_PACKAGE_RELEASE) + SET(CPACK_RPM_PACKAGE_RELEASE 1) +ENDIF(NOT CPACK_RPM_PACKAGE_RELEASE) + +# CPACK_RPM_PACKAGE_LICENSE +IF(NOT CPACK_RPM_PACKAGE_LICENSE) + SET(CPACK_RPM_PACKAGE_LICENSE "unknown") +ENDIF(NOT CPACK_RPM_PACKAGE_LICENSE) + +# CPACK_RPM_PACKAGE_GROUP +IF(NOT CPACK_RPM_PACKAGE_GROUP) + SET(CPACK_RPM_PACKAGE_GROUP "unknown") +ENDIF(NOT CPACK_RPM_PACKAGE_GROUP) + +# CPACK_RPM_PACKAGE_VENDOR +IF(NOT CPACK_RPM_PACKAGE_VENDOR) + SET(CPACK_RPM_PACKAGE_VENDOR "unknown") +ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR) + +# CPACK_RPM_PACKAGE_SOURCE # The name of the source tarball in case we generate # a source RPM -# RPM_PACKAGE_DESCRIPTION +# CPACK_RPM_PACKAGE_DESCRIPTION # FIXME may be found in CPACK_PACKAGE_DESCRIPTION_FILE -# RPM_USER_BINARY_SPECFILE +# CPACK_RPM_USER_BINARY_SPECFILE # FIXME when this is set then CPack should us the # user provided file. # Now we may create the RPM build tree structure -SET(RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") -MESSAGE(STATUS "CPackRPM:: Using RPM_ROOTDIR=${RPM_ROOTDIR}") +SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") +MESSAGE(STATUS "CPackRPM:: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") # Prepare RPM build tree -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}) -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/tmp) -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/BUILD) -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/RPMS) -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/SOURCES) -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/SPECS) -FILE(MAKE_DIRECTORY ${RPM_ROOTDIR}/SRPMS) - -#SET(RPM_FILE_NAME "${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}-${RPM_PACKAGE_ARCHITECTURE}.rpm") -SET(RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) +FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) + +#SET(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") +SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") # it seems rpmbuild can't handle spaces in the path # neither escaping (as below) nor putting quotes around the path seem to help -#STRING(REGEX REPLACE " " "\\\\ " RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") -SET(RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") +#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") +SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") -SET(RPM_BINARY_SPECFILE "${RPM_ROOTDIR}/SPECS/${RPM_PACKAGE_NAME}.spec") -IF(RPM_USER_BINARY_SPECFILE) +SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") +IF(CPACK_RPM_USER_BINARY_SPECFILE) # User may have specified SPECFILE just use it - MESSAGE("CPackRPM: Will use user specified spec file: ${RPM_USER_BINARY_SPECFILE}") + MESSAGE("CPackRPM: Will use user specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") # Note that user provided file is processed for @var replacement - CONFIGURE_FILE(${RPM_USER_BINARY_SPECFILE} ${RPM_BINARY_SPECFILE} @ONLY) -ELSE(RPM_USER_BINARY_SPECFILE) + CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) +ELSE(CPACK_RPM_USER_BINARY_SPECFILE) # No User specified spec file generate a valid one using var values - IF(RPM_PACKAGE_DEBUG) + IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") MESSAGE("CPackRPM:: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") MESSAGE("CPackRPM:: CPACK_TEMPORARY_DIRECTORY= ${PACK_TEMPORARY_DIRECTORY}") MESSAGE("CPackRPM:: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") MESSAGE("CPackRPM:: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") MESSAGE("CPackRPM:: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - MESSAGE("CPackRPM:: RPM_BINARY_SPECFILE = ${RPM_BINARY_SPECFILE}") + MESSAGE("CPackRPM:: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") MESSAGE("CPackRPM:: CPACK_PACKAGE_INSTALL_DIRECTORY = ${PACK_PACKAGE_INSTALL_DIRECTORY}") MESSAGE("CPackRPM ::CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") - ENDIF(RPM_PACKAGE_DEBUG) - FILE(WRITE ${RPM_BINARY_SPECFILE} + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE} "# -*- rpm-spec -*- -Buildroot: ${RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} -Summary: ${RPM_PACKAGE_SUMMARY} -Name: ${RPM_PACKAGE_NAME} -Version: ${RPM_PACKAGE_VERSION} -Release: ${RPM_PACKAGE_RELEASE} -License: ${RPM_PACKAGE_LICENSE} -Group: ${RPM_PACKAGE_LICENSE} +Buildroot: ${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} +Summary: ${CPACK_RPM_PACKAGE_SUMMARY} +Name: ${CPACK_RPM_PACKAGE_NAME} +Version: ${CPACK_RPM_PACKAGE_VERSION} +Release: ${CPACK_RPM_PACKAGE_RELEASE} +License: ${CPACK_RPM_PACKAGE_LICENSE} +Group: ${CPACK_RPM_PACKAGE_GROUP} +Vendor: ${CPACK_RPM_PACKAGE_VENDOR} #%define prefix ${CMAKE_INSTALL_PREFIX} -%define _rpmdir ${RPM_DIRECTORY} -%define _rpmfilename ${RPM_FILE_NAME} +%define _rpmdir ${CPACK_RPM_DIRECTORY} +%define _rpmfilename ${CPACK_RPM_FILE_NAME} %define _unpackaged_files_terminate_build 0 -%define _topdir ${RPM_DIRECTORY} +%define _topdir ${CPACK_RPM_DIRECTORY} %description -${RPM_PACKAGE_NAME} : will come soon -with the value of RPM_PACKAGE_DESCRIPTION +${CPACK_RPM_PACKAGE_NAME} : will come soon +with the value of CPACK_RPM_PACKAGE_DESCRIPTION or the content of CPACK_PACKAGE_DESCRIPTION_FILE *** -${RPM_PACKAGE_DESCRIPTION} +${CPACK_RPM_PACKAGE_DESCRIPTION} *** %prep @@ -186,13 +196,13 @@ ${RPM_PACKAGE_DESCRIPTION} Generated by CPack RPM Generator and associated macros ") -ENDIF(RPM_USER_BINARY_SPECFILE) +ENDIF(CPACK_RPM_USER_BINARY_SPECFILE) IF(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE EXECUTE_PROCESS( - COMMAND "${RPMBUILD_EXECUTABLE}" -bb "${RPM_BINARY_SPECFILE}" + COMMAND "${RPMBUILD_EXECUTABLE}" -bb "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err" OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") |