Add an option to select the preferred compression type for mime type db

Add the '-mimetype-database-compression' command line argument that
allows to select the preferred compression type for the mime type
database, including 'none' compression type, which avoids mime type
database compression even if respective compression APIs are present
in the system. The argument has the CMake alias called
'INPUT_mimetype_database_compression'.

Change-Id: I66daddae7014d109fa175a5f397e984928f4ee47
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alexey Edelev 2022-11-14 12:16:28 +01:00
parent 8e9818e629
commit 81931f8c54
3 changed files with 18 additions and 1 deletions

View File

@ -170,3 +170,5 @@ The following table describes the mapping of configure options to CMake argument
| -sql-<driver> | -DFEATURE_sql_<driver>=ON | |
| -sqlite [qt/system] | -DFEATURE_system_sqlite=OFF/ON | |
| -disable-deprecated-up-to <hex_version> | -DQT_DISABLE_DEPRECATED_UP_TO=<hex_version> | |
| -mimetype-database-compression <type> | -DINPUT_mimetype_database_compression=<type> | Sets the compression type for mime type database. Supported |
| | | types: gzip, zstd, none. |

View File

@ -1250,7 +1250,21 @@ if(QT_FEATURE_mimetype AND QT_FEATURE_mimetype_database)
endif()
endif()
if(QT_FEATURE_zstd)
if(DEFINED INPUT_mimetype_database_compression)
set(supported_compression_types zstd gzip none)
if(INPUT_mimetype_database_compression IN_LIST supported_compression_types)
set(compression_type ${INPUT_mimetype_database_compression})
else()
message(FATAL_ERROR "Unknown mime type database compression is set:"
" ${INPUT_mimetype_database_compression}\nSupported compression types:\n"
" ${supported_compression_types}")
endif()
if(compression_type STREQUAL "zstd" AND NOT QT_FEATURE_zstd)
message(FATAL_ERROR
"zstd compression is selected for mime type database, but the 'zstd'"
" feature is disabled.")
endif()
elseif(QT_FEATURE_zstd)
set(compression_type "zstd")
else()
set(compression_type "gzip")

View File

@ -9,6 +9,7 @@ qt_commandline_option(inotify TYPE boolean)
qt_commandline_option(journald TYPE boolean)
qt_commandline_option(libb2 TYPE enum VALUES no qt system)
qt_commandline_option(mimetype-database TYPE boolean)
qt_commandline_option(mimetype-database-compression TYPE optionalString VALUES zstd gzip none)
qt_commandline_option(pcre TYPE enum VALUES no qt system)
qt_commandline_option(posix-ipc TYPE boolean NAME ipc_posix)
qt_commandline_option(pps TYPE boolean NAME qqnx_pps)