rpm.rst 33 KB

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