diff options
author | Manuel Bentele | 2020-09-15 17:56:51 +0200 |
---|---|---|
committer | Manuel Bentele | 2020-09-16 07:37:56 +0200 |
commit | 7090cf6a7a4da56b17332bfa69ad4d92a0ce2eb8 (patch) | |
tree | 30769bba81fe6c03c80545216df1f16f028f1253 | |
parent | Ported RAW file format kernel module to Linux 4.18.x (diff) | |
download | xloop-7090cf6a7a4da56b17332bfa69ad4d92a0ce2eb8.tar.gz xloop-7090cf6a7a4da56b17332bfa69ad4d92a0ce2eb8.tar.xz xloop-7090cf6a7a4da56b17332bfa69ad4d92a0ce2eb8.zip |
Added RPM package creation and moved to relative CMake installation paths
-rw-r--r-- | CMakeLists.txt | 19 | ||||
-rw-r--r-- | kernel/cmake/kernel.cmake | 6 | ||||
-rw-r--r-- | utils/CMakeLists.txt | 2 | ||||
-rw-r--r-- | utils/sys-utils/CMakeLists.txt | 11 |
4 files changed, 28 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b3d2a2..5ecf3e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ set(VERSION ${LINUX_KERNEL_VERSION}-${REPOSITORY_VERSION}) # define packaging if Release build is enabled if(${CMAKE_BUILD_TYPE} MATCHES Release) - set(CPACK_GENERATOR "DEB;TGZ") + set(CPACK_GENERATOR "DEB;RPM;TGZ") set(CPACK_SOURCE_GENERATOR "TGZ;ZIP") set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) set(CPACK_MONOLITHIC_INSTALL True) @@ -49,14 +49,29 @@ if(${CMAKE_BUILD_TYPE} MATCHES Release) set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CMAKE_SYSTEM_PROCESSOR}) set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_source) set(CPACK_STRIP_FILES True) + set(CPACK_PACKAGE_RELOCATABLE False) set(CPACK_SET_DESTDIR True) - set(CMAKE_INSTALL_PREFIX /usr) + set(CMAKE_INSTALL_PREFIX "/usr") + set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) # set DEB generator specific packaging options set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc-bin") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/deb/postinst "depmod -a\n") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/deb/postrm "depmod -a\n") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_BINARY_DIR}/package/deb/postinst ${CMAKE_CURRENT_BINARY_DIR}/package/deb/postrm) + # set RPM generator specific packaging options + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib" + "/lib/modules" + "/lib/modules/${CMAKE_SYSTEM_VERSION}" + "/lib/modules/${CMAKE_SYSTEM_VERSION}/extra" + "${CPACK_PACKAGING_INSTALL_PREFIX}/share/bash-completion" + "${CPACK_PACKAGING_INSTALL_PREFIX}/share/bash-completion/completions" + "${CPACK_PACKAGING_INSTALL_PREFIX}/share/man" + "${CPACK_PACKAGING_INSTALL_PREFIX}/share/man/man8") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/rpm/post "depmod -a\n") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/rpm/postun "depmod -a\n") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_BINARY_DIR}/package/rpm/post) + set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_BINARY_DIR}/package/rpm/postun) # include CPack functionality include(CPack) endif() diff --git a/kernel/cmake/kernel.cmake b/kernel/cmake/kernel.cmake index 90553f6..385cb40 100644 --- a/kernel/cmake/kernel.cmake +++ b/kernel/cmake/kernel.cmake @@ -22,7 +22,7 @@ macro(add_kernel_module MODULE_NAME KERNEL_DIR MODULE_MACRO MODULE_SOURCE_FILES endif() # define build command set(MODULE_BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} ${MODULE_MACRO} - -C ${KERNEL_DIR}/build + -C /${KERNEL_DIR}/build M=${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME} modules EXTRA_CFLAGS=${KERNEL_C_FLAGS} KBUILD_EXTRA_SYMBOLS=${MODULE_EXTRA_SYMBOLS}) @@ -32,8 +32,8 @@ macro(add_kernel_module MODULE_NAME KERNEL_DIR MODULE_MACRO MODULE_SOURCE_FILES DEPENDS ${MODULE_SOURCE_FILES} ${MODULE_HEADER_FILES} ${BUILD_SOURCE_FILE} VERBATIM) add_custom_target(${MODULE_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.ko ${ARGV6}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.ko + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.ko DESTINATION ${KERNEL_DIR}/extra PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT main) -endmacro(add_kernel_module)
\ No newline at end of file +endmacro(add_kernel_module) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 01e0793..cfc5548 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -22,6 +22,6 @@ add_subdirectory(libsmartcols) add_subdirectory(sys-utils) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bash-completion/xlosetup - DESTINATION /usr/share/bash-completion/completions + DESTINATION share/bash-completion/completions PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT main) diff --git a/utils/sys-utils/CMakeLists.txt b/utils/sys-utils/CMakeLists.txt index 38e2def..01295d9 100644 --- a/utils/sys-utils/CMakeLists.txt +++ b/utils/sys-utils/CMakeLists.txt @@ -10,7 +10,10 @@ target_include_directories(xlosetup PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../lib ${ install(TARGETS xlosetup DESTINATION bin COMPONENT main) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/xlosetup.8 - DESTINATION /usr/share/man/man8 - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - COMPONENT main) +# install xlosetup man page +# NOTE: installation is done via a directory install with file matching pattern to support CPackRPM's automatic compression of man pages +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION share/man/man8 + COMPONENT main + USE_SOURCE_PERMISSIONS + FILES_MATCHING PATTERN *.8*) |