create_package.cmake 3.8 KB
Newer Older
1 2 3
set(PACKAGE_SOURCE_NAME   "amdis")
set(PACKAGE_NAME          "libamdis")
set(PACKAGE_SECTION       "libdevel")
4 5 6 7 8 9 10
if (DEFINED DISTRIBUTION)
  set(PACKAGE_DISTRIBUTION  "${DISTRIBUTION}")
  set(IS_RELEASE ON)
else ()
  set(PACKAGE_DISTRIBUTION  "xenial")
  set(IS_RELEASE OFF)
endif ()
11 12 13
set(PACKAGE_VERSION_MAJOR "1")
set(PACKAGE_VERSION_MINOR "1")
set(PACKAGE_VERSION_PATCH "0")
14 15 16 17 18 19 20 21 22 23 24 25 26
set(PACKAGE_RELEASE_CANDIDATE "1")

# construct a package-version string
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")

if (${PACKAGE_VERSION_PATCH} GREATER 0)
  set(PACKAGE_VERSION "${PACKAGE_VERSION}.${PACKAGE_VERSION_PATCH}")
endif ()

if (NOT IS_RELEASE)
  set(PACKAGE_VERSION "${PACKAGE_VERSION}~rc${PACKAGE_RELEASE_CANDIDATE}")
endif ()

27 28
set(PACKAGE_VERSION "${PACKAGE_VERSION}~ppa1~${PACKAGE_DISTRIBUTION}")
set(PACKAGE_VERSION_FULL "${PACKAGE_VERSION}-1")
29 30 31 32 33 34 35 36 37 38 39 40 41

set(PACKAGE_CONTACT "Simon Praetorius <simon.praetorius@tu-dresden.de>")
set(PACKAGE_SOURCE  "<https://gitlab.math.tu-dresden.de/iwr/amdis.git>")

set(PACKAGE_DESCRIPTION_SUMMARY "A C++ library to solve a broad class of PDEs using adaptive finite elements.")
set(PACKAGE_DESCRIPTION_FILE    "${CMAKE_SOURCE_DIR}/README.md")
set(PACKAGE_DESCRIPTION
"Adaptive MultiDimensional Simulations (AMDiS) is a C++ library
 to solve a broad class of partial differential equations (PDEs) using
 adaptive finite elements.")

set(PACKAGE_LICENSE_FILE "${CMAKE_SOURCE_DIR}/LICENSE")
set(PACKAGE_README_FILE  "${CMAKE_SOURCE_DIR}/README.md")
42

43 44
file(READ ${CMAKE_SOURCE_DIR}/AUTHORS PACKAGE_AUTHORS)
execute_process(COMMAND date OUTPUT_VARIABLE PACKAGE_DATE)
45 46 47 48 49

set(IN_DIR  ${CMAKE_SOURCE_DIR}/tools/packaging/debian)
set(OUT_DIR ${CMAKE_SOURCE_DIR}/debian_package)
file(MAKE_DIRECTORY ${OUT_DIR})

50 51
set(PACKAGE_FILENAME ${PACKAGE_SOURCE_NAME}_${PACKAGE_VERSION})
set(PACKAGE_PREFIX ${PACKAGE_SOURCE_NAME}-${PACKAGE_VERSION})
52 53
set(TGZ_FILENAME ${OUT_DIR}/${PACKAGE_FILENAME}.orig.tar.gz)

54
# create source tar.gz archive using git archive
55
execute_process(COMMAND git archive --format=tar.gz --prefix ${PACKAGE_PREFIX}/ -o ${TGZ_FILENAME} HEAD)
56

57
# extract package generated above
58 59
execute_process(COMMAND tar -xzf ${TGZ_FILENAME} -C ${OUT_DIR})

60
# fill debian source package directory
61
set(DEBIAN_DIR ${OUT_DIR}/${PACKAGE_PREFIX}/debian)
62 63 64 65 66
file(MAKE_DIRECTORY ${DEBIAN_DIR})
file(MAKE_DIRECTORY ${DEBIAN_DIR}/soure)

execute_process(COMMAND date +%F OUTPUT_VARIABLE CURRENT_DATE)
execute_process(COMMAND date +%Y OUTPUT_VARIABLE YEAR)
67 68

if (NOT EXISTS ${CMAKE_SOURCE_DIR}/CHANGELOG)
69
  configure_file(${IN_DIR}/changelog.in ${CMAKE_SOURCE_DIR}/CHANGELOG @ONLY)
70 71 72 73 74
elseif (UPDATE_CHANGELOG)
  execute_process(COMMAND dch -i -M "New release version published at ${CURRENT_DATE}" -c ${CMAKE_SOURCE_DIR}/CHANGELOG)
endif ()
message(STATUS "Changelog must be uploaded to master")

75
configure_file(${CMAKE_SOURCE_DIR}/CHANGELOG ${DEBIAN_DIR}/changelog @ONLY)
76 77 78 79 80
configure_file(${IN_DIR}/copyright.in ${DEBIAN_DIR}/copyright @ONLY)
configure_file(${IN_DIR}/control.in   ${DEBIAN_DIR}/control   @ONLY)
configure_file(${IN_DIR}/rules.in     ${DEBIAN_DIR}/rules     @ONLY)
execute_process(COMMAND chmod +x ${DEBIAN_DIR}/rules)

81 82 83
configure_file(${IN_DIR}/libamdis-dev.install ${DEBIAN_DIR}/libamdis-dev.install @ONLY)
configure_file(${IN_DIR}/libamdis.install     ${DEBIAN_DIR}/libamdis.install     @ONLY)
configure_file(${IN_DIR}/libamdis-par.install ${DEBIAN_DIR}/libamdis-par.install @ONLY)
84 85 86
configure_file(${IN_DIR}/libamdis-debug.install     ${DEBIAN_DIR}/libamdis-debug.install     @ONLY)
configure_file(${IN_DIR}/libamdis-par-debug.install ${DEBIAN_DIR}/libamdis-par-debug.install @ONLY)

87 88 89 90
file(WRITE ${DEBIAN_DIR}/compat "9\n")
file(WRITE ${DEBIAN_DIR}/soure/format "3.0 (quilt)\n")

# generate the debian package
91 92
execute_process(COMMAND debuild -S -sa
# execute_process(COMMAND debuild -d -us -uc
93
                WORKING_DIRECTORY ${OUT_DIR}/${PACKAGE_PREFIX})