rpm.rst 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  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). If ``rpmbuild`` doesn't
  256. support the ``Suggests`` tag, CPack will emit a warning and ignore this
  257. variable. Note that you must enclose the complete requires string between
  258. quotes.
  259. .. variable:: CPACK_RPM_PACKAGE_PROVIDES
  260. CPACK_RPM_<component>_PACKAGE_PROVIDES
  261. RPM spec provides field.
  262. * Mandatory : NO
  263. * Default : -
  264. May be used to set RPM dependencies (provides). The provided package list
  265. of an RPM file could be printed with::
  266. rpm -qp --provides file.rpm
  267. .. variable:: CPACK_RPM_PACKAGE_OBSOLETES
  268. CPACK_RPM_<component>_PACKAGE_OBSOLETES
  269. RPM spec obsoletes field.
  270. * Mandatory : NO
  271. * Default : -
  272. May be used to set RPM packages that are obsoleted by this one.
  273. .. variable:: CPACK_RPM_PACKAGE_RELOCATABLE
  274. build a relocatable RPM.
  275. * Mandatory : NO
  276. * Default : CPACK_PACKAGE_RELOCATABLE
  277. If this variable is set to TRUE or ON, the CPack RPM generator will try
  278. to build a relocatable RPM package. A relocatable RPM may
  279. be installed using::
  280. rpm --prefix or --relocate
  281. in order to install it at an alternate place see rpm(8). Note that
  282. currently this may fail if :variable:`CPACK_SET_DESTDIR` is set to ``ON``. If
  283. :variable:`CPACK_SET_DESTDIR` is set then you will get a warning message but
  284. if there is file installed with absolute path you'll get unexpected behavior.
  285. .. variable:: CPACK_RPM_SPEC_INSTALL_POST
  286. Deprecated - use :variable:`CPACK_RPM_SPEC_MORE_DEFINE` instead.
  287. * Mandatory : NO
  288. * Default : -
  289. * Deprecated: YES
  290. May be used to override the ``__spec_install_post`` section within the
  291. generated spec file. This affects the install step during package creation,
  292. not during package installation. For adding operations to be performed
  293. during package installation, use
  294. :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead.
  295. .. variable:: CPACK_RPM_SPEC_MORE_DEFINE
  296. RPM extended spec definitions lines.
  297. * Mandatory : NO
  298. * Default : -
  299. May be used to add any ``%define`` lines to the generated spec file. An
  300. example of its use is to prevent stripping of executables (but note that
  301. this may also disable other default post install processing)::
  302. set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
  303. .. variable:: CPACK_RPM_PACKAGE_DEBUG
  304. Toggle CPack RPM generator debug output.
  305. * Mandatory : NO
  306. * Default : -
  307. May be set when invoking cpack in order to trace debug information
  308. during CPack RPM run. For example you may launch CPack like this::
  309. cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
  310. .. variable:: CPACK_RPM_USER_BINARY_SPECFILE
  311. CPACK_RPM_<componentName>_USER_BINARY_SPECFILE
  312. A user provided spec file.
  313. * Mandatory : NO
  314. * Default : -
  315. May be set by the user in order to specify a USER binary spec file
  316. to be used by the CPack RPM generator instead of generating the file.
  317. The specified file will be processed by configure_file( @ONLY).
  318. .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
  319. Spec file template.
  320. * Mandatory : NO
  321. * Default : -
  322. If set CPack will generate a template for USER specified binary
  323. spec file and stop with an error. For example launch CPack like this::
  324. cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
  325. The user may then use this file in order to hand-craft is own
  326. binary spec file which may be used with
  327. :variable:`CPACK_RPM_USER_BINARY_SPECFILE`.
  328. .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
  329. CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
  330. CPACK_RPM_PRE_TRANS_SCRIPT_FILE
  331. Path to file containing pre install/uninstall/transaction script.
  332. * Mandatory : NO
  333. * Default : -
  334. May be used to embed a pre installation/uninstallation/transaction script in the spec file.
  335. The referred script file (or both) will be read and directly
  336. put after the ``%pre`` or ``%preun`` section
  337. If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
  338. script for each component can be overridden with
  339. ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE``,
  340. ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``, and
  341. ``CPACK_RPM_<COMPONENT>_PRE_TRANS_SCRIPT_FILE``
  342. One may verify which scriptlet has been included with::
  343. rpm -qp --scripts package.rpm
  344. .. versionadded:: 3.18
  345. The ``CPACK_RPM_PRE_TRANS_SCRIPT_FILE`` variable.
  346. .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE
  347. CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
  348. CPACK_RPM_POST_TRANS_SCRIPT_FILE
  349. Path to file containing post install/uninstall/transaction script.
  350. * Mandatory : NO
  351. * Default : -
  352. May be used to embed a post installation/uninstallation/transaction script in the spec file.
  353. The referred script file (or both) will be read and directly
  354. put after the ``%post`` or ``%postun`` section.
  355. If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the install/uninstall/transaction
  356. script for each component can be overridden with
  357. ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE``,
  358. ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``, and
  359. ``CPACK_RPM_<COMPONENT>_POST_TRANS_SCRIPT_FILE``
  360. One may verify which scriptlet has been included with::
  361. rpm -qp --scripts package.rpm
  362. .. versionadded:: 3.18
  363. The ``CPACK_RPM_POST_TRANS_SCRIPT_FILE`` variable.
  364. .. variable:: CPACK_RPM_USER_FILELIST
  365. CPACK_RPM_<COMPONENT>_USER_FILELIST
  366. * Mandatory : NO
  367. * Default : -
  368. May be used to explicitly specify ``%(<directive>)`` file line
  369. in the spec file. Like ``%config(noreplace)`` or any other directive
  370. that be found in the ``%files`` section. Since
  371. the CPack RPM generator is generating the list of files (and directories) the
  372. user specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will
  373. be removed from the generated list. If referring to directories do
  374. not add a trailing slash.
  375. .. versionadded:: 3.8
  376. You can have multiple directives per line, as in
  377. ``%attr(600,root,root) %config(noreplace)``.
  378. .. variable:: CPACK_RPM_CHANGELOG_FILE
  379. RPM changelog file.
  380. * Mandatory : NO
  381. * Default : -
  382. May be used to embed a changelog in the spec file.
  383. The referred file will be read and directly put after the ``%changelog``
  384. section.
  385. .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST
  386. list of path to be excluded.
  387. * Mandatory : NO
  388. * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib
  389. /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal
  390. /usr/share/doc
  391. May be used to exclude path (directories or files) from the auto-generated
  392. list of paths discovered by CPack RPM. The default value contains a
  393. reasonable set of values if the variable is not defined by the user. If the
  394. variable is defined by the user then the CPack RPM generator will NOT any of
  395. the default path. If you want to add some path to the default list then you
  396. can use :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable.
  397. .. versionadded:: 3.10
  398. Added ``/usr/share/aclocal`` to the default list of excludes.
  399. .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
  400. additional list of path to be excluded.
  401. * Mandatory : NO
  402. * Default : -
  403. May be used to add more exclude path (directories or files) from the initial
  404. default list of excluded paths. See
  405. :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST`.
  406. .. variable:: CPACK_RPM_RELOCATION_PATHS
  407. .. versionadded:: 3.2
  408. Packages relocation paths list.
  409. * Mandatory : NO
  410. * Default : -
  411. May be used to specify more than one relocation path per relocatable RPM.
  412. Variable contains a list of relocation paths that if relative are prefixed
  413. by the value of :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` or by the
  414. value of :variable:`CPACK_PACKAGING_INSTALL_PREFIX` if the component version
  415. is not provided.
  416. Variable is not component based as its content can be used to set a different
  417. path prefix for e.g. binary dir and documentation dir at the same time.
  418. Only prefixes that are required by a certain component are added to that
  419. component - component must contain at least one file/directory/symbolic link
  420. with :variable:`CPACK_RPM_RELOCATION_PATHS` prefix for a certain relocation
  421. path to be added. Package will not contain any relocation paths if there are
  422. no files/directories/symbolic links on any of the provided prefix locations.
  423. Packages that either do not contain any relocation paths or contain
  424. files/directories/symbolic links that are outside relocation paths print
  425. out an ``AUTHOR_WARNING`` that RPM will be partially relocatable.
  426. .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
  427. .. versionadded:: 3.2
  428. Per component relocation path install prefix.
  429. * Mandatory : NO
  430. * Default : CPACK_PACKAGING_INSTALL_PREFIX
  431. May be used to set per component :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
  432. for relocatable RPM packages.
  433. .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION
  434. CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION
  435. .. versionadded:: 3.3
  436. Removal of default install prefix from relocation paths list.
  437. * Mandatory : NO
  438. * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
  439. are treated as one of relocation paths
  440. May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
  441. from relocatable RPM prefix paths.
  442. .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS
  443. .. versionadded:: 3.3
  444. * Mandatory : NO
  445. * Default : -
  446. May be used to set additional man dirs that could potentially be compressed
  447. by brp-compress RPM macro. Variable content must be a list of regular
  448. expressions that point to directories containing man files or to man files
  449. directly. Note that in order to compress man pages a path must also be
  450. present in brp-compress RPM script and that brp-compress script must be
  451. added to RPM configuration by the operating system.
  452. Regular expressions that are added by default were taken from brp-compress
  453. RPM macro:
  454. - /usr/man/man.*
  455. - /usr/man/.*/man.*
  456. - /usr/info.*
  457. - /usr/share/man/man.*
  458. - /usr/share/man/.*/man.*
  459. - /usr/share/info.*
  460. - /usr/kerberos/man.*
  461. - /usr/X11R6/man/man.*
  462. - /usr/lib/perl5/man/man.*
  463. - /usr/share/doc/.*/man/man.*
  464. - /usr/lib/.*/man/man.*
  465. .. variable:: CPACK_RPM_DEFAULT_USER
  466. CPACK_RPM_<compName>_DEFAULT_USER
  467. .. versionadded:: 3.6
  468. default user ownership of RPM content
  469. * Mandatory : NO
  470. * Default : root
  471. Value should be user name and not UID.
  472. Note that <compName> must be in upper-case.
  473. .. variable:: CPACK_RPM_DEFAULT_GROUP
  474. CPACK_RPM_<compName>_DEFAULT_GROUP
  475. .. versionadded:: 3.6
  476. default group ownership of RPM content
  477. * Mandatory : NO
  478. * Default : root
  479. Value should be group name and not GID.
  480. Note that <compName> must be in upper-case.
  481. .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS
  482. CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS
  483. .. versionadded:: 3.6
  484. default permissions used for packaged files
  485. * Mandatory : NO
  486. * Default : - (system default)
  487. Accepted values are lists with ``PERMISSIONS``. Valid permissions
  488. are:
  489. - OWNER_READ
  490. - OWNER_WRITE
  491. - OWNER_EXECUTE
  492. - GROUP_READ
  493. - GROUP_WRITE
  494. - GROUP_EXECUTE
  495. - WORLD_READ
  496. - WORLD_WRITE
  497. - WORLD_EXECUTE
  498. Note that <compName> must be in upper-case.
  499. .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS
  500. CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS
  501. .. versionadded:: 3.6
  502. default permissions used for packaged directories
  503. * Mandatory : NO
  504. * Default : - (system default)
  505. Accepted values are lists with PERMISSIONS. Valid permissions
  506. are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`.
  507. Note that <compName> must be in upper-case.
  508. .. variable:: CPACK_RPM_INSTALL_WITH_EXEC
  509. .. versionadded:: 3.11
  510. force execute permissions on programs and shared libraries
  511. * Mandatory : NO
  512. * Default : - (system default)
  513. Force set owner, group and world execute permissions on programs and shared
  514. libraries. This can be used for creating valid rpm packages on systems such
  515. as Debian where shared libraries do not have execute permissions set.
  516. .. note::
  517. Programs and shared libraries without execute permissions are ignored during
  518. separation of debug symbols from the binary for debuginfo packages.
  519. Packaging of Symbolic Links
  520. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  521. .. versionadded:: 3.3
  522. The CPack RPM generator supports packaging of symbolic links::
  523. execute_process(COMMAND ${CMAKE_COMMAND}
  524. -E create_symlink <relative_path_location> <symlink_name>)
  525. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name>
  526. DESTINATION <symlink_location> COMPONENT libraries)
  527. Symbolic links will be optimized (paths will be shortened if possible)
  528. before being added to the package or if multiple relocation paths are
  529. detected, a post install symlink relocation script will be generated.
  530. Symbolic links may point to locations that are not packaged by the same
  531. package (either a different component or even not packaged at all) but
  532. those locations will be treated as if they were a part of the package
  533. while determining if symlink should be either created or present in a
  534. post install script - depending on relocation paths.
  535. .. versionchanged:: 3.6
  536. Symbolic links that point to locations outside packaging path produce a
  537. warning and are treated as non relocatable permanent symbolic links.
  538. Previous versions of CMake produced an error in this case.
  539. Currently there are a few limitations though:
  540. * For component based packaging component interdependency is not checked
  541. when processing symbolic links. Symbolic links pointing to content of
  542. a different component are treated the same way as if pointing to location
  543. that will not be packaged.
  544. * Symbolic links pointing to a location through one or more intermediate
  545. symbolic links will not be handled differently - if the intermediate
  546. symbolic link(s) is also on a relocatable path, relocating it during
  547. package installation may cause initial symbolic link to point to an
  548. invalid location.
  549. Packaging of debug information
  550. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  551. .. versionadded:: 3.7
  552. Debuginfo packages contain debug symbols and sources for debugging packaged
  553. binaries.
  554. Debuginfo RPM packaging has its own set of variables:
  555. .. variable:: CPACK_RPM_DEBUGINFO_PACKAGE
  556. CPACK_RPM_<component>_DEBUGINFO_PACKAGE
  557. Enable generation of debuginfo RPM package(s).
  558. * Mandatory : NO
  559. * Default : OFF
  560. .. note::
  561. Binaries must contain debug symbols before packaging so use either ``Debug``
  562. or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value.
  563. Additionally, if :variable:`CPACK_STRIP_FILES` is set, the files will be stripped before
  564. they get to the RPM generator, so will not contain debug symbols and
  565. a debuginfo package will not get built. Do not use with :variable:`CPACK_STRIP_FILES`.
  566. .. note::
  567. Packages generated from packages without binary files, with binary files but
  568. without execute permissions or without debug symbols will cause packaging
  569. termination.
  570. .. variable:: CPACK_BUILD_SOURCE_DIRS
  571. Provides locations of root directories of source files from which binaries
  572. were built.
  573. * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
  574. * Default : -
  575. .. note::
  576. For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to
  577. point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths.
  578. .. note::
  579. Sources with path prefixes that do not fall under any location provided with
  580. :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package.
  581. .. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX
  582. CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX
  583. Prefix of location where sources will be placed during package installation.
  584. * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set
  585. * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and
  586. for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>"
  587. .. note::
  588. Each source path prefix is additionally suffixed by ``src_<index>`` where
  589. index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS`
  590. variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>``
  591. replacement path.
  592. Limitation is that replaced path part must be shorter or of equal
  593. length than the length of its replacement. If that is not the case either
  594. :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to
  595. a shorter path or source directories must be placed on a longer path.
  596. .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS
  597. Directories containing sources that should be excluded from debuginfo packages.
  598. * Mandatory : NO
  599. * Default : "/usr /usr/src /usr/src/debug"
  600. Listed paths are owned by other RPM packages and should therefore not be
  601. deleted on debuginfo package uninstallation.
  602. .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION
  603. Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS`
  604. for exclusion.
  605. * Mandatory : NO
  606. * Default : -
  607. .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE
  608. .. versionadded:: 3.8
  609. Create a single debuginfo package even if components packaging is set.
  610. * Mandatory : NO
  611. * Default : OFF
  612. When this variable is enabled it produces a single debuginfo package even if
  613. component packaging is enabled.
  614. When using this feature in combination with components packaging and there is
  615. more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT`
  616. to be set.
  617. .. note::
  618. If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables
  619. is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to
  620. ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set.
  621. .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME
  622. CPACK_RPM_<component>_DEBUGINFO_FILE_NAME
  623. .. versionadded:: 3.9
  624. Debuginfo package file name.
  625. * Mandatory : NO
  626. * Default : rpmbuild tool generated package file name
  627. Alternatively provided debuginfo package file name must end with ``.rpm``
  628. suffix and should differ from file names of other generated packages.
  629. Variable may contain ``@cpack_component@`` placeholder which will be
  630. replaced by component name if component packaging is enabled otherwise it
  631. deletes the placeholder.
  632. Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set
  633. filename generation to default.
  634. .. note::
  635. :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package
  636. file name - disabled by default but can be enabled by setting the variable to
  637. ``RPM-DEFAULT``.
  638. Packaging of sources (SRPM)
  639. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  640. .. versionadded:: 3.7
  641. SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES`
  642. variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable
  643. to provide directory containing CMakeLists.txt and source files.
  644. For CMake projects SRPM package would be produced by executing::
  645. cpack -G RPM --config ./CPackSourceConfig.cmake
  646. .. note::
  647. Produced SRPM package is expected to be built with :manual:`cmake(1)` executable
  648. and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be
  649. located in root source directory and must be able to generate binary rpm
  650. packages by executing ``cpack -G`` command. The two executables as well as
  651. rpmbuild must also be present when generating binary rpm packages from the
  652. produced SRPM package.
  653. Once the SRPM package is generated it can be used to generate binary packages
  654. by creating a directory structure for rpm generation and executing rpmbuild
  655. tool::
  656. mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
  657. rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>
  658. Generated packages will be located in build_dir/RPMS directory or its sub
  659. directories.
  660. .. note::
  661. SRPM package internally uses CPack/RPM generator to generate binary packages
  662. so CMakeScripts.txt can decide during the SRPM to binary rpm generation step
  663. what content the package(s) should have as well as how they should be packaged
  664. (monolithic or components). CMake can decide this for e.g. by reading environment
  665. variables set by the package manager before starting the process of generating
  666. binary rpm packages. This way a single SRPM package can be used to produce
  667. different binary rpm packages on different platforms depending on the platform's
  668. packaging rules.
  669. Source RPM packaging has its own set of variables:
  670. .. variable:: CPACK_RPM_PACKAGE_SOURCES
  671. Should the content be packaged as a source rpm (default is binary rpm).
  672. * Mandatory : NO
  673. * Default : OFF
  674. .. note::
  675. For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set
  676. to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake
  677. generated files.
  678. .. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
  679. Additional command-line parameters provided to :manual:`cmake(1)` executable.
  680. * Mandatory : NO
  681. * Default : -
  682. .. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX
  683. Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`
  684. variable for producing binary RPM packages.
  685. * Mandatory : YES
  686. * Default : "/"
  687. .. variable:: CPACK_RPM_BUILDREQUIRES
  688. List of source rpm build dependencies.
  689. * Mandatory : NO
  690. * Default : -
  691. May be used to set source RPM build dependencies (BuildRequires). Note that
  692. you must enclose the complete build requirements string between quotes, for
  693. example::
  694. set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8")
  695. .. variable:: CPACK_RPM_REQUIRES_EXCLUDE_FROM
  696. .. versionadded:: 3.22
  697. * Mandatory : NO
  698. * Default : -
  699. May be used to keep the dependency generator from scanning specific files
  700. or directories for dependencies. Note that you can use a regular
  701. expression that matches all of the directories or files, for example::
  702. set(CPACK_RPM_REQUIRES_EXCLUDE_FROM "bin/libqsqloci.*\\.so.*")