目前,我正在使用以下CMakeLists.txt文件构建名为 firstrpm 的RPM。我将spec文件扩展为具有%package
指令的子包,现在我想扩展CMakeLists以产生两个rpms(比如firstrpm和secondrpm)。我如何扩展它以便能够使用不同的包名称制作具有单个构建的第二个RPM?
set(CPACK_PACKAGE_RELEASE_VERSION ${PROJECT_VERSION_RELEASE})
set(CPACK_PACKAGE_MINOR_VERSION ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_SERVICE_PACK ${PROJECT_VERSION_SERVICE_PACK})
set(CPACK_PACKAGE_BUILD ${PROJECT_VERSION_BUILD})
set(CPACK_SPEC_FILE_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_NAME "firstrpm")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_RELEASE_VERSION}.${CPACK_PACKAGE_MINOR_VERSION}.${CPACK_PACKAGE_SERVICE_PACK}-${CPACK_PACKAGE_BUILD}.${CMAKE_SYSTEM_PROCESSOR}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${CPACK_PACKAGE_NAME}.spec.in" "${CPACK_SPEC_FILE_DIR}/${CPACK_PACKAGE_NAME}.spec" @ONLY IMMEDIATE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${CPACK_PACKAGE_NAME}-devel.spec.in" "${CPACK_SPEC_FILE_DIR}/${CPACK_PACKAGE_NAME}-devel.spec" @ONLY IMMEDIATE)
set(CPACK_RPM_USER_BINARY_SPECFILE "${CPACK_SPEC_FILE_DIR}/${CPACK_PACKAGE_NAME}.spec")
set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CMAKE_BINARY_DIR}/_CPack_Packages/Linux/RPM/RPMS/${CMAKE_SYSTEM_PROCESSOR}/${CPACK_PACKAGE_FILE_NAME}.rpm")
include(CPack)
答案 0 :(得分:0)
来自一个源包的第二个二进制包称为“子包”。您只需在spec文件(或spec.in)中添加几行。参见:
http://ftp.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html
并且您不手动创建-devel子包。除非您指定“BuildArch:noarch”,否则它将自动创建。