diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-09-19 21:45:37 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-09-19 21:45:37 (GMT) |
commit | d07fefc9ee147fd4ea6ca5627291f81101950048 (patch) | |
tree | 9b86401e3882ad6b5bd348f47f1c7c42326e01d6 /Modules/CPackRPM.cmake | |
parent | b56d755f6e5600f67275f572fa03953da3337498 (diff) | |
download | CMake-d07fefc9ee147fd4ea6ca5627291f81101950048.zip CMake-d07fefc9ee147fd4ea6ca5627291f81101950048.tar.gz CMake-d07fefc9ee147fd4ea6ca5627291f81101950048.tar.bz2 |
BUG: 7435 fixes to add optional post-install
Diffstat (limited to 'Modules/CPackRPM.cmake')
-rw-r--r-- | Modules/CPackRPM.cmake | 69 |
1 files changed, 51 insertions, 18 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 3160a4a..c9985da 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -25,6 +25,11 @@ IF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") MESSAGE(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") ENDIF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") +IF(NOT CPACK_SET_DESTDIR) + MESSAGE("CPackRPM:Warning: You did not set CPACK_SET_DESTDIR to ON") + MESSAGE("CPackRPM:Warning: this will make CPackRPM fail if you have installed files with absolute path") +ENDIF(NOT CPACK_SET_DESTDIR) + # If rpmbuild is found # we try to discover alien since we may be on non RPM distro like Debian. # In this case we may try to to use more advanced features @@ -68,11 +73,14 @@ IF(NOT CPACK_RPM_PACKAGE_VERSION) ENDIF(NOT CPACK_RPM_PACKAGE_VERSION) # 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(CPACK_RPM_PACKAGE_ARCHITECTURE i386) -ENDIF(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) +IF(CPACK_RPM_PACKAGE_ARCHITECTURE) + SET(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}") + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) +ELSE(CPACK_RPM_PACKAGE_ARCHITECTURE) + SET(TMP_RPM_BUILDARCH "") +ENDIF(CPACK_RPM_PACKAGE_ARCHITECTURE) # CPACK_RPM_PACKAGE_RELEASE # The RPM release is the numbering of the RPM package ITSELF @@ -106,8 +114,7 @@ IF(NOT CPACK_RPM_PACKAGE_VENDOR) ENDIF(NOT CPACK_RPM_PACKAGE_VENDOR) # CPACK_RPM_PACKAGE_SOURCE -# The name of the source tarball in case we generate -# a source RPM +# The name of the source tarball in case we generate a source RPM # CPACK_RPM_PACKAGE_DESCRIPTION # The variable content may be either @@ -124,13 +131,29 @@ IF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE) ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) +# CPACK_RPM_SPEC_INSTALL_POST +# May be used to define a RPM post intallation script +# for example setting it to "/bin/true" may prevent +# rpmbuild from stripping binaries. +IF(CPACK_RPM_SPEC_INSTALL_POST) + SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") +ENDIF(CPACK_RPM_SPEC_INSTALL_POST) + +# CPACK_RPM_SPEC_MORE_DEFINE +# This is a generated spec rpm file spaceholder +IF(CPACK_RPM_SPEC_MORE_DEFINE) + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) +ENDIF(CPACK_RPM_SPEC_MORE_DEFINE) + # 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(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") -MESSAGE(STATUS "CPackRPM:: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") +MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") # Prepare RPM build tree FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) FILE(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) @@ -157,15 +180,16 @@ IF(CPACK_RPM_USER_BINARY_SPECFILE) ELSE(CPACK_RPM_USER_BINARY_SPECFILE) # No User specified spec file generate a valid one using var values 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:: 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}") + MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${PACK_TEMPORARY_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") + MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${PACK_PACKAGE_INSTALL_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") + MESSAGE("CPackRPM:Debug: CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") ENDIF(CPACK_RPM_PACKAGE_DEBUG) FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE} "# -*- rpm-spec -*- @@ -177,12 +201,15 @@ Release: ${CPACK_RPM_PACKAGE_RELEASE} License: ${CPACK_RPM_PACKAGE_LICENSE} Group: ${CPACK_RPM_PACKAGE_GROUP} Vendor: ${CPACK_RPM_PACKAGE_VENDOR} +${TMP_RPM_BUILDARCH} #%define prefix ${CMAKE_INSTALL_PREFIX} %define _rpmdir ${CPACK_RPM_DIRECTORY} %define _rpmfilename ${CPACK_RPM_FILE_NAME} %define _unpackaged_files_terminate_build 0 %define _topdir ${CPACK_RPM_DIRECTORY} +${TMP_RPM_SPEC_INSTALL_POST} +${CPACK_RPM_SPEC_MORE_DEFINE} %description ${CPACK_RPM_PACKAGE_DESCRIPTION} @@ -206,10 +233,11 @@ ${CPACK_RPM_PACKAGE_DESCRIPTION} /* %changelog +* Mon Aug 25 2008 Erk <eric.noulard@gmail.com> + Update generator to handle optional post-install * Tue Aug 16 2007 Erk <eric.noulard@gmail.com> Generated by CPack RPM Generator and associated macros ") - ENDIF(CPACK_RPM_USER_BINARY_SPECFILE) @@ -220,6 +248,11 @@ IF(RPMBUILD_EXECUTABLE) WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err" OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ") + MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err") + MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) ELSE(RPMBUILD_EXECUTABLE) IF(ALIEN_EXECUTABLE) MESSAGE(FATAL_ERROR "RPM packaging through alien not done (yet)") |