Improve CPack deb generation
This commit is contained in:
+62
-12
@@ -5,22 +5,48 @@
|
||||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
"Salmanoff - A sensor management and control system")
|
||||
"Cognitive robotics runtime")
|
||||
set(CPACK_PACKAGE_VENDOR "Salmanoff Project")
|
||||
set(CPACK_PACKAGE_CONTACT "maintainer@salmanoff.org")
|
||||
|
||||
# Set package description
|
||||
set(CPACK_PACKAGE_DESCRIPTION
|
||||
"Salmanoff is a comprehensive sensor management and control system that\n"
|
||||
"provides unified interfaces for various sensor devices including LiDAR\n"
|
||||
"systems. It features modular architecture with support for multiple\n"
|
||||
"device types, asynchronous processing, and real-time data handling."
|
||||
)
|
||||
# Set package description.
|
||||
# Use a single joined string so CMake does not serialize it as a semicolon list
|
||||
# in the generated Debian control file.
|
||||
string(JOIN "\n "
|
||||
CPACK_PACKAGE_DESCRIPTION
|
||||
"Comprehensive sensor management and control runtime."
|
||||
""
|
||||
"Salmanoff provides unified interfaces for various sensor devices,"
|
||||
"including LiDAR systems."
|
||||
"It features modular architecture with support for multiple device"
|
||||
"types, asynchronous processing, and real-time data handling.")
|
||||
|
||||
# License information
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||
|
||||
# Debian-specific packaged documentation.
|
||||
set(SALMANOFF_CHANGELOG_TXT "${CMAKE_CURRENT_BINARY_DIR}/changelog")
|
||||
set(SALMANOFF_CHANGELOG_GZ "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz")
|
||||
file(WRITE "${SALMANOFF_CHANGELOG_TXT}"
|
||||
"salmanoff (${PROJECT_VERSION}) unstable; urgency=medium\n\n"
|
||||
" * Package release.\n\n"
|
||||
" -- Salmanoff Project <maintainer@salmanoff.org> Fri, 06 Mar 2026 00:00:00 +0000\n")
|
||||
execute_process(
|
||||
COMMAND gzip -n -9 -c "${SALMANOFF_CHANGELOG_TXT}"
|
||||
OUTPUT_FILE "${SALMANOFF_CHANGELOG_GZ}"
|
||||
)
|
||||
|
||||
set(SALMANOFF_MANPAGE_GZ "${CMAKE_CURRENT_BINARY_DIR}/salmanoff.1.gz")
|
||||
execute_process(
|
||||
COMMAND gzip -n -9 -c "${CMAKE_CURRENT_SOURCE_DIR}/docs/salmanoff.1"
|
||||
OUTPUT_FILE "${SALMANOFF_MANPAGE_GZ}"
|
||||
)
|
||||
|
||||
install(FILES "${SALMANOFF_CHANGELOG_GZ}" DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||
install(FILES "${SALMANOFF_MANPAGE_GZ}" DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR} RENAME copyright)
|
||||
|
||||
# Enable deb and rpm generators
|
||||
set(CPACK_GENERATOR "DEB;RPM")
|
||||
|
||||
@@ -36,9 +62,12 @@ set(CPACK_DEBIAN_PACKAGE_DISTRIBUTION "ubuntu")
|
||||
set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS
|
||||
"build-essential, cmake (>= 3.16), libboost-all-dev, flex, bison, ocl-icd-opencl-dev, liburing-dev")
|
||||
|
||||
# Runtime dependencies (from builddeps file - runtime equivalents)
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS
|
||||
"libboost-system1.74.0 | libboost-system1.73.0 | libboost-system1.72.0, libboost-log1.74.0 | libboost-log1.73.0 | libboost-log1.72.0, libc6, libstdc++6, ocl-icd-libopencl1 | libopencl1, liburing2 | liburing1")
|
||||
# Runtime dependencies.
|
||||
# Let dpkg-shlibdeps derive the actual ELF dependencies from the built
|
||||
# binaries/libraries. Hard-coding old Boost soname packages here makes the
|
||||
# package unnecessarily pull obsolete runtimes on newer distros, and in this
|
||||
# tree the generated binaries are not currently linked against Boost DSOs.
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
|
||||
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libxcb1, libx11-6")
|
||||
set(CPACK_DEBIAN_PACKAGE_SUGGESTS "livox-sdk")
|
||||
|
||||
@@ -49,9 +78,19 @@ set(CPACK_RPM_PACKAGE_URL "https://github.com/salmanoff/salmanoff")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "boost-system >= 1.72.0, boost-log >= 1.72.0, glibc, libstdc++, ocl-icd, liburing")
|
||||
set(CPACK_RPM_PACKAGE_SUGGESTS "xcb, libX11, livox-sdk")
|
||||
|
||||
# Package file naming using Debian's architecture naming when available.
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
if(EXISTS "/usr/bin/dpkg")
|
||||
execute_process(
|
||||
COMMAND /usr/bin/dpkg --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
# Package file naming using project variables
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
# Enable automatic dependency detection for Debian packages
|
||||
# This uses dpkg-shlibdeps to automatically detect shared library dependencies
|
||||
@@ -60,3 +99,14 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
# Set compression
|
||||
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
||||
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
|
||||
# Generate standard Debian shared-library metadata and use triggers instead of
|
||||
# maintainer scripts for ldconfig handling.
|
||||
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postrm"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/triggers")
|
||||
|
||||
# Ship stripped binaries in the primary package.
|
||||
set(CPACK_STRIP_FILES ON)
|
||||
|
||||
Reference in New Issue
Block a user