CPack/RPM: Add zstd compression support

Fixes: #26088
This commit is contained in:
Joel Johnson
2024-06-27 14:37:53 -06:00
committed by Brad King
parent a25be17bc4
commit fab5c030ad
3 changed files with 18 additions and 3 deletions

View File

@@ -246,9 +246,8 @@ List of CPack RPM generator specific variables:
:Default: (system default)
May be used to override RPM compression type to be used to build the
RPM. For example some Linux distribution now default to ``lzma`` or ``xz``
compression whereas older cannot use such RPM. Using this one can enforce
compression type to be used.
RPM. For example some Linux distributions default to ``xz`` or ``zstd``.
Using this, one can specify a specific compression type to be used.
Possible values are:
@@ -264,6 +263,11 @@ List of CPack RPM generator specific variables:
``gzip``
GNU Gzip compression
``zstd``
.. versionadded:: 3.31
Zstandard compression
.. variable:: CPACK_RPM_PACKAGE_AUTOREQ
CPACK_RPM_<component>_PACKAGE_AUTOREQ

View File

@@ -0,0 +1,5 @@
cpack-rpm-zstd
--------------
* The :cpack_gen:`CPack RPM Generator` gained support for ``zstd`` as a
:variable:`CPACK_RPM_COMPRESSION_TYPE` value.

View File

@@ -1049,6 +1049,12 @@ function(cpack_rpm_generate_package)
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")
elseif(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")
elseif(CPACK_RPM_COMPRESSION_TYPE STREQUAL "zstd")
if(CPACK_THREADS GREATER "0")
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w19T${CPACK_THREADS}.zstdio")
else()
set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w19T0.zstdio")
endif()
else()
message(FATAL_ERROR "Specified CPACK_RPM_COMPRESSION_TYPE value is not supported: ${CPACK_RPM_COMPRESSION_TYPE}")
endif()