QMimeDatabase: allow building without our internal copy

Saves 234kB of read-only data (when compressed with zstd) in QtCore,
plus one load-time execution. With Zlib, the size was 315 kB.

[ChangeLog][QtCore][QMimeDatabase] Added configure option
-no-mimetype-database that tells Qt not to bundle its own copy of the
XDG MIME database. If this option is passed, QMimeDatabase will only
work if there's a system copy in $XDG_DATA_DIRS/mime. This option is
useful for Linux distributions that ensure the data is always present.

Change-Id: I1004b4b819774c4c9296fffd158e69c490e88fb6
Reviewed-by: David Faure <david.faure@kdab.com>
bb10
Thiago Macieira 2019-03-22 15:53:34 -07:00
parent 998740c619
commit 3449042f5b
3 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,7 @@
"icu": "boolean",
"inotify": "boolean",
"journald": "boolean",
"mimetype-database": "boolean",
"pcre": { "type": "enum", "values": [ "qt", "system" ] },
"posix-ipc": { "type": "boolean", "name": "ipc_posix" },
"pps": { "type": "boolean", "name": "qqnx_pps" },
@ -678,6 +679,11 @@
"condition": "features.textcodec",
"output": [ "publicFeature", "feature" ]
},
"mimetype-database": {
"label": "Built-in copy of the MIME database",
"condition": "features.mimetype",
"output": [ "privateFeature" ]
},
"system-pcre2": {
"label": "Using system PCRE2",
"disable": "input.pcre == 'qt'",
@ -1048,6 +1054,7 @@ Please apply the patch corresponding to your Standard Library vendor, found in
"glib",
"iconv",
"icu",
"mimetype-database",
{
"message": "Tracing backend",
"type": "firstAvailableFeature",

View File

@ -21,5 +21,5 @@ qtConfig(mimetype) {
mimetypes/qmimeglobpattern.cpp \
mimetypes/qmimeprovider.cpp
RESOURCES += mimetypes/mimetypes.qrc
qtConfig(mimetype-database): RESOURCES += mimetypes/mimetypes.qrc
}

View File

@ -54,7 +54,9 @@
static void initResources()
{
#if QT_CONFIG(mimetype_database)
Q_INIT_RESOURCE(mimetypes);
#endif
}
QT_BEGIN_NAMESPACE