summary refs log tree commit diff
path: root/gnu/packages/qt.scm
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2017-11-02 23:03:24 +0100
committerHartmut Goebel <h.goebel@crazy-compilers.com>2018-02-18 18:39:18 +0100
commit64f390a40994da24d310c4894301585b4722912b (patch)
tree721f187b49e533eb0610a7917d675a50b1b541c4 /gnu/packages/qt.scm
parentbdf0c644dafbce2a532161f04e9bf88c9310e081 (diff)
downloadguix-64f390a40994da24d310c4894301585b4722912b.tar.gz
gnu: qtbase: Use the store paths for other packages and dynamically loaded libs.
Transfer the applicable NixOS patches as of 2018-01-19:

- Not adopted: We don't change the .cmake.in and .prf, but use config
  mechanisms provided by th Qt build system.

- src/corelib/tools/qtimezoneprivate_tz.cpp: Adopted patch: 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.

- src/corelib/kernel/qcoreapplication.cpp: Not adopted: NixOS adds plugin
  paths derived from PATH. We do not need this, since we already have
  native-search-path QT_PLUGIN_PATH.

- src/network/kernel/qdnslookup_unix.cpp,
  src/network/kernel/qhostinfo_unix.cpp: Transferred: Use hard-coded path to
  libresolv.

- src/network/ssl/qsslcontext_openssl.cpp: Not adopted: NixOS changes a
  conditional compilation for Qt 5.9 (but leaves it unchanged for Qt 5.10) to
  fix compilation with libressl.  But Qt does not support libressl anway, see
  config.tests/openssl/openssl.cpp in qtbase 5.9.4.

- src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp:
  Transferred: Use hard-coded path to libx11.

- src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp:
  Transferred: Use hard-coded path to mess's libGL, no need for a fall-back.

- src/plugins/platforms/xcb/qxcbcursor.cpp: Transferred: Use hard-coded path
  to Xcursor.

- src/plugins/platformthemes/gtk3/main.cpp: Not adopted: NixOS changes
  $XDG_DATA_DIRS and $GIO_EXTRA_MODULES in the code. We already have a
  search-path-specification for this.

- src/testlib/qtestassert.h: Decided not to adopt this for guix.

* gnu/packages/patches/qtbase-use-TZDIR.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/qt.scm (qtbase): Add comment. [source]: Use new patch.
  [arguments]<#:phases>'patch-paths': New phase.
Diffstat (limited to 'gnu/packages/qt.scm')
-rw-r--r--gnu/packages/qt.scm36
1 files changed, 35 insertions, 1 deletions
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")