summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-07-13 18:54:09 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-07-13 18:54:09 (GMT)
commit36f82f06b7617dde87f29a0e1a2ac732190f1087 (patch)
tree3681ba9663e58981e884ea93d60004a78c064883
parentedbaf90a028b3f0b1ed4fa5116c8d4995d3a60d5 (diff)
parent604c3698c1ba517b83b4e6142bf95f9562fed921 (diff)
downloadCMake-36f82f06b7617dde87f29a0e1a2ac732190f1087.zip
CMake-36f82f06b7617dde87f29a0e1a2ac732190f1087.tar.gz
CMake-36f82f06b7617dde87f29a0e1a2ac732190f1087.tar.bz2
Merge topic 'CPackRPM-RelocatablePackage'
604c369 CPackRPM:: [partially] support relocatable package
-rw-r--r--Modules/CPackRPM.cmake27
1 files changed, 25 insertions, 2 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 50fe510..7ab1181 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -81,6 +81,18 @@
# Mandatory : NO
# Default : -
# May be used to set RPM packages that are obsoleted by this one.
+# CPACK_RPM_PACKAGE_RELOCATABLE
+# Mandatory : NO
+# Default : -
+# If this variable is set to TRUE or ON CPackRPM will try
+# to build a relocatable RPM package. A relocatable RPM may
+# be installed using rpm --prefix or --relocate in order to
+# install it at an alternate place see rpm(8).
+# Note that currently this may fail if the package contains
+# files installed with absolute path or CPACK_SET_DESTDIR is set to ON.
+# If CPACK_SET_DESTDIR is set then you will get a warning message
+# but if there is file installed with absolute path you'll get
+# unexpected behavior.
# CPACK_RPM_SPEC_INSTALL_POST
# Mandatory : NO
# Default : -
@@ -319,8 +331,19 @@ ELSE(CPACK_RPM_COMPRESSION_TYPE)
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")
ENDIF(CPACK_RPM_COMPRESSION_TYPE)
+if(CPACK_RPM_PACKAGE_RELOCATABLE)
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Trying to build a relocatable package")
+ endif(CPACK_RPM_PACKAGE_DEBUG)
+ if(CPACK_SET_DESTDIR)
+ message(SEND_ERROR "CPackRPM:Warning: CPACK_SET_DESTDIR is set while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.")
+ else(CPACK_SET_DESTDIR)
+ set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX})
+ endif(CPACK_SET_DESTDIR)
+endif(CPACK_RPM_PACKAGE_RELOCATABLE)
+
# check if additional fields for RPM spec header are given
-FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES)
+FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX)
IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
@@ -477,8 +500,8 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
\@TMP_RPM_PROVIDES\@
\@TMP_RPM_OBSOLETES\@
\@TMP_RPM_BUILDARCH\@
+\@TMP_RPM_PREFIX\@
-#p define prefix \@CMAKE_INSTALL_PREFIX\@
%define _rpmdir \@CPACK_RPM_DIRECTORY\@
%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
%define _unpackaged_files_terminate_build 0