From 63b2f50b78b2d4165219feaf28596f77da170fee Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Thu, 18 Aug 2016 11:02:52 +0200 Subject: [PATCH] added prepare_debian_package.cmake (currently just a copy of the version in the DOOCSwrappers library) Warning: this commit will create conflicts, but it is anyway needed to adapt the projects using this templates due to the last commits. --- cmake/prepare_debian_package.cmake | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 cmake/prepare_debian_package.cmake diff --git a/cmake/prepare_debian_package.cmake b/cmake/prepare_debian_package.cmake new file mode 100644 index 0000000..49a7054 --- /dev/null +++ b/cmake/prepare_debian_package.cmake @@ -0,0 +1,52 @@ +# Prepare the debian control files from the template. +# Basically this is setting the correct version number in most of the files + +# We need the lower-case form of the project name, since Debian expects package names to be all lower-case +string(TOLOWER "${PROJECT_NAME}" project_name) + +# Set a number of variables, mainly to avoid having the project name in the variable name (which would require running +# configure_file twice) +set(PACKAGE_BASE_NAME "lib${project_name}") +set(PACKAGE_NAME "${PACKAGE_BASE_NAME}${${PROJECT_NAME}_DEBVERSION}") +set(PACKAGE_DEV_NAME "${PACKAGE_BASE_NAME}-dev") +set(PACKAGE_DOC_NAME "${PACKAGE_BASE_NAME}-doc") +set(PACKAGE_FILES_WILDCARDS "${PACKAGE_NAME}_*.deb ${PACKAGE_DEV_NAME}_*.deb ${PACKAGE_DOC_NAME}_*.deb ${PACKAGE_BASE_NAME}_*.changes") +set(PACKAGE_PATCH_VERSION "${${PROJECT_NAME}_PATCH_VERSION}") +set(PACKAGE_TAG_VERSION "${${PROJECT_NAME}_VERSION}") +set(PACKAGE_MAJOR_VERSION "${${PROJECT_NAME}_MAJOR_VERSION}") +set(PACKAGE_MINOR_VERSION "${${PROJECT_NAME}_MINOR_VERSION}") +set(PACKAGE_MESSAGE "Debian package for the ${PROJECT_NAME} library version ${${PROJECT_NAME}_VERSION}") + +# Nothing to change, just copy +file(COPY ${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/compat DESTINATION debian_from_template) +file(COPY ${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/rules DESTINATION debian_from_template) +file(COPY ${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/source/format DESTINATION debian_from_template/source) +file(COPY ${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/${PACKAGE_BASE_NAME}DEBVERSION.install DESTINATION debian_from_template) + +# Replace cmake variables only +configure_file(${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/copyright.in + debian_from_template/copyright @ONLY) + +configure_file(${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/dev-${PACKAGE_BASE_NAME}.install.in + debian_from_template/dev-${PACKAGE_BASE_NAME}.install @ONLY) + +# Replace cmake variables. The #DEBVERSION# will be replaced in make_debian_package.sh, so these are still only templates +configure_file(${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/control.template.in + debian_from_template/control.template @ONLY) + +configure_file(${CMAKE_SOURCE_DIR}/cmake/debian_package_templates/${PACKAGE_BASE_NAME}DEBVERSION.shlib.template.in + debian_from_template/${PACKAGE_BASE_NAME}DEBVERSION.shlib.template @ONLY) + +# Copy and configure the shell script which performs the actual building of the package +configure_file(${CMAKE_SOURCE_DIR}/cmake/make_debian_package.sh.in + make_debian_package.sh @ONLY) + +# A custom target so you can just run make debian_package +# (You could instead run make_debian_package.sh yourself, hm...) +add_custom_target(debian_package ${CMAKE_BINARY_DIR}/make_debian_package.sh + COMMENT Building debian package for tag ${${PROJECT_NAME}_SOVERSION}) + +# For convenience: Also create an install script for DESY +# The shared library package has the version number in the package name +configure_file(${CMAKE_SOURCE_DIR}/cmake/install_debian_package_at_DESY_intern.sh.in + install_debian_package_at_DESY_intern.sh @ONLY) -- GitLab