diff options
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/patches/qtbase-use-TZDIR.patch | 39 | ||||
-rw-r--r-- | gnu/packages/qt.scm | 36 |
3 files changed, 75 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 2c29dc8f95..e5a9475781 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1047,6 +1047,7 @@ dist_patch_DATA = \ %D%/packages/patches/qemu-CVE-2017-15038.patch \ %D%/packages/patches/qemu-CVE-2017-15289.patch \ %D%/packages/patches/qt4-ldflags.patch \ + %D%/packages/patches/qtbase-use-TZDIR.patch \ %D%/packages/patches/qtscript-disable-tests.patch \ %D%/packages/patches/quagga-reproducible-build.patch \ %D%/packages/patches/quassel-fix-tls-check.patch \ diff --git a/gnu/packages/patches/qtbase-use-TZDIR.patch b/gnu/packages/patches/qtbase-use-TZDIR.patch new file mode 100644 index 0000000000..11c737d844 --- /dev/null +++ b/gnu/packages/patches/qtbase-use-TZDIR.patch @@ -0,0 +1,39 @@ +Use $TZDIR to search for time-zone data. Thus avoid depending on package +"tzdata", which often introduces changes with near-immediate effects, so it's +important to be able to update it fast. + +Based on a patch fron NixOS. +=================================================================== +--- qtbase-opensource-src-5.9.4.orig/src/corelib/tools/qtimezoneprivate_tz.cpp ++++ qtbase-opensource-src-5.9.4/src/corelib/tools/qtimezoneprivate_tz.cpp +@@ -70,7 +70,11 @@ + // Parse zone.tab table, assume lists all installed zones, if not will need to read directories + static QTzTimeZoneHash loadTzTimeZones() + { +- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab"); ++ // Try TZDIR first, in case we're running on GuixSD. ++ QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab"); ++ // Fallback to traditional paths in case we are not on GuixSD. ++ if (!QFile::exists(path)) ++ path = QStringLiteral("/usr/share/zoneinfo/zone.tab"); + if (!QFile::exists(path)) + path = QStringLiteral("/usr/lib/zoneinfo/zone.tab"); + +@@ -645,6 +649,9 @@ + if (!tzif.open(QIODevice::ReadOnly)) + return; + } else { ++ // Try TZDIR first, in case we're running on GuixSD. ++ tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId)); ++ if (!tzif.open(QIODevice::ReadOnly)) { + // Open named tz, try modern path first, if fails try legacy path + tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId)); + if (!tzif.open(QIODevice::ReadOnly)) { +@@ -652,6 +659,7 @@ + if (!tzif.open(QIODevice::ReadOnly)) + return; + } ++ } + } + + QDataStream ds(&tzif); diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm index c663489e48..361bcf6b6e 100644 --- a/gnu/packages/qt.scm +++ b/gnu/packages/qt.scm @@ -36,6 +36,7 @@ #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bison) #:use-module (gnu packages compression) #:use-module (gnu packages cups) @@ -380,6 +381,8 @@ developers using C++ or QML, a CSS & JavaScript like language.") (sha256 (base32 "1kq422vb2zaic099pgzwk7c0qzgc3xap6qahw5vklrq0mgivvrk9")) + ;; Use TZDIR to avoid depending on package "tzdata". + (patches (search-patches "qtbase-use-TZDIR.patch")) (modules '((guix build utils))) (snippet ;; corelib uses bundled harfbuzz, md4, md5, sha3 @@ -541,7 +544,38 @@ developers using C++ or QML, a CSS & JavaScript like language.") "qt_config.prf" "winrt/package_manifest.prf")) (("\\$\\$\\[QT_HOST_DATA/get\\]") archdata) (("\\$\\$\\[QT_HOST_DATA/src\\]") archdata)) - #t)))))) + #t))) + (add-after 'unpack 'patch-paths + ;; Use the absolute paths for dynamically loaded libs, otherwise + ;; the lib will be searched in LD_LIBRARY_PATH which typically is + ;; not set in guix. + (lambda* (#:key inputs #:allow-other-keys) + ;; libresolve + (let ((glibc (assoc-ref inputs ,(if (%current-target-system) + "cross-libc" "libc")))) + (substitute* '("src/network/kernel/qdnslookup_unix.cpp" + "src/network/kernel/qhostinfo_unix.cpp") + (("^\\s*(lib.setFileName\\(QLatin1String\\(\")(resolv\"\\)\\);)" _ a b) + (string-append a glibc "/lib/lib" b)))) + ;; X11/locale (compose path) + (substitute* "src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp" + ;; Don't search in /usr/…/X11/locale, … + (("^\\s*m_possibleLocations.append\\(QStringLiteral\\(\"/usr/.*/X11/locale\"\\)\\);" line) + (string-append "// " line)) + ;; … but use libx11's path + (("^\\s*(m_possibleLocations.append\\(QStringLiteral\\()X11_PREFIX \"(/.*/X11/locale\"\\)\\);)" _ a b) + (string-append a "\"" (assoc-ref inputs "libx11") b))) + ;; libGL + (substitute* "src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp" + (("^\\s*(QLibrary lib\\(QLatin1String\\(\")(GL\"\\)\\);)" _ a b) + (string-append a (assoc-ref inputs "mesa") "/lib/lib" b))) + ;; libXcursor + (substitute* "src/plugins/platforms/xcb/qxcbcursor.cpp" + (("^\\s*(QLibrary xcursorLib\\(QLatin1String\\(\")(Xcursor\"\\), 1\\);)" _ a b) + (string-append a (assoc-ref inputs "libxcursor") "/lib/lib" b)) + (("^\\s*(xcursorLib.setFileName\\(QLatin1String\\(\")(Xcursor\"\\)\\);)" _ a b) + (string-append a (assoc-ref inputs "libxcursor") "/lib/lib" b))) + #t))))) (native-search-paths (list (search-path-specification (variable "QMAKEPATH") |