create_package.cmake 3.15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
set(PACKAGE_SOURCE_NAME   "amdis")
set(PACKAGE_NAME          "libamdis")
set(PACKAGE_SECTION       "libdevel")
set(PACKAGE_VERSION       "1.1~rc1")
set(PACKAGE_VERSION_MAJOR "1")
set(PACKAGE_VERSION_MINOR "1")
set(PACKAGE_VERSION_PATCH "0")

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")
21

22 23
file(READ ${CMAKE_SOURCE_DIR}/AUTHORS PACKAGE_AUTHORS)
execute_process(COMMAND date OUTPUT_VARIABLE PACKAGE_DATE)
24 25 26 27 28

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

29 30
set(PACKAGE_FILENAME ${PACKAGE_SOURCE_NAME}_${PACKAGE_VERSION})
set(PACKAGE_PREFIX ${PACKAGE_SOURCE_NAME}-${PACKAGE_VERSION})
31 32
set(TGZ_FILENAME ${OUT_DIR}/${PACKAGE_FILENAME}.orig.tar.gz)

33
# create source tar.gz archive using git archive
34 35
execute_process(COMMAND git archive --format=tar.gz --prefix ${PACKAGE_PREFIX}/ -o ${TGZ_FILENAME} master)

36
# extract package generated above
37 38
execute_process(COMMAND tar -xzf ${TGZ_FILENAME} -C ${OUT_DIR})

39
# fill debian source package directory
40
set(DEBIAN_DIR ${OUT_DIR}/${PACKAGE_PREFIX}/debian)
41 42 43 44 45
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)
46 47

if (NOT EXISTS ${CMAKE_SOURCE_DIR}/CHANGELOG)
48
  configure_file(${IN_DIR}/changelog.in ${CMAKE_SOURCE_DIR}/CHANGELOG @ONLY)
49 50 51 52 53 54
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")

configure_file(${CMAKE_SOURCE_DIR}/CHANGELOG ${DEBIAN_DIR}/changelog COPYONLY)
55 56 57 58 59
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)

60 61 62
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)
63 64 65
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)

66 67 68 69
file(WRITE ${DEBIAN_DIR}/compat "9\n")
file(WRITE ${DEBIAN_DIR}/soure/format "3.0 (quilt)\n")

# generate the debian package
70
execute_process(COMMAND debuild -d -us -uc
71
                WORKING_DIRECTORY ${OUT_DIR}/${PACKAGE_PREFIX})