diff --git a/cmake/DebianPackaging.config b/cmake/DebianPackaging.config deleted file mode 100644 index 728f006b25467ddc64a988d093d474a69112b70e..0000000000000000000000000000000000000000 --- a/cmake/DebianPackaging.config +++ /dev/null @@ -1,19 +0,0 @@ -######################################################################################## -# Project-specific configuration for the Debian packaging scripts # -# # -# Please modify this file for your needs by copying a line, uncommenting it and then # -# modifying the uncommented copy. Keep the commented original copy to avoid conflicts! # -######################################################################################## - -# URI of the git repository containing the build version numbers -#DEBIAN_BUILD_VERSIONS_REPO=git@github.com:ChimeraTK/DebianBuildVersions.git - -######################################################################################## -# NO USER CONFIGURATION BELOW THIS POINT! DO NOT MODIFY OUTSIDE THE project-template # -######################################################################################## -ERROR_MESSAGE="DebianPackaging.config is not properly updated for this package!" -if [ -z "$DEBIAN_BUILD_VERSIONS_REPO" ]; then - echo ${ERROR_MESSAGE} - exit 1 -fi -unset ERROR_MESSAGE diff --git a/cmake/add_dependency.cmake b/cmake/add_dependency.cmake index 62df752e15fad4adffba44f70328f11811419992..1cd1ca0047b7463ccc5086ea0d761ad4380bf70d 100644 --- a/cmake/add_dependency.cmake +++ b/cmake/add_dependency.cmake @@ -10,7 +10,7 @@ # - a list of components used by this project including the REQUIRED keyword etc. # # The macro will call FIND_PACKAGE, add the returned include directories to the system list, add the library directories -# to the list of link directories, and update the CMAKE_CXX_FLAGS and the PACKAGE_DEPENDENCY_VERSIONS variables. +# to the list of link directories, and update the CMAKE_CXX_FLAGS variable. # ####################################################################################################################### @@ -33,7 +33,5 @@ MACRO(add_dependency dependency_project_name required_version components) link_directories(${${dependency_project_name}_LIBRARY_DIRS}) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${dependency_project_name}_CXX_FLAGS}") - set(PACKAGE_DEPENDENCY_VERSIONS "${PACKAGE_DEPENDENCY_VERSIONS} ${dependency_project_name}-${${dependency_project_name}_VERSION}") - ENDMACRO(add_dependency) diff --git a/cmake/getDebianBuildVersion b/cmake/getDebianBuildVersion deleted file mode 100755 index 7ea0f9462ccbe38e432e3caa101796ff8c9f19d8..0000000000000000000000000000000000000000 --- a/cmake/getDebianBuildVersion +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -####################################################################################################################### -# getDebianBuildVersion -# -# Determine the Debian build version from the git repository specified in the DebianPackaging.config file. -# -# Usage: -# ./getDebianBuildVersion <PACKAGE_NAME> <PACKAGE_VERSION> <DEBIAN_CODENAME> [<DEPENDENCY1_NAME_WITH_VERSION>] \ -# [<DEPENDENCY2_NAME_WITH_VERSION>] [...] -# -# Example: -# ./getDebianBuildVersion DeviceAccess-DoocsBackend 0.1 xenial DeviceAccess-0.14 DOOCS-18.10.5 DoocsServerTestHelper-0.1 -# -# IMPORTANT NOTES: -# If you change the order of dependencies passed to this script, the build version will be unnecessarily increased! -# Running this script requires access to the git repository and WILL eventually MAKE COMMITS to it! -# -####################################################################################################################### - -####################################################################################################################### -# -# IMPORTANT NOTE: -# -# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from -# there. Make sure to keep the file generic, since it will be used by other projects, too. -# -# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes -# into the project-template repository immediately. -# -####################################################################################################################### - -# obtain configuration -source "$(dirname $0)/DebianPackaging.config" - -# check minimum number of command line parameters -if [ $# -lt 3 ]; then - echo "Usage:" - echo "./getDebianBuildVersion <PACKAGE_NAME> <PACKAGE_VERSION> <DEBIAN_CODENAME> [<DEPENDENCY1_NAME_WITH_VERSION>] [<DEPENDENCY2_NAME_WITH_VERSION>] [...]" - echo "" - echo "Example:" - echo "./getDebianBuildVersion DeviceAccess-DoocsBackend 0.1 xenial DeviceAccess-0.14 DOOCS-18.10.5 DoocsServerTestHelper-0.1" - echo "" - echo "IMPORTANT NOTES:" - echo "If you change the order of dependencies passed to this script, the build version will be unnecessarily increased!" - echo "Running this script requires access to the git repository and WILL eventually MAKE COMMITS to it!" - exit 1 -fi - -# parse mandatory command line parameters -PACKAGE_NAME="$1" -PACKAGE_VERSION="$2" -DEBIAN_CODENAME="$3" -shift ; shift ; shift - -# build sub-directory name for dependency versions (will start and end with a /) -DEPENDENCY_STRING="/" -while (( "$#" )); do - DEPENDENCY_STRING="${DEPENDENCY_STRING}${1}/" - shift -done - -# output information extracted from command line: -echo "PACKAGE_NAME=${PACKAGE_NAME}" >&2 -echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >&2 -echo "DEBIAN_CODENAME=${DEBIAN_CODENAME}" >&2 -echo "DEPENDENCY_STRING=${DEPENDENCY_STRING}" >&2 - -# create temporary directory for checking out the DebianBuildVersions repository and modifying it -WDIR=`mktemp --tmpdir -d DebianBuildVersions.XXXXXXXX` -echo Temporary directory to work in: $WDIR >&2 -echo Git repository containing the build versions: $DEBIAN_BUILD_VERSIONS_REPO >&2 - -# check out the DebianBuildVersions repository -cd $WDIR || exit 1 -git clone "$DEBIAN_BUILD_VERSIONS_REPO" . >&2 || exit 1 - -# go to the directory for the specific package version and debian codename (create it if not yet existing) -mkdir -p "${PACKAGE_NAME}/${PACKAGE_VERSION}/${DEBIAN_CODENAME}" -cd "${PACKAGE_NAME}/${PACKAGE_VERSION}/${DEBIAN_CODENAME}" - -# if LATEST_BUILD file is not there, this is the first build of this package version on this debian codename -if [ ! -f "LATEST_BUILD" ]; then - echo "The package ${PACKAGE_NAME} in version ${PACKAGE_VERSION} has never been build on ${DEBIAN_CODENAME} before." >&2 - # start with build number 1 and create the necessary control structure - BUILD_NUMBER=1 - echo ".${DEPENDENCY_STRING}BUILD_NUMBER" > LATEST_BUILD - mkdir -p ".${DEPENDENCY_STRING}" - echo ${BUILD_NUMBER} > ".${DEPENDENCY_STRING}BUILD_NUMBER" -else - # if the file BUILD_NUMBER exists in the dependency sub-directory, this is a patch build and we re-use the build number - if [ -f ".${DEPENDENCY_STRING}BUILD_NUMBER" ]; then - echo "The package ${PACKAGE_NAME} in version ${PACKAGE_VERSION} has been build on ${DEBIAN_CODENAME} before against the SAME dependency versions." >&2 - BUILD_NUMBER=`cat ".${DEPENDENCY_STRING}BUILD_NUMBER"` - else - # no build number has been assigned yet, so we have to increase the build number from the latest build - echo "The package ${PACKAGE_NAME} in version ${PACKAGE_VERSION} has been build on ${DEBIAN_CODENAME} before against DIFFERENT dependency versions." >&2 - BUILD_NUMBER=$(( `cat $(cat LATEST_BUILD)` + 1 )) - echo ".${DEPENDENCY_STRING}BUILD_NUMBER" > LATEST_BUILD - mkdir -p ".${DEPENDENCY_STRING}" - echo ${BUILD_NUMBER} > ".${DEPENDENCY_STRING}BUILD_NUMBER" - fi -fi - -# commit the changes to the repository -git add -A . >&2 || exit 1 -git commit -m "Update by getDebianBuildVersion: ${PACKAGE_NAME}/${PACKAGE_VERSION}/${DEBIAN_CODENAME}${DEPENDENCY_STRING} -> ${BUILD_NUMBER}" >&2 -git push >&2 || exit 1 - -# output the build number to stderr in human readable form and to stdout in plain form for further script processing -echo Build number: ${BUILD_NUMBER} >&2 -echo ${BUILD_NUMBER} - -rm -rf $WDIR diff --git a/cmake/make_debian_package.sh.in b/cmake/make_debian_package.sh.in deleted file mode 100755 index 2342ffdb2f13b6dc07a9ff590c66851c46dad521..0000000000000000000000000000000000000000 --- a/cmake/make_debian_package.sh.in +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -# Shell script to generate a debian package from a particular tag (configured during the cmake configuration). - -####################################################################################################################### -# -# IMPORTANT NOTE: -# -# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from -# there. Make sure to keep the file generic, since it will be used by other projects, too. -# -# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes -# into the project-template repository immediately. -# -####################################################################################################################### - -# This cmake.in file requires the following variables to be set: -# PACKAGE_BASE_NAME This is the debian package name, not the project name (e.g. libraries must start with lib, -# all lower case, no underscore) -# PACKAGE_TAG_VERSION The tag for which the package is build -# PACKAGE_MAJORMINOR_VERSION The library version without the patch level (i.e. just "MAJOR.MINOR") -# PACKAGE_PATCH_VERSION The patch level -# PACKAGE_MESSAGE The message for the debian package log -# PACKAGE_DEPENDENCY_VERSIONS A space-separated list of dependency names and versions, each connected by a dash, e.g.: -# "DeviceAccess-0.15 ControlSystemAdapter-0.1" -# Also the following standard cmake variables are used (should be always correctly set): -# CMAKE_SOURCE_DIR -# PROJECT_NAME - -# drop out of the script if anything goes wrong (e.g. non-existing git tag) -set -e - -# Create a working directory in order not to merge with the rest in the build directory -rm -rf debian_package -mkdir debian_package -cd debian_package - -# Parse command line argument -if [ -z "$1" ] ; then - # build on host system - USE_PBUILDER=0 - CODENAME=`lsb_release -c | sed "{s/Codename:\s*//}"` -elif [ "$1" == "--setup" ] ; then - if [ -z "$2" ] ; then - echo "Missing parameter to --setup" - exit 1 - fi - sudo pbuilder --create --distribution $2 - exit $? -else - USE_PBUILDER=1 - CODENAME=$1 -fi - -# Print warning if not using pbuilder -if [ "$USE_PBUILDER" == "0" ]; then - echo "WARNING: You are building on your host system for ${CODENAME}." - echo "" - echo "It is strongly recommended to build in a chroot environment using pbuilder. This can be simply enabled by calling the make_debian_package.sh script with the codename as command line argument, i.e.:" - echo " ./make_debian_package.sh ${CODENAME}" - echo "" - echo "This will require root permissons (script will ask for password via sudo) and a previously setup pbuilder environment, but you can build for any target on every host system with pbuilder installed." - echo "" - echo "To setup the pbuilder environment, use the following command:" - echo " ./make_debian_package.sh --setup ${CODENAME}" - echo "" - echo -n "Continuing in 5 seconds. Press Ctrl+C to abort." - sleep 1 ; echo -n "." - sleep 1 ; echo -n "." - sleep 1 ; echo -n "." - sleep 1 ; echo -n "." - sleep 1 ; echo "." -fi - - -# Obtain build version and the derived so-file and debian versions -BUILD_NUMBER=`"@CMAKE_SOURCE_DIR@/cmake/getDebianBuildVersion" @PROJECT_NAME@ @PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ ${CODENAME} @PACKAGE_DEPENDENCY_VERSIONS@` || exit 1 -export PROJECT_BUILDVERSION="${CODENAME}${BUILD_NUMBER}" - -DEBVERSION="@PACKAGE_MAJOR_VERSION@-@PACKAGE_MINOR_VERSION@-${PROJECT_BUILDVERSION}" -SOVERSION="@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@${PROJECT_BUILDVERSION}" - -# replace #DEBVERSION# inside the template files in the debian_from_template directory, also replace DEBVERSION in the -# file names -for file_source in ../debian_from_template/* ; do - file_target=`echo ${file_source} | sed -e "s|DEBVERSION|${DEBVERSION}|g" -e "s|.template$||" ` - - echo "$file_source -> $file_target" - - # perform operation, if source and target file names are not identical - if [ "$file_source" != "$file_target" ] ; then - sed "$file_source" -e "s|#DEBVERSION#|${DEBVERSION}|g" -e "s|#SOVERSION#|${SOVERSION}|g" > "$file_target" - fi - -done - -# Check out the correct tag from the master git repository. -# The local directory name has to follow the debian convention -# lowecasepackagenname_package.ver.sion -# Note, we first clone and then checkout the tag because the old git version on -# Ubuntu12.4 does not support to do it in one go. -BUILD_DIR_NAME="@PACKAGE_BASE_NAME@_@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@-${PROJECT_BUILDVERSION}" -git clone @CMAKE_SOURCE_DIR@ ${BUILD_DIR_NAME} -( cd ${BUILD_DIR_NAME} &&\ - git checkout @PACKAGE_TAG_VERSION@ &&\ - rm -rf .git ) -# Debian convention: file has to end on .orig.tar.gz -tar -czf ${BUILD_DIR_NAME}.orig.tar.gz ${BUILD_DIR_NAME} - -# Copy the prepared debian packaging config files to the source code -# directroy -cp -r ../debian_from_template ${BUILD_DIR_NAME}/debian -cd ${BUILD_DIR_NAME} - -# Before building the package we will update the changelog. This is easier from a shell script -# because debchange does the right format and the current date, user name and email automatically for us. -# Use the NAME and EMAIL environment variables to get correct values if needed (usually the email is -# user@host instead of first.last@institute, for instance killenb@mskpcx18571.desy.de instead of martin.killenberg@desy.de). -debchange --create --package @PACKAGE_BASE_NAME@ -v @PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@-${PROJECT_BUILDVERSION}-@PACKAGE_PATCH_VERSION@ --distribution ${CODENAME} @PACKAGE_MESSAGE@ - -# Now everything is prepared and we can actually build the package. -# If you have a gpg signature you can remove the -us and -uc flags and sign the package. -if [ "$USE_PBUILDER" == "0" ]; then - dpkg-buildpackage -rfakeroot -us -uc -else - MIRRORLIST="deb [trusted=yes] http://doocspkgs.desy.de/pub/doocs xenial main|deb [trusted=yes] http://doocs.desy.de/pub/doocs xenial main|deb [trusted=yes] file:///var/cache/pbuilder/result ./" - sudo bash -c "cd /var/cache/pbuilder/result ; apt-ftparchive packages . > Packages" || exit 1 - sudo pbuilder --update --distribution ${CODENAME} --override-config --components "main universe" \ - --othermirror "$MIRRORLIST" --buildresult "/var/cache/pbuilder/result" \ - --bindmounts "/var/cache/pbuilder/result" || exit 1 - pdebuild -- --distribution ${CODENAME} --buildresult "/var/cache/pbuilder/result" \ - --bindmounts "/var/cache/pbuilder/result" || exit 1 - echo "" - echo "You can find the resulting debian packages in this directory: /var/cache/pbuilder/result" -fi diff --git a/cmake/prepare_debian_package.cmake b/cmake/prepare_debian_package.cmake deleted file mode 100644 index 2309cf2366255e311c4e45ce9c8e65fd36e027ef..0000000000000000000000000000000000000000 --- a/cmake/prepare_debian_package.cmake +++ /dev/null @@ -1,74 +0,0 @@ -####################################################################################################################### -# prepare_debian_package.cmake -# -# Prepares all files needed to build Debian packages for this project (by running "make debian_package"). -# -# The script uses a number of common variables provided by the project-template, especially it requires that -# previously the script set_version_numbers.cmake has been included. -# -####################################################################################################################### - -####################################################################################################################### -# -# IMPORTANT NOTE: -# -# DO NOT MODIFY THIS FILE inside a project. Instead update the project-template repository and pull the change from -# there. Make sure to keep the file generic, since it will be used by other projects, too. -# -# If you have modified this file inside a project despite this warning, make sure to cherry-pick all your changes -# into the project-template repository immediately. -# -####################################################################################################################### - -# 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)