CPackDeb.cmake 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # CPack script for creating Debian package
  4. # Author: Mathieu Malaterre
  5. #
  6. # http://wiki.debian.org/HowToPackageForDebian
  7. if(CMAKE_BINARY_DIR)
  8. message(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
  9. endif()
  10. cmake_policy(PUSH)
  11. cmake_policy(SET CMP0057 NEW) # if IN_LIST
  12. function(cpack_deb_variable_fallback OUTPUT_VAR_NAME)
  13. set(FALLBACK_VAR_NAMES ${ARGN})
  14. foreach(variable_name IN LISTS FALLBACK_VAR_NAMES)
  15. if(${variable_name})
  16. set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE)
  17. break()
  18. endif()
  19. endforeach()
  20. endfunction()
  21. function(get_component_package_name var component)
  22. string(TOUPPER "${component}" component_upcase)
  23. if(CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME)
  24. string(TOLOWER "${CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME}" package_name)
  25. else()
  26. string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${component}" package_name)
  27. endif()
  28. set("${var}" "${package_name}" PARENT_SCOPE)
  29. endfunction()
  30. #extract library name and version for given shared object
  31. function(extract_so_info shared_object libname version)
  32. if(READELF_EXECUTABLE)
  33. execute_process(COMMAND "${READELF_EXECUTABLE}" -d "${shared_object}"
  34. WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
  35. RESULT_VARIABLE result
  36. OUTPUT_VARIABLE output
  37. ERROR_QUIET
  38. OUTPUT_STRIP_TRAILING_WHITESPACE)
  39. if(result EQUAL 0)
  40. string(REGEX MATCH "\\(?SONAME\\)?[^\n]*\\[([^\n]+)\\.so\\.([^\n]*)\\]" soname "${output}")
  41. set(${libname} "${CMAKE_MATCH_1}" PARENT_SCOPE)
  42. set(${version} "${CMAKE_MATCH_2}" PARENT_SCOPE)
  43. else()
  44. message(WARNING "Error running readelf for \"${shared_object}\"")
  45. endif()
  46. else()
  47. message(FATAL_ERROR "Readelf utility is not available.")
  48. endif()
  49. endfunction()
  50. function(cpack_deb_check_description SUMMARY LINES RESULT_VARIABLE)
  51. set(_result TRUE)
  52. # Get the summary line
  53. if(NOT SUMMARY MATCHES "^[^\\s].*$")
  54. set(_result FALSE)
  55. set(${RESULT_VARIABLE} ${_result} PARENT_SCOPE)
  56. return()
  57. endif()
  58. foreach(_line IN LISTS LINES)
  59. if(NOT _line MATCHES "^ +[^ ]+.*$")
  60. set(_result FALSE)
  61. break()
  62. endif()
  63. endforeach()
  64. set(${RESULT_VARIABLE} ${_result} PARENT_SCOPE)
  65. endfunction()
  66. function(cpack_deb_format_package_description TEXT OUTPUT_VAR)
  67. # Turn the possible multi-line string into a list
  68. string(UUID uuid NAMESPACE 00000000-0000-0000-0000-000000000000 TYPE SHA1)
  69. string(REPLACE ";" "${uuid}" _text "${TEXT}")
  70. string(REPLACE "\n" ";" _lines "${_text}")
  71. list(POP_FRONT _lines _summary)
  72. # Check if reformatting required
  73. cpack_deb_check_description("${_summary}" "${_lines}" _result)
  74. if(_result)
  75. # Ok, no formatting required
  76. set(${OUTPUT_VAR} "${TEXT}" PARENT_SCOPE)
  77. return()
  78. endif()
  79. # Format the summary line
  80. string(STRIP "${_summary}" _summary)
  81. # Make sure the rest formatted properly
  82. set(_result)
  83. foreach(_line IN LISTS _lines)
  84. string(STRIP "${_line}" _line_strip)
  85. if(NOT _line_strip)
  86. # Replace empty lines w/ a _single full stop character_
  87. set(_line " .")
  88. else()
  89. # Prepend the normal lines w/ a single space.
  90. # If the line already starts w/ at least one space,
  91. # it'll become _verbatim_ (assuming it supposed to be
  92. # verbatim in the original text).
  93. string(PREPEND _line " ")
  94. endif()
  95. list(APPEND _result "${_line}")
  96. endforeach()
  97. list(PREPEND _result "${_summary}")
  98. list(JOIN _result "\n" _result)
  99. string(REPLACE "${uuid}" ";" _result "${_result}")
  100. set(${OUTPUT_VAR} "${_result}" PARENT_SCOPE)
  101. endfunction()
  102. function(cpack_deb_prepare_package_vars)
  103. # CPACK_DEBIAN_PACKAGE_SHLIBDEPS
  104. # If specify OFF, only user depends are used
  105. if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
  106. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
  107. endif()
  108. set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
  109. set(DBGSYMDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}-dbgsym")
  110. file(REMOVE_RECURSE "${DBGSYMDIR}")
  111. # per component automatic discover: some of the component might not have
  112. # binaries.
  113. if(CPACK_DEB_PACKAGE_COMPONENT)
  114. string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name)
  115. set(_component_shlibdeps_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_SHLIBDEPS")
  116. # if set, overrides the global configuration
  117. if(DEFINED ${_component_shlibdeps_var})
  118. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "${${_component_shlibdeps_var}}")
  119. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  120. message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' dpkg-shlibdeps set to ${CPACK_DEBIAN_PACKAGE_SHLIBDEPS}")
  121. endif()
  122. endif()
  123. endif()
  124. cpack_deb_variable_fallback("CPACK_DEBIAN_DEBUGINFO_PACKAGE"
  125. "CPACK_DEBIAN_${_local_component_name}_DEBUGINFO_PACKAGE"
  126. "CPACK_DEBIAN_DEBUGINFO_PACKAGE")
  127. if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS OR CPACK_DEBIAN_DEBUGINFO_PACKAGE)
  128. # Generating binary list - Get type of all install files
  129. file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
  130. find_program(FILE_EXECUTABLE file)
  131. if(NOT FILE_EXECUTABLE)
  132. message(FATAL_ERROR "CPackDeb: file utility is not available. CPACK_DEBIAN_PACKAGE_SHLIBDEPS and CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS options are not available.")
  133. endif()
  134. # get file info so that we can determine if file is executable or not
  135. unset(CPACK_DEB_INSTALL_FILES)
  136. foreach(FILE_ IN LISTS FILE_PATHS_)
  137. execute_process(COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${FILE_EXECUTABLE} "./${FILE_}"
  138. WORKING_DIRECTORY "${WDIR}"
  139. RESULT_VARIABLE FILE_RESULT_
  140. OUTPUT_VARIABLE INSTALL_FILE_)
  141. if(NOT FILE_RESULT_ EQUAL 0)
  142. message(FATAL_ERROR "CPackDeb: execution of command: '${FILE_EXECUTABLE} ./${FILE_}' failed with exit code: ${FILE_RESULT_}")
  143. endif()
  144. list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}")
  145. endforeach()
  146. # Only dynamically linked ELF files are included
  147. # Extract only file name infront of ":"
  148. foreach(_FILE IN LISTS CPACK_DEB_INSTALL_FILES)
  149. if(_FILE MATCHES "ELF.*dynamically linked")
  150. string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}")
  151. list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}")
  152. set(CONTAINS_EXECUTABLE_FILES_ TRUE)
  153. endif()
  154. if(_FILE MATCHES "ELF.*shared object")
  155. string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}")
  156. list(APPEND CPACK_DEB_SHARED_OBJECT_FILES "${CMAKE_MATCH_1}")
  157. endif()
  158. if(_FILE MATCHES "ELF.*not stripped")
  159. string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}")
  160. list(APPEND CPACK_DEB_UNSTRIPPED_FILES "${CMAKE_MATCH_1}")
  161. endif()
  162. endforeach()
  163. endif()
  164. find_program(READELF_EXECUTABLE NAMES readelf)
  165. if(CPACK_DEBIAN_DEBUGINFO_PACKAGE AND CPACK_DEB_UNSTRIPPED_FILES)
  166. find_program(OBJCOPY_EXECUTABLE NAMES objcopy)
  167. if(NOT OBJCOPY_EXECUTABLE)
  168. message(FATAL_ERROR "debuginfo packages require the objcopy tool")
  169. endif()
  170. if(NOT READELF_EXECUTABLE)
  171. message(FATAL_ERROR "debuginfo packages require the readelf tool")
  172. endif()
  173. file(RELATIVE_PATH _DBGSYM_ROOT "${CPACK_TEMPORARY_DIRECTORY}" "${DBGSYMDIR}")
  174. foreach(_FILE IN LISTS CPACK_DEB_UNSTRIPPED_FILES)
  175. # Get the file's Build ID
  176. execute_process(COMMAND env LC_ALL=C ${READELF_EXECUTABLE} -n "${_FILE}"
  177. WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
  178. OUTPUT_VARIABLE READELF_OUTPUT
  179. RESULT_VARIABLE READELF_RESULT
  180. ERROR_VARIABLE READELF_ERROR
  181. OUTPUT_STRIP_TRAILING_WHITESPACE )
  182. if(NOT READELF_RESULT EQUAL 0)
  183. message(FATAL_ERROR "CPackDeb: readelf: '${READELF_ERROR}';\n"
  184. "executed command: '${READELF_EXECUTABLE} -n ${_FILE}'")
  185. endif()
  186. if(READELF_OUTPUT MATCHES "Build ID: ([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z]*)")
  187. set(_BUILD_ID_START ${CMAKE_MATCH_1})
  188. set(_BUILD_ID_REMAINING ${CMAKE_MATCH_2})
  189. list(APPEND BUILD_IDS ${_BUILD_ID_START}${_BUILD_ID_REMAINING})
  190. else()
  191. message(FATAL_ERROR "Unable to determine Build ID for ${_FILE}")
  192. endif()
  193. # Split out the debug symbols from the binaries
  194. set(_FILE_DBGSYM ${_DBGSYM_ROOT}/usr/lib/debug/.build-id/${_BUILD_ID_START}/${_BUILD_ID_REMAINING}.debug)
  195. get_filename_component(_OUT_DIR "${_FILE_DBGSYM}" DIRECTORY)
  196. file(MAKE_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}/${_OUT_DIR}")
  197. execute_process(COMMAND ${OBJCOPY_EXECUTABLE} --only-keep-debug "${_FILE}" "${_FILE_DBGSYM}"
  198. WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
  199. OUTPUT_VARIABLE OBJCOPY_OUTPUT
  200. RESULT_VARIABLE OBJCOPY_RESULT
  201. ERROR_VARIABLE OBJCOPY_ERROR
  202. OUTPUT_STRIP_TRAILING_WHITESPACE )
  203. if(NOT OBJCOPY_RESULT EQUAL 0)
  204. message(FATAL_ERROR "CPackDeb: objcopy: '${OBJCOPY_ERROR}';\n"
  205. "executed command: '${OBJCOPY_EXECUTABLE} --only-keep-debug ${_FILE} ${_FILE_DBGSYM}'")
  206. endif()
  207. execute_process(COMMAND ${OBJCOPY_EXECUTABLE} --strip-unneeded ${_FILE}
  208. WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
  209. OUTPUT_VARIABLE OBJCOPY_OUTPUT
  210. RESULT_VARIABLE OBJCOPY_RESULT
  211. ERROR_VARIABLE OBJCOPY_ERROR
  212. OUTPUT_STRIP_TRAILING_WHITESPACE )
  213. if(NOT OBJCOPY_RESULT EQUAL 0)
  214. message(FATAL_ERROR "CPackDeb: objcopy: '${OBJCOPY_ERROR}';\n"
  215. "executed command: '${OBJCOPY_EXECUTABLE} --strip-debug ${_FILE}'")
  216. endif()
  217. execute_process(COMMAND ${OBJCOPY_EXECUTABLE} --add-gnu-debuglink=${_FILE_DBGSYM} ${_FILE}
  218. WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
  219. OUTPUT_VARIABLE OBJCOPY_OUTPUT
  220. RESULT_VARIABLE OBJCOPY_RESULT
  221. ERROR_VARIABLE OBJCOPY_ERROR
  222. OUTPUT_STRIP_TRAILING_WHITESPACE )
  223. if(NOT OBJCOPY_RESULT EQUAL 0)
  224. message(FATAL_ERROR "CPackDeb: objcopy: '${OBJCOPY_ERROR}';\n"
  225. "executed command: '${OBJCOPY_EXECUTABLE} --add-gnu-debuglink=${_FILE_DBGSYM} ${_FILE}'")
  226. endif()
  227. endforeach()
  228. endif()
  229. if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS)
  230. # dpkg-shlibdeps is a Debian utility for generating dependency list
  231. find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps)
  232. if(SHLIBDEPS_EXECUTABLE)
  233. # Check version of the dpkg-shlibdeps tool using CPackDEB method
  234. execute_process(COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version
  235. OUTPUT_VARIABLE _TMP_VERSION
  236. ERROR_QUIET
  237. OUTPUT_STRIP_TRAILING_WHITESPACE)
  238. if(_TMP_VERSION MATCHES "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)")
  239. set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
  240. else()
  241. unset(SHLIBDEPS_EXECUTABLE_VERSION)
  242. endif()
  243. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  244. message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'")
  245. message("CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>")
  246. endif()
  247. if(CONTAINS_EXECUTABLE_FILES_)
  248. message("CPackDeb: - Generating dependency list")
  249. # Create blank control file for running dpkg-shlibdeps
  250. # There might be some other way to invoke dpkg-shlibdeps without creating this file
  251. # but standard debian package should not have anything that can collide with this file or directory
  252. file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian)
  253. file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "")
  254. # Create a DEBIAN directory so that dpkg-shlibdeps can find the package dir when resolving $ORIGIN.
  255. file(MAKE_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}/DEBIAN")
  256. # Add --ignore-missing-info if the tool supports it
  257. execute_process(COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --help
  258. OUTPUT_VARIABLE _TMP_HELP
  259. ERROR_QUIET
  260. OUTPUT_STRIP_TRAILING_WHITESPACE)
  261. if(_TMP_HELP MATCHES "--ignore-missing-info")
  262. set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info")
  263. endif()
  264. # Execute dpkg-shlibdeps
  265. # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package
  266. # -O : print to STDOUT
  267. execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}
  268. WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
  269. OUTPUT_VARIABLE SHLIBDEPS_OUTPUT
  270. RESULT_VARIABLE SHLIBDEPS_RESULT
  271. ERROR_VARIABLE SHLIBDEPS_ERROR
  272. OUTPUT_STRIP_TRAILING_WHITESPACE )
  273. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  274. # dpkg-shlibdeps will throw some warnings if some input files are not binary
  275. message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}")
  276. endif()
  277. if(NOT SHLIBDEPS_RESULT EQUAL 0)
  278. message(FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n"
  279. "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n"
  280. "found files: '${INSTALL_FILE_}';\n"
  281. "files info: '${CPACK_DEB_INSTALL_FILES}';\n"
  282. "binary files: '${CPACK_DEB_BINARY_FILES}'")
  283. endif()
  284. #Get rid of prefix generated by dpkg-shlibdeps
  285. string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}")
  286. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  287. message("CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS} from output ${SHLIBDEPS_OUTPUT}")
  288. endif()
  289. # Remove blank control file
  290. # Might not be safe if package actual contain file or directory named debian
  291. file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian")
  292. # remove temporary directory that was created only for dpkg-shlibdeps execution
  293. file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/DEBIAN")
  294. else()
  295. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  296. message(AUTHOR_WARNING "CPackDeb Debug: Using only user-provided depends because package does not contain executable files that link to shared libraries.")
  297. endif()
  298. endif()
  299. else()
  300. message("CPackDeb: Using only user-provided dependencies because dpkg-shlibdeps is not found.")
  301. endif()
  302. else()
  303. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  304. message("CPackDeb Debug: Using only user-provided dependencies")
  305. endif()
  306. endif()
  307. # Let's define the control file found in debian package:
  308. # Binary package:
  309. # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
  310. # DEBIAN/control
  311. # debian policy enforce lower case for package name
  312. # Package: (mandatory)
  313. if(NOT CPACK_DEBIAN_PACKAGE_NAME)
  314. string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
  315. endif()
  316. # Version: (mandatory)
  317. if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
  318. if(NOT CPACK_PACKAGE_VERSION)
  319. message(FATAL_ERROR "CPackDeb: Debian package requires a package version")
  320. endif()
  321. set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
  322. endif()
  323. if(DEFINED CPACK_DEBIAN_PACKAGE_RELEASE OR DEFINED CPACK_DEBIAN_PACKAGE_EPOCH)
  324. # only test the version format if CPACK_DEBIAN_PACKAGE_RELEASE or
  325. # CPACK_DEBIAN_PACKAGE_EPOCH is set
  326. if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+~-]*$")
  327. message(FATAL_ERROR
  328. "CPackDeb: Debian package version must confirm to \"^[0-9][A-Za-z0-9.+~-]*$\" regex!")
  329. endif()
  330. else()
  331. # before CMake 3.10 version format was not tested so only warn to preserve
  332. # backward compatibility
  333. if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^([0-9]+:)?[0-9][A-Za-z0-9.+~-]*$")
  334. message(AUTHOR_WARNING
  335. "CPackDeb: Debian package versioning ([<epoch>:]<version>[-<release>])"
  336. " should confirm to \"^([0-9]+:)?[0-9][A-Za-z0-9.+~-]*$\" regex in"
  337. " order to satisfy Debian packaging rules.")
  338. endif()
  339. endif()
  340. if(CPACK_DEBIAN_PACKAGE_RELEASE)
  341. if(NOT CPACK_DEBIAN_PACKAGE_RELEASE MATCHES "^[A-Za-z0-9.+~]+$")
  342. message(FATAL_ERROR
  343. "CPackDeb: Debian package release must confirm to \"^[A-Za-z0-9.+~]+$\" regex!")
  344. endif()
  345. string(APPEND CPACK_DEBIAN_PACKAGE_VERSION
  346. "-${CPACK_DEBIAN_PACKAGE_RELEASE}")
  347. elseif(DEFINED CPACK_DEBIAN_PACKAGE_EPOCH)
  348. # only test the version format if CPACK_DEBIAN_PACKAGE_RELEASE or
  349. # CPACK_DEBIAN_PACKAGE_EPOCH is set - versions CPack/Deb generator before
  350. # CMake 3.10 did not check for version format so we have to preserve
  351. # backward compatibility
  352. if(CPACK_DEBIAN_PACKAGE_VERSION MATCHES ".*-.*")
  353. message(FATAL_ERROR
  354. "CPackDeb: Debian package version must not contain hyphens when CPACK_DEBIAN_PACKAGE_RELEASE is not provided!")
  355. endif()
  356. endif()
  357. if(CPACK_DEBIAN_PACKAGE_EPOCH)
  358. if(NOT CPACK_DEBIAN_PACKAGE_EPOCH MATCHES "^[0-9]+$")
  359. message(FATAL_ERROR
  360. "CPackDeb: Debian package epoch must confirm to \"^[0-9]+$\" regex!")
  361. endif()
  362. set(CPACK_DEBIAN_PACKAGE_VERSION
  363. "${CPACK_DEBIAN_PACKAGE_EPOCH}:${CPACK_DEBIAN_PACKAGE_VERSION}")
  364. endif()
  365. # Architecture: (mandatory)
  366. if(CPACK_DEB_PACKAGE_COMPONENT AND CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE)
  367. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE}")
  368. elseif(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
  369. # There is no such thing as i686 architecture on debian, you should use i386 instead
  370. # $ dpkg --print-architecture
  371. find_program(DPKG_CMD dpkg)
  372. if(NOT DPKG_CMD)
  373. message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
  374. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
  375. endif()
  376. execute_process(COMMAND "${DPKG_CMD}" --print-architecture
  377. OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
  378. OUTPUT_STRIP_TRAILING_WHITESPACE
  379. )
  380. endif()
  381. # Source: (optional)
  382. # in case several packages are constructed from a unique source
  383. # (multipackaging), the source may be indicated as well.
  384. # The source might contain a version if the generated package
  385. # version is different from the source version
  386. if(NOT CPACK_DEBIAN_PACKAGE_SOURCE)
  387. set(CPACK_DEBIAN_PACKAGE_SOURCE "")
  388. endif()
  389. # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES),
  390. # this returns the successful find_package() calls, maybe this can help
  391. # Depends:
  392. # You should set: DEBIAN_PACKAGE_DEPENDS
  393. # TODO: automate 'objdump -p | grep NEEDED'
  394. # if per-component variable, overrides the global CPACK_DEBIAN_PACKAGE_${variable_type_}
  395. # automatic dependency discovery will be performed afterwards.
  396. if(CPACK_DEB_PACKAGE_COMPONENT)
  397. foreach(value_type_ IN ITEMS DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE SECTION PRIORITY NAME)
  398. set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${value_type_}")
  399. # if set, overrides the global variable
  400. if(DEFINED ${_component_var})
  401. set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}")
  402. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  403. message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} "
  404. "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'")
  405. endif()
  406. endif()
  407. endforeach()
  408. if(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS)
  409. unset(COMPONENT_DEPENDS)
  410. foreach(_PACK IN LISTS CPACK_COMPONENT_${_local_component_name}_DEPENDS)
  411. get_component_package_name(_PACK_NAME "${_PACK}")
  412. list(PREPEND COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION})")
  413. endforeach()
  414. list(JOIN COMPONENT_DEPENDS ", " COMPONENT_DEPENDS)
  415. if(COMPONENT_DEPENDS)
  416. list(PREPEND CPACK_DEBIAN_PACKAGE_DEPENDS ${COMPONENT_DEPENDS})
  417. list(JOIN CPACK_DEBIAN_PACKAGE_DEPENDS ", " CPACK_DEBIAN_PACKAGE_DEPENDS)
  418. endif()
  419. endif()
  420. endif()
  421. # at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set
  422. # to the minimal dependency of the package
  423. # Append automatically discovered dependencies .
  424. if(CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS)
  425. list(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS})
  426. list(JOIN CPACK_DEBIAN_PACKAGE_DEPENDS ", " CPACK_DEBIAN_PACKAGE_DEPENDS)
  427. endif()
  428. if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
  429. message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
  430. endif()
  431. # Maintainer: (mandatory)
  432. if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
  433. if(NOT CPACK_PACKAGE_CONTACT)
  434. message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
  435. endif()
  436. set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
  437. endif()
  438. # Description: (mandatory)
  439. # Try package description first
  440. if(CPACK_USED_DEFAULT_PACKAGE_DESCRIPTION_FILE)
  441. set(_desc_fallback)
  442. else()
  443. set(_desc_fallback "CPACK_PACKAGE_DESCRIPTION")
  444. endif()
  445. if(CPACK_DEB_PACKAGE_COMPONENT)
  446. cpack_deb_variable_fallback("CPACK_DEBIAN_PACKAGE_DESCRIPTION"
  447. "CPACK_DEBIAN_${_local_component_name}_DESCRIPTION"
  448. "CPACK_COMPONENT_${_local_component_name}_DESCRIPTION")
  449. else()
  450. cpack_deb_variable_fallback("CPACK_DEBIAN_PACKAGE_DESCRIPTION"
  451. "CPACK_DEBIAN_PACKAGE_DESCRIPTION"
  452. ${_desc_fallback})
  453. endif()
  454. # Still no description? ... and description file has set ...
  455. if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION
  456. AND CPACK_PACKAGE_DESCRIPTION_FILE
  457. AND NOT CPACK_PACKAGE_DESCRIPTION_FILE STREQUAL CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE)
  458. # Read `CPACK_PACKAGE_DESCRIPTION_FILE` then...
  459. file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_DEBIAN_PACKAGE_DESCRIPTION)
  460. endif()
  461. # Still no description? #2
  462. if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
  463. # Try to get `CPACK_PACKAGE_DESCRIPTION_SUMMARY` as the last hope
  464. if(CPACK_PACKAGE_DESCRIPTION_SUMMARY)
  465. set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
  466. else()
  467. # Giving up! Report an error...
  468. set(_description_failure_message
  469. "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
  470. if(CPACK_DEB_PACKAGE_COMPONENT)
  471. string(APPEND _description_failure_message
  472. " or CPACK_DEBIAN_${_local_component_name}_DESCRIPTION")
  473. endif()
  474. message(FATAL_ERROR _description_failure_message)
  475. endif()
  476. # Ok, description has set. According to the `Debian Policy Manual`_ the frist
  477. # line is a pacakge summary. Try to get it as well...
  478. # See also: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description
  479. elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY AND
  480. NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY STREQUAL CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY)
  481. # Merge summary w/ the detailed description
  482. string(PREPEND CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n")
  483. endif()
  484. # assert(CPACK_DEBIAN_PACKAGE_DESCRIPTION)
  485. # Make sure description is properly formatted
  486. cpack_deb_format_package_description(
  487. "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}"
  488. CPACK_DEBIAN_PACKAGE_DESCRIPTION
  489. )
  490. # Homepage: (optional)
  491. if(NOT CPACK_DEBIAN_PACKAGE_HOMEPAGE AND CMAKE_PROJECT_HOMEPAGE_URL)
  492. set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CMAKE_PROJECT_HOMEPAGE_URL}")
  493. endif()
  494. # Section: (recommended)
  495. if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
  496. set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
  497. endif()
  498. # Priority: (recommended)
  499. if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
  500. set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
  501. endif()
  502. if(CPACK_DEBIAN_ARCHIVE_TYPE)
  503. if(CPACK_DEBIAN_ARCHIVE_TYPE STREQUAL "paxr")
  504. message(DEPRECATION "CPACK_DEBIAN_ARCHIVE_TYPE set to old and invalid "
  505. "type 'paxr', mapping to 'gnutar'")
  506. set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
  507. elseif(NOT CPACK_DEBIAN_ARCHIVE_TYPE STREQUAL "gnutar")
  508. message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
  509. "type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
  510. endif()
  511. else()
  512. set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
  513. endif()
  514. # Compression: (recommended)
  515. if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
  516. set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
  517. endif()
  518. # Recommends:
  519. # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
  520. # Suggests:
  521. # You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
  522. # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
  523. # This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
  524. # Typical examples are:
  525. # - conffiles
  526. # - postinst
  527. # - postrm
  528. # - prerm
  529. # Usage:
  530. # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
  531. # "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
  532. # Are we packaging components ?
  533. if(CPACK_DEB_PACKAGE_COMPONENT)
  534. # override values with per component version if set
  535. foreach(VAR_NAME_ IN ITEMS PACKAGE_CONTROL_EXTRA PACKAGE_CONTROL_STRICT_PERMISSION)
  536. if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_})
  537. set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}")
  538. endif()
  539. endforeach()
  540. get_component_package_name(CPACK_DEBIAN_PACKAGE_NAME ${_local_component_name})
  541. endif()
  542. if(NOT CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY)
  543. set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY "=")
  544. endif()
  545. unset(CPACK_DEBIAN_PACKAGE_SHLIBS_LIST)
  546. if(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS)
  547. if(READELF_EXECUTABLE)
  548. foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES)
  549. extract_so_info("${_FILE}" libname soversion)
  550. if(libname AND DEFINED soversion)
  551. list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST
  552. "${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})")
  553. else()
  554. message(AUTHOR_WARNING "Shared library '${_FILE}' is missing soname or soversion. Library will not be added to DEBIAN/shlibs control file.")
  555. endif()
  556. endforeach()
  557. list(JOIN CPACK_DEBIAN_PACKAGE_SHLIBS_LIST "\n" CPACK_DEBIAN_PACKAGE_SHLIBS_LIST)
  558. else()
  559. message(FATAL_ERROR "Readelf utility is not available. CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS option is not available.")
  560. endif()
  561. endif()
  562. # add ldconfig call in default postrm and postint
  563. set(CPACK_ADD_LDCONFIG_CALL 0)
  564. foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES)
  565. get_filename_component(_DIR ${_FILE} DIRECTORY)
  566. # all files in CPACK_DEB_SHARED_OBJECT_FILES have dot at the beginning
  567. if(_DIR STREQUAL "./lib" OR _DIR STREQUAL "./usr/lib")
  568. set(CPACK_ADD_LDCONFIG_CALL 1)
  569. endif()
  570. endforeach()
  571. if(CPACK_ADD_LDCONFIG_CALL)
  572. set(CPACK_DEBIAN_GENERATE_POSTINST 1)
  573. set(CPACK_DEBIAN_GENERATE_POSTRM 1)
  574. foreach(f IN LISTS PACKAGE_CONTROL_EXTRA)
  575. get_filename_component(n "${f}" NAME)
  576. if(n STREQUAL "postinst")
  577. set(CPACK_DEBIAN_GENERATE_POSTINST 0)
  578. endif()
  579. if(n STREQUAL "postrm")
  580. set(CPACK_DEBIAN_GENERATE_POSTRM 0)
  581. endif()
  582. endforeach()
  583. else()
  584. set(CPACK_DEBIAN_GENERATE_POSTINST 0)
  585. set(CPACK_DEBIAN_GENERATE_POSTRM 0)
  586. endif()
  587. cpack_deb_variable_fallback("CPACK_DEBIAN_FILE_NAME"
  588. "CPACK_DEBIAN_${_local_component_name}_FILE_NAME"
  589. "CPACK_DEBIAN_FILE_NAME")
  590. if(CPACK_DEBIAN_FILE_NAME)
  591. if(CPACK_DEBIAN_FILE_NAME STREQUAL "DEB-DEFAULT")
  592. # Patch package file name to be in correct debian format:
  593. # <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
  594. set(CPACK_OUTPUT_FILE_NAME
  595. "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
  596. set(CPACK_DBGSYM_OUTPUT_FILE_NAME
  597. "${CPACK_DEBIAN_PACKAGE_NAME}-dbgsym_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.ddeb")
  598. else()
  599. if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
  600. message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
  601. endif()
  602. set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
  603. string(REGEX REPLACE "\.deb$" "-dbgsym.ddeb" CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
  604. endif()
  605. set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_OUTPUT_FILE_NAME}")
  606. get_filename_component(BINARY_DIR "${CPACK_OUTPUT_FILE_PATH}" DIRECTORY)
  607. set(CPACK_OUTPUT_FILE_PATH "${BINARY_DIR}/${CPACK_OUTPUT_FILE_NAME}")
  608. else()
  609. # back compatibility - don't change the name
  610. string(REGEX REPLACE "\.deb$" "-dbgsym.ddeb" CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
  611. endif()
  612. # Print out some debug information if we were asked for that
  613. if(CPACK_DEBIAN_PACKAGE_DEBUG)
  614. message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = '${CPACK_TOPLEVEL_DIRECTORY}'")
  615. message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = '${CPACK_TOPLEVEL_TAG}'")
  616. message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = '${CPACK_TEMPORARY_DIRECTORY}'")
  617. message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = '${CPACK_OUTPUT_FILE_NAME}'")
  618. message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = '${CPACK_OUTPUT_FILE_PATH}'")
  619. message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = '${CPACK_PACKAGE_FILE_NAME}'")
  620. message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = '${CPACK_PACKAGE_INSTALL_DIRECTORY}'")
  621. message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = '${CPACK_TEMPORARY_PACKAGE_FILE_NAME}'")
  622. message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = '${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}'")
  623. message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_SOURCE = '${CPACK_DEBIAN_PACKAGE_SOURCE}'")
  624. endif()
  625. # For debian source packages:
  626. # debian/control
  627. # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
  628. # .dsc
  629. # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
  630. # Builds-Depends:
  631. #if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
  632. # set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
  633. # "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
  634. # )
  635. #endif()
  636. # move variables to parent scope so that they may be used to create debian package
  637. set(GEN_CPACK_OUTPUT_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}" PARENT_SCOPE)
  638. set(GEN_CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TEMPORARY_PACKAGE_FILE_NAME}" PARENT_SCOPE)
  639. set(GEN_CPACK_DEBIAN_PACKAGE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}" PARENT_SCOPE)
  640. set(GEN_CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}" PARENT_SCOPE)
  641. set(GEN_CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_DEBIAN_PACKAGE_SECTION}" PARENT_SCOPE)
  642. set(GEN_CPACK_DEBIAN_PACKAGE_PRIORITY "${CPACK_DEBIAN_PACKAGE_PRIORITY}" PARENT_SCOPE)
  643. set(GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" PARENT_SCOPE)
  644. set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE)
  645. set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE)
  646. set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
  647. set(GEN_CPACK_DEBIAN_ARCHIVE_TYPE "${CPACK_DEBIAN_ARCHIVE_TYPE}" PARENT_SCOPE)
  648. set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE)
  649. set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE)
  650. set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE)
  651. set(GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_DEBIAN_PACKAGE_HOMEPAGE}" PARENT_SCOPE)
  652. set(GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS "${CPACK_DEBIAN_PACKAGE_PREDEPENDS}" PARENT_SCOPE)
  653. set(GEN_CPACK_DEBIAN_PACKAGE_ENHANCES "${CPACK_DEBIAN_PACKAGE_ENHANCES}" PARENT_SCOPE)
  654. set(GEN_CPACK_DEBIAN_PACKAGE_BREAKS "${CPACK_DEBIAN_PACKAGE_BREAKS}" PARENT_SCOPE)
  655. set(GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS "${CPACK_DEBIAN_PACKAGE_CONFLICTS}" PARENT_SCOPE)
  656. set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE)
  657. set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE)
  658. set(GEN_CPACK_DEBIAN_PACKAGE_SHLIBS "${CPACK_DEBIAN_PACKAGE_SHLIBS_LIST}" PARENT_SCOPE)
  659. set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE)
  660. set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION
  661. "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE)
  662. set(GEN_CPACK_DEBIAN_PACKAGE_SOURCE
  663. "${CPACK_DEBIAN_PACKAGE_SOURCE}" PARENT_SCOPE)
  664. set(GEN_CPACK_DEBIAN_GENERATE_POSTINST "${CPACK_DEBIAN_GENERATE_POSTINST}" PARENT_SCOPE)
  665. set(GEN_CPACK_DEBIAN_GENERATE_POSTRM "${CPACK_DEBIAN_GENERATE_POSTRM}" PARENT_SCOPE)
  666. set(GEN_WDIR "${WDIR}" PARENT_SCOPE)
  667. set(GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE "${CPACK_DEBIAN_DEBUGINFO_PACKAGE}" PARENT_SCOPE)
  668. if(BUILD_IDS)
  669. set(GEN_DBGSYMDIR "${DBGSYMDIR}" PARENT_SCOPE)
  670. set(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_DBGSYM_OUTPUT_FILE_NAME}" PARENT_SCOPE)
  671. list(JOIN BUILD_IDS " " BUILD_IDS)
  672. set(GEN_BUILD_IDS "${BUILD_IDS}" PARENT_SCOPE)
  673. endif()
  674. endfunction()
  675. cpack_deb_prepare_package_vars()
  676. cmake_policy(POP)