Improved cpack configuration for building debian packages:

* Added configurable maintainer
* Added configurable dependencies and conflicts per package
* Added post install script to run ldconfig after package is installed
* Updated name of readme file in cpack configuration
This commit is contained in:
Marcel Pursche 2017-03-20 16:31:09 +01:00
parent 44e303ad90
commit 1bf303e566
4 changed files with 111 additions and 5 deletions

View File

@ -57,7 +57,7 @@ ENDIF()
SET(CPACK_SOURCE_GENERATOR "TGZ") SET(CPACK_SOURCE_GENERATOR "TGZ")
# for ms visual studio we use it's internally defined variable to get the configuration (debug,release, ...) # for ms visual studio we use it's internally defined variable to get the configuration (debug,release, ...)
IF(MSVC_IDE) IF(MSVC_IDE)
SET(OSG_CPACK_CONFIGURATION "$(OutDir)") SET(OSG_CPACK_CONFIGURATION "$(OutDir)")
SET(PACKAGE_TARGET_PREFIX "Package ") SET(PACKAGE_TARGET_PREFIX "Package ")
@ -84,9 +84,87 @@ ENDIF()
SET(PACKAGE_ALL_TARGETNAME "${PACKAGE_TARGET_PREFIX}ALL") SET(PACKAGE_ALL_TARGETNAME "${PACKAGE_TARGET_PREFIX}ALL")
ADD_CUSTOM_TARGET(${PACKAGE_ALL_TARGETNAME}) ADD_CUSTOM_TARGET(${PACKAGE_ALL_TARGETNAME})
# cpack configuration for debian packages
IF(${CPACK_GENERATOR} STREQUAL "DEB")
SET(OPENSCENEGRAPH_PACKAGE_MAINTAINER
""
CACHE STRING
"Name and email address of the package maintainer, e.g., 'Jon Doe <jon.doe@superawesomemail.com>'"
)
SET(CPACK_LIBOPENSCENEGRAPH_DEPENDENCIES
"libopenthreads"
CACHE STRING
"Dependend packages for the openscenegraph library package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENSCENEGRAPH-DEV_DEPENDENCIES
"libopenscenegraph"
CACHE STRING
"Dependend packages for the openscenegraph development package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENTHREADS_DEPENDENCIES
""
CACHE STRING
"Dependend packages for the openthreads library package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENTHREADS-DEV_DEPENDENCIES
"libopenthreads"
CACHE STRING
"Dependend packages for the openthreads development package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_OPENSCENEGRAPH_DEPENDENCIES
"libopenscenegraph"
CACHE STRING
"Dependend packages for the openscenegraph main package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_OPENSCENEGRAPH-ALL_DEPENDENCIES
""
CACHE STRING
"Dependend packages for the openscenegraph package with all components (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENSCENEGRAPH_CONFLICTS
""
CACHE STRING
"Conflicting packages for the openscenegraph library package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENSCENEGRAPH-DEV_CONFLICTS
""
CACHE STRING
"Conflicting packages for the openscenegraph development package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENTHREADS_CONFLICTS
""
CACHE STRING
"Conflicting packages for the openthreads library package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_LIBOPENTHREADS-DEV_CONFLICTS
""
CACHE STRING
"Conflicting packages for the openthreads development package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_OPENSCENEGRAPH_CONFLICTS
""
CACHE STRING
"Conflicting packages for the openscenegraph main package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_OPENSCENEGRAPH-ALL_CONFLICTS
""
CACHE STRING
"Conflicting packages for the openscenegraph package with all components (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
ENDIF()
MACRO(GENERATE_PACKAGING_TARGET package_name) MACRO(GENERATE_PACKAGING_TARGET package_name)
SET(CPACK_PACKAGE_NAME ${package_name}) SET(CPACK_PACKAGE_NAME ${package_name})
# set debian dependencies AND conflicts
IF(${CPACK_GENERATOR} STREQUAL "DEB")
STRING(TOUPPER CPACK_${package_name}_DEPENDENCIES DEPENDENCIES_VAR)
STRING(TOUPPER CPACK_${package_name}_CONFLICTS CONFLICTS_VAR)
SET(OSG_PACKAGE_DEPENDS "${${DEPENDENCIES_VAR}}")
SET(OSG_PACKAGE_CONFLICTS "${${CONFLICTS_VAR}}")
ENDIF()
# the doc packages don't need a system-arch specification # the doc packages don't need a system-arch specification
IF(${package} MATCHES -doc) IF(${package} MATCHES -doc)
SET(OSG_PACKAGE_FILE_NAME ${package_name}-${OPENSCENEGRAPH_VERSION}) SET(OSG_PACKAGE_FILE_NAME ${package_name}-${OPENSCENEGRAPH_VERSION})
@ -114,7 +192,7 @@ MACRO(GENERATE_PACKAGING_TARGET package_name)
ELSE() ELSE()
SET(ARCHIVE_EXT "tar.gz") SET(ARCHIVE_EXT "tar.gz")
ENDIF() ENDIF()
# Create a target that creates the current package # Create a target that creates the current package
# and rename the package to give it proper filename # and rename the package to give it proper filename
ADD_CUSTOM_TARGET(${PACKAGE_TARGETNAME}) ADD_CUSTOM_TARGET(${PACKAGE_TARGETNAME})
@ -124,7 +202,7 @@ MACRO(GENERATE_PACKAGING_TARGET package_name)
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake
COMMENT "Run CPack packaging for ${package_name}..." COMMENT "Run CPack packaging for ${package_name}..."
) )
# Add the exact same custom command to the all package generating target. # Add the exact same custom command to the all package generating target.
# I can't use add_dependencies to do this because it would allow parallell building of packages so am going brute here # I can't use add_dependencies to do this because it would allow parallell building of packages so am going brute here
ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME} ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME}
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake

View File

@ -53,7 +53,7 @@ SET(CPACK_NSIS_INSTALLER_ICON_CODE "")
SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
SET(CPACK_OUTPUT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackConfig-${OSG_CPACK_COMPONENT}.cmake") SET(CPACK_OUTPUT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackConfig-${OSG_CPACK_COMPONENT}.cmake")
SET(CPACK_PACKAGE_DEFAULT_LOCATION "/") SET(CPACK_PACKAGE_DEFAULT_LOCATION "/")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenSceneGraph_SOURCE_DIR}/README.txt") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenSceneGraph_SOURCE_DIR}/README.md")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The OpenSceneGraph is an open source high performance 3d graphics toolkit") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The OpenSceneGraph is an open source high performance 3d graphics toolkit")
SET(CPACK_PACKAGE_FILE_NAME "${OSG_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_FILE_NAME "${OSG_PACKAGE_FILE_NAME}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
@ -66,6 +66,16 @@ SET(CPACK_PACKAGE_VERSION_MAJOR "${OPENSCENEGRAPH_MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${OPENSCENEGRAPH_MINOR_VERSION}") SET(CPACK_PACKAGE_VERSION_MINOR "${OPENSCENEGRAPH_MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${OPENSCENEGRAPH_PATCH_VERSION}") SET(CPACK_PACKAGE_VERSION_PATCH "${OPENSCENEGRAPH_PATCH_VERSION}")
SET(CPACK_RESOURCE_FILE_LICENSE "${OpenSceneGraph_SOURCE_DIR}/LICENSE.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${OpenSceneGraph_SOURCE_DIR}/LICENSE.txt")
SET(CPACK_RESOURCE_FILE_README "${OpenSceneGraph_SOURCE_DIR}/README.txt") SET(CPACK_RESOURCE_FILE_README "${OpenSceneGraph_SOURCE_DIR}/README.md")
SET(CPACK_RESOURCE_FILE_WELCOME "${OpenSceneGraph_SOURCE_DIR}/NEWS.txt") SET(CPACK_RESOURCE_FILE_WELCOME "${OpenSceneGraph_SOURCE_DIR}/NEWS.txt")
SET(CPACK_STRIP_FILES "ON") SET(CPACK_STRIP_FILES "ON")
# DEBIAN OPTIONS
IF(${CPACK_GENERATOR} STREQUAL "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "${OPENSCENEGRAPH_PACKAGE_MAINTAINER}")
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.openscenegraph.org")
SET(CPACK_DEBIAN_PACKAGE_SECTION "Development")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${OSG_PACKAGE_DEPENDS}")
SET(CPACK_DEBIAN_PACKAGE_CONFLICTS "${OSG_PACKAGE_CONFLICTS}")
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${OpenSceneGraph_SOURCE_DIR}/debian_scripts/postinst;")
ENDIF()

View File

@ -266,6 +266,23 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
## plugins gets put in libopenscenegraph by default ## plugins gets put in libopenscenegraph by default
IF(${ARGC} GREATER 1) IF(${ARGC} GREATER 1)
SET(PACKAGE_COMPONENT libopenscenegraph-${ARGV1}) SET(PACKAGE_COMPONENT libopenscenegraph-${ARGV1})
# add cpack config variables for plugin with own package
IF(BUILD_OSG_PACKAGES)
IF(${CPACK_GENERATOR} STREQUAL "DEB")
STRING(TOUPPER ${PACKAGE_COMPONENT} UPPER_PACKAGE_COMPONENT)
SET(CPACK_${UPPER_PACKAGE_COMPONENT}_DEPENDENCIES
"libopenscenegraph"
CACHE STRING
"Dependend packages for the ${PACKAGE_COMPONENT} package with all components (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
SET(CPACK_${UPPER_PACKAGE_COMPONENT}_CONFLICTS
""
CACHE STRING
"Conflicting packages for the ${PACKAGE_COMPONENT} package (uses deb dependecy format), e.g., 'libc6, libcurl3-gnutls, libgif4, libjpeg8, libpng12-0'"
)
ENDIF()
ENDIF()
ELSE(${ARGC} GREATER 1) ELSE(${ARGC} GREATER 1)
SET(PACKAGE_COMPONENT libopenscenegraph) SET(PACKAGE_COMPONENT libopenscenegraph)
ENDIF(${ARGC} GREATER 1) ENDIF(${ARGC} GREATER 1)

1
debian_scripts/postinst Executable file
View File

@ -0,0 +1 @@
ldconfig