rpm.rst 32 KB

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