|
|
@@ -69,6 +69,20 @@
|
|
|
# May be set when invoking cpack in order to trace debug informations
|
|
|
# during CPack RPM run. For example you may launch CPack like this
|
|
|
# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
|
|
|
+# CPACK_RPM_USER_BINARY_SPECFILE
|
|
|
+# Mandatory : NO
|
|
|
+# Default : -
|
|
|
+# May be set by the user in order to specify a USER binary spec file
|
|
|
+# to be used by CPackRPM instead of generating the file.
|
|
|
+# The specified file will be processed by CONFIGURE_FILE( @ONLY).
|
|
|
+# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
|
|
|
+# Mandatory : NO
|
|
|
+# Default : -
|
|
|
+# If set CPack will generate a template for USER specified binary
|
|
|
+# spec file and stop with an error. For example launch CPack like this
|
|
|
+# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
|
|
|
+# The user may then use this file in order to hand-craft is own
|
|
|
+# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE.
|
|
|
|
|
|
#=============================================================================
|
|
|
# Copyright 2007-2009 Kitware, Inc.
|
|
|
@@ -255,10 +269,6 @@ IF(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:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
|
|
|
@@ -283,49 +293,52 @@ EXECUTE_PROCESS(COMMAND find -type f
|
|
|
COMMAND sed {s/\\.//}
|
|
|
WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
|
|
|
OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
|
|
|
-
|
|
|
+
|
|
|
+# The name of the final spec file to be used by rpmbuild
|
|
|
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: ${CPACK_RPM_USER_BINARY_SPECFILE}")
|
|
|
- # Note that user provided file is processed for @var replacement
|
|
|
- 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(CPACK_RPM_PACKAGE_DEBUG)
|
|
|
- MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
|
|
|
- MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
|
|
|
- MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_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 = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
|
|
- MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
|
|
|
- ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
|
|
- FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}
|
|
|
- "# -*- rpm-spec -*-
|
|
|
-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}
|
|
|
-${TMP_RPM_REQUIRES}
|
|
|
-${TMP_RPM_BUILDARCH}
|
|
|
-
|
|
|
-#p define prefix ${CMAKE_INSTALL_PREFIX}
|
|
|
-%define _rpmdir ${CPACK_RPM_DIRECTORY}
|
|
|
-%define _rpmfilename ${CPACK_RPM_FILE_NAME}
|
|
|
+
|
|
|
+# Print out some debug information if we were asked for that
|
|
|
+IF(CPACK_RPM_PACKAGE_DEBUG)
|
|
|
+ MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
|
|
|
+ MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
|
|
|
+ MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_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 = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
|
|
+ MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
|
|
|
+ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
|
|
+
|
|
|
+# USER generated spec file handling.
|
|
|
+# We should generate a spec file template:
|
|
|
+# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
|
|
|
+# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
|
|
|
+#
|
|
|
+IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
|
|
|
+ FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
|
|
|
+ "# -*- rpm-spec -*-
|
|
|
+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\@
|
|
|
+\@TMP_RPM_REQUIRES\@
|
|
|
+\@TMP_RPM_BUILDARCH\@
|
|
|
+
|
|
|
+#p 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}
|
|
|
-
|
|
|
+%define _topdir \@CPACK_RPM_DIRECTORY\@
|
|
|
+\@TMP_RPM_SPEC_INSTALL_POST\@
|
|
|
+\@CPACK_RPM_SPEC_MORE_DEFINE\@
|
|
|
+
|
|
|
%description
|
|
|
-${CPACK_RPM_PACKAGE_DESCRIPTION}
|
|
|
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
|
|
|
|
|
|
# This is a shortcutted spec file
|
|
|
# generated by CMake RPM generator
|
|
|
@@ -348,6 +361,8 @@ ${CPACK_RPM_PACKAGE_DESCRIPTION}
|
|
|
${CPACK_RPM_INSTALL_FILES}
|
|
|
|
|
|
%changelog
|
|
|
+* Wed Oct 07 2009 Erk <[email protected]>
|
|
|
+ Add user custom spec file support
|
|
|
* Sat Oct 03 2009 Kami <[email protected]>
|
|
|
Update to handle more precisely the files section
|
|
|
* Mon Oct 03 2008 Erk <[email protected]>
|
|
|
@@ -358,9 +373,28 @@ ${CPACK_RPM_INSTALL_FILES}
|
|
|
* Tue Aug 16 2007 Erk <[email protected]>
|
|
|
Generated by CPack RPM Generator and associated macros
|
|
|
")
|
|
|
+ # Stop here if we were asked to only generate a template USER spec file
|
|
|
+ # The generated file may then be used as a template by user who wants
|
|
|
+ # to customize their own spec file.
|
|
|
+ IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
|
|
|
+ MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
|
|
|
+ ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
|
|
|
+ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
|
|
|
+
|
|
|
+# After that we may either use a user provided spec file
|
|
|
+# or generate one using appropriate variables value.
|
|
|
+IF(CPACK_RPM_USER_BINARY_SPECFILE)
|
|
|
+ # User may have specified SPECFILE just use it
|
|
|
+ MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
|
|
|
+ # The user provided file is processed for @var replacement
|
|
|
+ CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
|
|
|
+ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
|
|
|
+ # No User specified spec file, will use the generated spec file
|
|
|
+ MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")
|
|
|
+ # Note the just created file is processed for @var replacement
|
|
|
+ CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
|
|
|
ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
|
|
|
|
|
|
-
|
|
|
IF(RPMBUILD_EXECUTABLE)
|
|
|
# Now call rpmbuild using the SPECFILE
|
|
|
EXECUTE_PROCESS(
|