rpm.rst 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  1. CPack RPM Generator
  2. -------------------
  3. The built in (binary) CPack RPM generator (Unix only)
  4. Variables specific to CPack RPM generator
  5. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6. The CPack RPM generator may be used to create RPM packages using :module:`CPack`.
  7. The CPack RPM generator is a :module:`CPack` generator thus it uses the
  8. ``CPACK_XXX`` variables used by :module:`CPack`.
  9. The CPack RPM generator has specific features which are controlled by the specifics
  10. ``CPACK_RPM_XXX`` variables.
  11. ``CPACK_RPM_<COMPONENT>_XXXX`` variables may be used in order to have
  12. **component** specific values. Note however that ``<COMPONENT>`` refers to the
  13. **grouping name** written in upper case. It may be either a component name or
  14. a component GROUP name. Usually those variables correspond to RPM spec file
  15. entities. One may find information about spec files here
  16. http://www.rpm.org/wiki/Docs
  17. .. note::
  18. `<COMPONENT>` part of variables is preferred to be in upper case (e.g. if
  19. component is named ``foo`` then use ``CPACK_RPM_FOO_XXXX`` variable name format)
  20. as is with other ``CPACK_<COMPONENT>_XXXX`` variables.
  21. For the purposes of back compatibility (CMake/CPack version 3.5 and lower)
  22. support for same cased component (e.g. ``fOo`` would be used as
  23. ``CPACK_RPM_fOo_XXXX``) is still supported for variables defined in older
  24. versions of CMake/CPack but is not guaranteed for variables that
  25. will be added in the future. For the sake of back compatibility same cased
  26. component variables also override upper cased versions where both are
  27. present.
  28. Here are some CPack RPM generator wiki resources that are here for historic
  29. reasons and are no longer maintained but may still prove useful:
  30. - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Configuration
  31. - https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators#rpm-unix-only
  32. List of CPack RPM generator specific variables:
  33. .. variable:: CPACK_RPM_COMPONENT_INSTALL
  34. Enable component packaging for CPack RPM generator
  35. * Mandatory : NO
  36. * Default : OFF
  37. If enabled (``ON``) multiple packages are generated. By default
  38. a single package containing files of all components is generated.
  39. .. variable:: CPACK_RPM_PACKAGE_SUMMARY
  40. CPACK_RPM_<component>_PACKAGE_SUMMARY
  41. The RPM package summary.
  42. * Mandatory : YES
  43. * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
  44. .. variable:: CPACK_RPM_PACKAGE_NAME
  45. CPACK_RPM_<component>_PACKAGE_NAME
  46. The RPM package name.
  47. * Mandatory : YES
  48. * Default : :variable:`CPACK_PACKAGE_NAME`
  49. .. variable:: CPACK_RPM_FILE_NAME
  50. CPACK_RPM_<component>_FILE_NAME
  51. Package file name.
  52. * Mandatory : YES
  53. * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces
  54. replaced by '-'
  55. This may be set to ``RPM-DEFAULT`` to allow ``rpmbuild`` tool to generate package
  56. file name by itself.
  57. Alternatively provided package file name must end with ``.rpm`` suffix.
  58. .. note::
  59. By using user provided spec file, rpm macro extensions such as for
  60. generating ``debuginfo`` packages or by simply using multiple components more
  61. than one rpm file may be generated, either from a single spec file or from
  62. multiple spec files (each component execution produces its own spec file).
  63. In such cases duplicate file names may occur as a result of this variable
  64. setting or spec file content structure. Duplicate files get overwritten
  65. and it is up to the packager to set the variables in a manner that will
  66. prevent such errors.
  67. .. variable:: CPACK_RPM_MAIN_COMPONENT
  68. Main component that is packaged without component suffix.
  69. * Mandatory : NO
  70. * Default : -
  71. This variable can be set to any component or group name so that component or
  72. group rpm package is generated without component suffix in filename and
  73. package name.
  74. .. variable:: CPACK_RPM_PACKAGE_EPOCH
  75. The RPM package epoch
  76. * Mandatory : No
  77. * Default : -
  78. Optional number that should be incremented when changing versioning schemas
  79. or fixing mistakes in the version numbers of older packages.
  80. .. variable:: CPACK_RPM_PACKAGE_VERSION
  81. The RPM package version.
  82. * Mandatory : YES
  83. * Default : :variable:`CPACK_PACKAGE_VERSION`
  84. .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE
  85. CPACK_RPM_<component>_PACKAGE_ARCHITECTURE
  86. The RPM package architecture.
  87. * Mandatory : YES
  88. * Default : Native architecture output by ``uname -m``
  89. This may be set to ``noarch`` if you know you are building a ``noarch`` package.
  90. .. variable:: CPACK_RPM_PACKAGE_RELEASE
  91. The RPM package release.
  92. * Mandatory : YES
  93. * Default : 1
  94. This is the numbering of the RPM package itself, i.e. the version of the
  95. packaging and not the version of the content (see
  96. :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if
  97. the previous packaging was buggy and/or you want to put here a fancy Linux
  98. distro specific numbering.
  99. .. note::
  100. This is the string that goes into the RPM ``Release:`` field. Some distros
  101. (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number.
  102. ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`.
  103. .. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST
  104. The dist tag that is added RPM ``Release:`` field.
  105. * Mandatory : NO
  106. * Default : OFF
  107. This is the reported ``%{dist}`` tag from the current distribution or empty
  108. ``%{dist}`` if RPM macro is not set. If this variable is set then RPM
  109. ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``.
  110. .. variable:: CPACK_RPM_PACKAGE_LICENSE
  111. The RPM package license policy.
  112. * Mandatory : YES
  113. * Default : "unknown"
  114. .. variable:: CPACK_RPM_PACKAGE_GROUP
  115. CPACK_RPM_<component>_PACKAGE_GROUP
  116. The RPM package group.
  117. * Mandatory : YES
  118. * Default : "unknown"
  119. .. variable:: CPACK_RPM_PACKAGE_VENDOR
  120. The RPM package vendor.
  121. * Mandatory : YES
  122. * Default : CPACK_PACKAGE_VENDOR if set or "unknown"
  123. .. variable:: CPACK_RPM_PACKAGE_URL
  124. CPACK_RPM_<component>_PACKAGE_URL
  125. The projects URL.
  126. * Mandatory : NO
  127. * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL`
  128. .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION
  129. CPACK_RPM_<component>_PACKAGE_DESCRIPTION
  130. RPM package description.
  131. * Mandatory : YES
  132. * Default : :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component
  133. based installers only) if set, :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`
  134. if set or "no package description available"
  135. .. variable:: CPACK_RPM_COMPRESSION_TYPE
  136. RPM compression type.
  137. * Mandatory : NO
  138. * Default : -
  139. May be used to override RPM compression type to be used to build the
  140. RPM. For example some Linux distribution now default to ``lzma`` or ``xz``
  141. compression whereas older cannot use such RPM. Using this one can enforce
  142. compression type to be used.
  143. Possible values are:
  144. - lzma
  145. - xz
  146. - bzip2
  147. - gzip
  148. .. variable:: CPACK_RPM_PACKAGE_AUTOREQ
  149. CPACK_RPM_<component>_PACKAGE_AUTOREQ
  150. RPM spec autoreq field.
  151. * Mandatory : NO
  152. * Default : -
  153. May be used to enable (``1``, ``yes``) or disable (``0``, ``no``) automatic
  154. shared libraries dependency detection. Dependencies are added to requires list.
  155. .. note::
  156. By default automatic dependency detection is enabled by rpm generator.
  157. .. variable:: CPACK_RPM_PACKAGE_AUTOPROV
  158. CPACK_RPM_<component>_PACKAGE_AUTOPROV
  159. RPM spec autoprov field.
  160. * Mandatory : NO
  161. * Default : -
  162. May be used to enable (``1``, ``yes``) or disable (``0``, ``no``)
  163. automatic listing of shared libraries that are provided by the package.
  164. Shared libraries are added to provides list.
  165. .. note::
  166. By default automatic provides detection is enabled by rpm generator.
  167. .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV
  168. CPACK_RPM_<component>_PACKAGE_AUTOREQPROV
  169. RPM spec autoreqprov field.
  170. * Mandatory : NO
  171. * Default : -
  172. Variable enables/disables autoreq and autoprov at the same time.
  173. See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and
  174. :variable:`CPACK_RPM_PACKAGE_AUTOPROV` for more details.
  175. .. note::
  176. By default automatic detection feature is enabled by rpm.
  177. .. variable:: CPACK_RPM_PACKAGE_REQUIRES
  178. CPACK_RPM_<component>_PACKAGE_REQUIRES
  179. RPM spec requires field.
  180. * Mandatory : NO
  181. * Default : -
  182. May be used to set RPM dependencies (requires). Note that you must enclose
  183. the complete requires string between quotes, for example::
  184. set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
  185. The required package list of an RPM file could be printed with::
  186. rpm -qp --requires file.rpm
  187. .. variable:: CPACK_RPM_PACKAGE_CONFLICTS
  188. CPACK_RPM_<component>_PACKAGE_CONFLICTS
  189. RPM spec conflicts field.
  190. * Mandatory : NO
  191. * Default : -
  192. May be used to set negative RPM dependencies (conflicts). Note that you must
  193. enclose the complete requires string between quotes, for example::
  194. set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2")
  195. The conflicting package list of an RPM file could be printed with::
  196. rpm -qp --conflicts file.rpm
  197. .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE
  198. CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE
  199. RPM spec requires(pre) field.
  200. * Mandatory : NO
  201. * Default : -
  202. May be used to set RPM preinstall dependencies (requires(pre)). Note that
  203. you must enclose the complete requires string between quotes, for example::
  204. set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts")
  205. .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST
  206. CPACK_RPM_<component>_PACKAGE_REQUIRES_POST
  207. RPM spec requires(post) field.
  208. * Mandatory : NO
  209. * Default : -
  210. May be used to set RPM postinstall dependencies (requires(post)). Note that
  211. you must enclose the complete requires string between quotes, for example::
  212. set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts")
  213. .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN
  214. CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN
  215. RPM spec requires(postun) field.
  216. * Mandatory : NO
  217. * Default : -
  218. May be used to set RPM postuninstall dependencies (requires(postun)). Note
  219. that you must enclose the complete requires string between quotes, for
  220. example::
  221. set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts")
  222. .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN
  223. CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN
  224. RPM spec requires(preun) field.
  225. * Mandatory : NO
  226. * Default : -
  227. May be used to set RPM preuninstall dependencies (requires(preun)). Note that
  228. you must enclose the complete requires string between quotes, for example::
  229. set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts")
  230. .. variable:: CPACK_RPM_PACKAGE_SUGGESTS
  231. CPACK_RPM_<component>_PACKAGE_SUGGESTS
  232. RPM spec suggest field.
  233. * Mandatory : NO
  234. * Default : -
  235. May be used to set weak RPM dependencies (suggests). Note that you must
  236. enclose the complete requires string between quotes.
  237. .. variable:: CPACK_RPM_PACKAGE_PROVIDES
  238. CPACK_RPM_<component>_PACKAGE_PROVIDES
  239. RPM spec provides field.
  240. * Mandatory : NO
  241. * Default : -
  242. May be used to set RPM dependencies (provides). The provided package list
  243. of an RPM file could be printed with::
  244. rpm -qp --provides file.rpm
  245. .. variable:: CPACK_RPM_PACKAGE_OBSOLETES
  246. CPACK_RPM_<component>_PACKAGE_OBSOLETES
  247. RPM spec obsoletes field.
  248. * Mandatory : NO
  249. * Default : -
  250. May be used to set RPM packages that are obsoleted by this one.
  251. .. variable:: CPACK_RPM_PACKAGE_RELOCATABLE
  252. build a relocatable RPM.
  253. * Mandatory : NO
  254. * Default : CPACK_PACKAGE_RELOCATABLE
  255. If this variable is set to TRUE or ON, the CPack RPM generator will try
  256. to build a relocatable RPM package. A relocatable RPM may
  257. be installed using::
  258. rpm --prefix or --relocate
  259. in order to install it at an alternate place see rpm(8). Note that
  260. currently this may fail if :variable:`CPACK_SET_DESTDIR` is set to ``ON``. If
  261. :variable:`CPACK_SET_DESTDIR` is set then you will get a warning message but
  262. if there is file installed with absolute path you'll get unexpected behavior.
  263. .. variable:: CPACK_RPM_SPEC_INSTALL_POST
  264. Deprecated - use :variable:`CPACK_RPM_SPEC_MORE_DEFINE` instead.
  265. * Mandatory : NO
  266. * Default : -
  267. * Deprecated: YES
  268. May be used to override the ``__spec_install_post`` section within the
  269. generated spec file. This affects the install step during package creation,
  270. not during package installation. For adding operations to be performed
  271. during package installation, use
  272. :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead.
  273. .. variable:: CPACK_RPM_SPEC_MORE_DEFINE
  274. RPM extended spec definitions lines.
  275. * Mandatory : NO
  276. * Default : -
  277. May be used to add any ``%define`` lines to the generated spec file. An
  278. example of its use is to prevent stripping of executables (but note that
  279. this may also disable other default post install processing)::
  280. set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
  281. .. variable:: CPACK_RPM_PACKAGE_DEBUG
  282. Toggle CPack RPM generator debug output.
  283. * Mandatory : NO
  284. * Default : -
  285. May be set when invoking cpack in order to trace debug information
  286. during CPack RPM run. For example you may launch CPack like this::
  287. cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
  288. .. variable:: CPACK_RPM_USER_BINARY_SPECFILE
  289. CPACK_RPM_<componentName>_USER_BINARY_SPECFILE
  290. A user provided spec file.
  291. * Mandatory : NO
  292. * Default : -
  293. May be set by the user in order to specify a USER binary spec file
  294. to be used by the CPack RPM generator instead of generating the file.
  295. The specified file will be processed by configure_file( @ONLY).
  296. .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
  297. Spec file template.
  298. * Mandatory : NO
  299. * Default : -
  300. If set CPack will generate a template for USER specified binary
  301. spec file and stop with an error. For example launch CPack like this::
  302. cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
  303. The user may then use this file in order to hand-craft is own
  304. binary spec file which may be used with
  305. :variable:`CPACK_RPM_USER_BINARY_SPECFILE`.
  306. .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
  307. CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
  308. CPACK_RPM_PRE_TRANS_SCRIPT_FILE
  309. Path to file containing pre install/uninstall/transaction script.
  310. * Mandatory : NO
  311. * Default : -
  312. May be used to embed a pre installation/uninstallation/transaction script in the spec file.
  313. The referred script file (or both) will be read and directly
  314. put after the ``%pre`` or ``%preun`` section
  315. If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
  316. script for each component can be overridden with
  317. ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE``,
  318. ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``, and
  319. ``CPACK_RPM_<COMPONENT>_PRE_TRANS_SCRIPT_FILE``
  320. One may verify which scriptlet has been included with::
  321. rpm -qp --scripts package.rpm
  322. .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
  323. CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
  324. CPACK_RPM_POST_TRANS_SCRIPT_FILE
  325. Path to file containing post install/uninstall/transaction script.
  326. * Mandatory : NO
  327. * Default : -
  328. May be used to embed a post installation/uninstallation/transaction script in the spec file.
  329. The referred script file (or both) will be read and directly
  330. put after the ``%post`` or ``%postun`` section.
  331. If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
  332. script for each component can be overridden with
  333. ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE``,
  334. ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``, and
  335. ``CPACK_RPM_<COMPONENT>_POST_TRANS_SCRIPT_FILE``
  336. One may verify which scriptlet has been included with::
  337. rpm -qp --scripts package.rpm
  338. .. variable:: CPACK_RPM_USER_FILELIST
  339. CPACK_RPM_<COMPONENT>_USER_FILELIST
  340. * Mandatory : NO
  341. * Default : -
  342. May be used to explicitly specify ``%(<directive>)`` file line
  343. in the spec file. Like ``%config(noreplace)`` or any other directive
  344. that be found in the ``%files`` section. You can have multiple directives
  345. per line, as in ``%attr(600,root,root) %config(noreplace)``. Since
  346. the CPack RPM generator is generating the list of files (and directories) the
  347. user specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will
  348. be removed from the generated list. If referring to directories do
  349. not add a trailing slash.
  350. .. variable:: CPACK_RPM_CHANGELOG_FILE
  351. RPM changelog file.
  352. * Mandatory : NO
  353. * Default : -
  354. May be used to embed a changelog in the spec file.
  355. The referred file will be read and directly put after the ``%changelog``
  356. section.
  357. .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
  358. list of path to be excluded.
  359. * Mandatory : NO
  360. * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib
  361. /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal
  362. /usr/share/doc
  363. May be used to exclude path (directories or files) from the auto-generated
  364. list of paths discovered by CPack RPM. The default value contains a
  365. reasonable set of values if the variable is not defined by the user. If the
  366. variable is defined by the user then the CPack RPM generator will NOT any of
  367. the default path. If you want to add some path to the default list then you
  368. can use :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable.
  369. .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
  370. additional list of path to be excluded.
  371. * Mandatory : NO
  372. * Default : -
  373. May be used to add more exclude path (directories or files) from the initial
  374. default list of excluded paths. See
  375. :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST`.
  376. .. variable:: CPACK_RPM_RELOCATION_PATHS
  377. Packages relocation paths list.
  378. * Mandatory : NO
  379. * Default : -
  380. May be used to specify more than one relocation path per relocatable RPM.
  381. Variable contains a list of relocation paths that if relative are prefixed
  382. by the value of :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` or by the
  383. value of :variable:`CPACK_PACKAGING_INSTALL_PREFIX` if the component version
  384. is not provided.
  385. Variable is not component based as its content can be used to set a different
  386. path prefix for e.g. binary dir and documentation dir at the same time.
  387. Only prefixes that are required by a certain component are added to that
  388. component - component must contain at least one file/directory/symbolic link
  389. with :variable:`CPACK_RPM_RELOCATION_PATHS` prefix for a certain relocation
  390. path to be added. Package will not contain any relocation paths if there are
  391. no files/directories/symbolic links on any of the provided prefix locations.
  392. Packages that either do not contain any relocation paths or contain
  393. files/directories/symbolic links that are outside relocation paths print
  394. out an ``AUTHOR_WARNING`` that RPM will be partially relocatable.
  395. .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
  396. Per component relocation path install prefix.
  397. * Mandatory : NO
  398. * Default : CPACK_PACKAGING_INSTALL_PREFIX
  399. May be used to set per component :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
  400. for relocatable RPM packages.
  401. .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION
  402. CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION
  403. Removal of default install prefix from relocation paths list.
  404. * Mandatory : NO
  405. * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
  406. are treated as one of relocation paths
  407. May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
  408. from relocatable RPM prefix paths.
  409. .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS
  410. * Mandatory : NO
  411. * Default : -
  412. May be used to set additional man dirs that could potentially be compressed
  413. by brp-compress RPM macro. Variable content must be a list of regular
  414. expressions that point to directories containing man files or to man files
  415. directly. Note that in order to compress man pages a path must also be
  416. present in brp-compress RPM script and that brp-compress script must be
  417. added to RPM configuration by the operating system.
  418. Regular expressions that are added by default were taken from brp-compress
  419. RPM macro:
  420. - /usr/man/man.*
  421. - /usr/man/.*/man.*
  422. - /usr/info.*
  423. - /usr/share/man/man.*
  424. - /usr/share/man/.*/man.*
  425. - /usr/share/info.*
  426. - /usr/kerberos/man.*
  427. - /usr/X11R6/man/man.*
  428. - /usr/lib/perl5/man/man.*
  429. - /usr/share/doc/.*/man/man.*
  430. - /usr/lib/.*/man/man.*
  431. .. variable:: CPACK_RPM_DEFAULT_USER
  432. CPACK_RPM_<compName>_DEFAULT_USER
  433. default user ownership of RPM content
  434. * Mandatory : NO
  435. * Default : root
  436. Value should be user name and not UID.
  437. Note that <compName> must be in upper-case.
  438. .. variable:: CPACK_RPM_DEFAULT_GROUP
  439. CPACK_RPM_<compName>_DEFAULT_GROUP
  440. default group ownership of RPM content
  441. * Mandatory : NO
  442. * Default : root
  443. Value should be group name and not GID.
  444. Note that <compName> must be in upper-case.
  445. .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS
  446. CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS
  447. default permissions used for packaged files
  448. * Mandatory : NO
  449. * Default : - (system default)
  450. Accepted values are lists with ``PERMISSIONS``. Valid permissions
  451. are:
  452. - OWNER_READ
  453. - OWNER_WRITE
  454. - OWNER_EXECUTE
  455. - GROUP_READ
  456. - GROUP_WRITE
  457. - GROUP_EXECUTE
  458. - WORLD_READ
  459. - WORLD_WRITE
  460. - WORLD_EXECUTE
  461. Note that <compName> must be in upper-case.
  462. .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS
  463. CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS
  464. default permissions used for packaged directories
  465. * Mandatory : NO
  466. * Default : - (system default)
  467. Accepted values are lists with PERMISSIONS. Valid permissions
  468. are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`.
  469. Note that <compName> must be in upper-case.
  470. .. variable:: CPACK_RPM_INSTALL_WITH_EXEC
  471. force execute permissions on programs and shared libraries
  472. * Mandatory : NO
  473. * Default : - (system default)
  474. Force set owner, group and world execute permissions on programs and shared
  475. libraries. This can be used for creating valid rpm packages on systems such
  476. as Debian where shared libraries do not have execute permissions set.
  477. .. note::
  478. Programs and shared libraries without execute permissions are ignored during
  479. separation of debug symbols from the binary for debuginfo packages.
  480. Packaging of Symbolic Links
  481. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  482. The CPack RPM generator supports packaging of symbolic links::
  483. execute_process(COMMAND ${CMAKE_COMMAND}
  484. -E create_symlink <relative_path_location> <symlink_name>)
  485. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name>
  486. DESTINATION <symlink_location> COMPONENT libraries)
  487. Symbolic links will be optimized (paths will be shortened if possible)
  488. before being added to the package or if multiple relocation paths are
  489. detected, a post install symlink relocation script will be generated.
  490. Symbolic links may point to locations that are not packaged by the same
  491. package (either a different component or even not packaged at all) but
  492. those locations will be treated as if they were a part of the package
  493. while determining if symlink should be either created or present in a
  494. post install script - depending on relocation paths.
  495. Symbolic links that point to locations outside packaging path produce a
  496. warning and are treated as non relocatable permanent symbolic links.
  497. Currently there are a few limitations though:
  498. * For component based packaging component interdependency is not checked
  499. when processing symbolic links. Symbolic links pointing to content of
  500. a different component are treated the same way as if pointing to location
  501. that will not be packaged.
  502. * Symbolic links pointing to a location through one or more intermediate
  503. symbolic links will not be handled differently - if the intermediate
  504. symbolic link(s) is also on a relocatable path, relocating it during
  505. package installation may cause initial symbolic link to point to an
  506. invalid location.
  507. Packaging of debug information
  508. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  509. Debuginfo packages contain debug symbols and sources for debugging packaged
  510. binaries.
  511. Debuginfo RPM packaging has its own set of variables:
  512. .. variable:: CPACK_RPM_DEBUGINFO_PACKAGE
  513. CPACK_RPM_<component>_DEBUGINFO_PACKAGE
  514. Enable generation of debuginfo RPM package(s).
  515. * Mandatory : NO
  516. * Default : OFF
  517. .. note::
  518. Binaries must contain debug symbols before packaging so use either ``Debug``
  519. or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value.
  520. .. note::
  521. Packages generated from packages without binary files, with binary files but
  522. without execute permissions or without debug symbols will cause packaging
  523. termination.
  524. .. variable:: CPACK_BUILD_SOURCE_DIRS
  525. Provides locations of root directories of source files from which binaries
  526. were built.
  527. * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
  528. * Default : -
  529. .. note::
  530. For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to
  531. point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths.
  532. .. note::
  533. Sources with path prefixes that do not fall under any location provided with
  534. :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package.
  535. .. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX
  536. CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX
  537. Prefix of location where sources will be placed during package installation.
  538. * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
  539. * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and
  540. for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>"
  541. .. note::
  542. Each source path prefix is additionally suffixed by ``src_<index>`` where
  543. index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS`
  544. variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>``
  545. replacement path.
  546. Limitation is that replaced path part must be shorter or of equal
  547. length than the length of its replacement. If that is not the case either
  548. :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to
  549. a shorter path or source directories must be placed on a longer path.
  550. .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS
  551. Directories containing sources that should be excluded from debuginfo packages.
  552. * Mandatory : NO
  553. * Default : "/usr /usr/src /usr/src/debug"
  554. Listed paths are owned by other RPM packages and should therefore not be
  555. deleted on debuginfo package uninstallation.
  556. .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION
  557. Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS`
  558. for exclusion.
  559. * Mandatory : NO
  560. * Default : -
  561. .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE
  562. Create a single debuginfo package even if components packaging is set.
  563. * Mandatory : NO
  564. * Default : OFF
  565. When this variable is enabled it produces a single debuginfo package even if
  566. component packaging is enabled.
  567. When using this feature in combination with components packaging and there is
  568. more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT`
  569. to be set.
  570. .. note::
  571. If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables
  572. is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
  573. ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
  574. .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME
  575. CPACK_RPM_<component>_DEBUGINFO_FILE_NAME
  576. Debuginfo package file name.
  577. * Mandatory : NO
  578. * Default : rpmbuild tool generated package file name
  579. Alternatively provided debuginfo package file name must end with ``.rpm``
  580. suffix and should differ from file names of other generated packages.
  581. Variable may contain ``@cpack_component@`` placeholder which will be
  582. replaced by component name if component packaging is enabled otherwise it
  583. deletes the placeholder.
  584. Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set
  585. filename generation to default.
  586. .. note::
  587. :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package
  588. file name - disabled by default but can be enabled by setting the variable to
  589. ``RPM-DEFAULT``.
  590. Packaging of sources (SRPM)
  591. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  592. SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES`
  593. variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable
  594. to provide directory containing CMakeLists.txt and source files.
  595. For CMake projects SRPM package would be produced by executing::
  596. cpack -G RPM --config ./CPackSourceConfig.cmake
  597. .. note::
  598. Produced SRPM package is expected to be built with :manual:`cmake(1)` executable
  599. and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be
  600. located in root source directory and must be able to generate binary rpm
  601. packages by executing ``cpack -G`` command. The two executables as well as
  602. rpmbuild must also be present when generating binary rpm packages from the
  603. produced SRPM package.
  604. Once the SRPM package is generated it can be used to generate binary packages
  605. by creating a directory structure for rpm generation and executing rpmbuild
  606. tool::
  607. mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
  608. rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>
  609. Generated packages will be located in build_dir/RPMS directory or its sub
  610. directories.
  611. .. note::
  612. SRPM package internally uses CPack/RPM generator to generate binary packages
  613. so CMakeScripts.txt can decide during the SRPM to binary rpm generation step
  614. what content the package(s) should have as well as how they should be packaged
  615. (monolithic or components). CMake can decide this for e.g. by reading environment
  616. variables set by the package manager before starting the process of generating
  617. binary rpm packages. This way a single SRPM package can be used to produce
  618. different binary rpm packages on different platforms depending on the platform's
  619. packaging rules.
  620. Source RPM packaging has its own set of variables:
  621. .. variable:: CPACK_RPM_PACKAGE_SOURCES
  622. Should the content be packaged as a source rpm (default is binary rpm).
  623. * Mandatory : NO
  624. * Default : OFF
  625. .. note::
  626. For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set
  627. to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake
  628. generated files.
  629. .. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
  630. Additional command-line parameters provided to :manual:`cmake(1)` executable.
  631. * Mandatory : NO
  632. * Default : -
  633. .. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX
  634. Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
  635. variable for producing binary RPM packages.
  636. * Mandatory : YES
  637. * Default : "/"
  638. .. VARIABLE:: CPACK_RPM_BUILDREQUIRES
  639. List of source rpm build dependencies.
  640. * Mandatory : NO
  641. * Default : -
  642. May be used to set source RPM build dependencies (BuildRequires). Note that
  643. you must enclose the complete build requirements string between quotes, for
  644. example::
  645. set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8")