diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2019-03-22 15:53:34 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2019-03-26 14:50:07 +0000 |
commit | 3449042f5b6a112c9984ff49ee8e5fbdea597bae (patch) | |
tree | 965fc1339de33ffd358c2565620e04f70dfe8541 | |
parent | 998740c61961c0dc3e1296f0349c23846327aea0 (diff) |
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>
-rw-r--r-- | src/corelib/configure.json | 7 | ||||
-rw-r--r-- | src/corelib/mimetypes/mimetypes.pri | 2 | ||||
-rw-r--r-- | src/corelib/mimetypes/qmimeprovider.cpp | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json index ed31299603..b7eefb58c8 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -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", diff --git a/src/corelib/mimetypes/mimetypes.pri b/src/corelib/mimetypes/mimetypes.pri index 870b6c65a5..62bbe348e4 100644 --- a/src/corelib/mimetypes/mimetypes.pri +++ b/src/corelib/mimetypes/mimetypes.pri @@ -21,5 +21,5 @@ qtConfig(mimetype) { mimetypes/qmimeglobpattern.cpp \ mimetypes/qmimeprovider.cpp - RESOURCES += mimetypes/mimetypes.qrc + qtConfig(mimetype-database): RESOURCES += mimetypes/mimetypes.qrc } diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index d5b8825972..37c8e3b157 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -54,7 +54,9 @@ static void initResources() { +#if QT_CONFIG(mimetype_database) Q_INIT_RESOURCE(mimetypes); +#endif } QT_BEGIN_NAMESPACE |