CPackRPM:: Support USER supplied spec files (bug 9679)
Eric
This commit is contained in:
parent
f7899c7445
commit
28f54d0b85
|
@ -69,6 +69,20 @@
|
||||||
# May be set when invoking cpack in order to trace debug informations
|
# May be set when invoking cpack in order to trace debug informations
|
||||||
# during CPack RPM run. For example you may launch CPack like this
|
# during CPack RPM run. For example you may launch CPack like this
|
||||||
# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
|
# 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.
|
# Copyright 2007-2009 Kitware, Inc.
|
||||||
|
@ -255,10 +269,6 @@ IF(CPACK_RPM_SPEC_MORE_DEFINE)
|
||||||
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
||||||
ENDIF(CPACK_RPM_SPEC_MORE_DEFINE)
|
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
|
# Now we may create the RPM build tree structure
|
||||||
SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
|
SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
|
||||||
MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
|
MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
|
||||||
|
@ -283,49 +293,52 @@ EXECUTE_PROCESS(COMMAND find -type f
|
||||||
COMMAND sed {s/\\.//}
|
COMMAND sed {s/\\.//}
|
||||||
WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
|
WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
|
||||||
OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
|
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")
|
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
|
# Print out some debug information if we were asked for that
|
||||||
MESSAGE("CPackRPM: Will use user specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
|
IF(CPACK_RPM_PACKAGE_DEBUG)
|
||||||
# Note that user provided file is processed for @var replacement
|
MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
|
||||||
CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
|
MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
|
||||||
ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
|
MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
|
||||||
# No User specified spec file generate a valid one using var values
|
MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
|
||||||
IF(CPACK_RPM_PACKAGE_DEBUG)
|
MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
|
MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
|
MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
|
MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
|
MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
|
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
|
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
|
# USER generated spec file handling.
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
# We should generate a spec file template:
|
||||||
MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
|
# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
|
||||||
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
|
||||||
FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}
|
#
|
||||||
"# -*- rpm-spec -*-
|
IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
|
||||||
Buildroot: ${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}
|
FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
|
||||||
Summary: ${CPACK_RPM_PACKAGE_SUMMARY}
|
"# -*- rpm-spec -*-
|
||||||
Name: ${CPACK_RPM_PACKAGE_NAME}
|
Buildroot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@
|
||||||
Version: ${CPACK_RPM_PACKAGE_VERSION}
|
Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
|
||||||
Release: ${CPACK_RPM_PACKAGE_RELEASE}
|
Name: \@CPACK_RPM_PACKAGE_NAME\@
|
||||||
License: ${CPACK_RPM_PACKAGE_LICENSE}
|
Version: \@CPACK_RPM_PACKAGE_VERSION\@
|
||||||
Group: ${CPACK_RPM_PACKAGE_GROUP}
|
Release: \@CPACK_RPM_PACKAGE_RELEASE\@
|
||||||
Vendor: ${CPACK_RPM_PACKAGE_VENDOR}
|
License: \@CPACK_RPM_PACKAGE_LICENSE\@
|
||||||
${TMP_RPM_REQUIRES}
|
Group: \@CPACK_RPM_PACKAGE_GROUP\@
|
||||||
${TMP_RPM_BUILDARCH}
|
Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
|
||||||
|
\@TMP_RPM_REQUIRES\@
|
||||||
#p define prefix ${CMAKE_INSTALL_PREFIX}
|
\@TMP_RPM_BUILDARCH\@
|
||||||
%define _rpmdir ${CPACK_RPM_DIRECTORY}
|
|
||||||
%define _rpmfilename ${CPACK_RPM_FILE_NAME}
|
#p define prefix \@CMAKE_INSTALL_PREFIX\@
|
||||||
|
%define _rpmdir \@CPACK_RPM_DIRECTORY\@
|
||||||
|
%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
|
||||||
%define _unpackaged_files_terminate_build 0
|
%define _unpackaged_files_terminate_build 0
|
||||||
%define _topdir ${CPACK_RPM_DIRECTORY}
|
%define _topdir \@CPACK_RPM_DIRECTORY\@
|
||||||
${TMP_RPM_SPEC_INSTALL_POST}
|
\@TMP_RPM_SPEC_INSTALL_POST\@
|
||||||
${CPACK_RPM_SPEC_MORE_DEFINE}
|
\@CPACK_RPM_SPEC_MORE_DEFINE\@
|
||||||
|
|
||||||
%description
|
%description
|
||||||
${CPACK_RPM_PACKAGE_DESCRIPTION}
|
\@CPACK_RPM_PACKAGE_DESCRIPTION\@
|
||||||
|
|
||||||
# This is a shortcutted spec file
|
# This is a shortcutted spec file
|
||||||
# generated by CMake RPM generator
|
# generated by CMake RPM generator
|
||||||
|
@ -348,6 +361,8 @@ ${CPACK_RPM_PACKAGE_DESCRIPTION}
|
||||||
${CPACK_RPM_INSTALL_FILES}
|
${CPACK_RPM_INSTALL_FILES}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 07 2009 Erk <eric.noulard@gmail.com>
|
||||||
|
Add user custom spec file support
|
||||||
* Sat Oct 03 2009 Kami <cmoidavid@gmail.com>
|
* Sat Oct 03 2009 Kami <cmoidavid@gmail.com>
|
||||||
Update to handle more precisely the files section
|
Update to handle more precisely the files section
|
||||||
* Mon Oct 03 2008 Erk <eric.noulard@gmail.com>
|
* Mon Oct 03 2008 Erk <eric.noulard@gmail.com>
|
||||||
|
@ -358,8 +373,27 @@ ${CPACK_RPM_INSTALL_FILES}
|
||||||
* Tue Aug 16 2007 Erk <eric.noulard@gmail.com>
|
* Tue Aug 16 2007 Erk <eric.noulard@gmail.com>
|
||||||
Generated by CPack RPM Generator and associated macros
|
Generated by CPack RPM Generator and associated macros
|
||||||
")
|
")
|
||||||
ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
|
# 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)
|
IF(RPMBUILD_EXECUTABLE)
|
||||||
# Now call rpmbuild using the SPECFILE
|
# Now call rpmbuild using the SPECFILE
|
||||||
|
|
Loading…
Reference in New Issue