unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#49227] [PATCH 0/3] Some Qt/qtbase improvements.
@ 2021-06-25 18:04 Maxim Cournoyer
  2021-06-25 18:08 ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxim Cournoyer
  0 siblings, 1 reply; 6+ messages in thread
From: Maxim Cournoyer @ 2021-06-25 18:04 UTC (permalink / raw)
  To: 49227; +Cc: Maxim Cournoyer

Hello Guix!

The following 3 patches are some minor improvements for Qt in Guix.  They
allow them to use GTK themes, which noticeably improve the look of things such
as the file picker on systems using a GTK theme.  Passing the configure flags
via the #:configure-flags argument for qtbase allows package rewriting, for
example, building a static version of it:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu packages qt)
             (guix packages)
             (guix transformations)
             (guix utils))

;;; Adapted from static-package in (guix build-system gnu).
(define* (static-package-qt p #:key (strip-all? #t))
  "Return a statically-linked version of package P.  If STRIP-ALL? is true,
use `--strip-all' as the arguments to `strip'."
  (package (inherit p)
    (arguments
     (let ((a (default-keyword-arguments (package-arguments p)
                '(#:configure-flags '()
                  #:strip-flags '("--strip-debug")))))
       (substitute-keyword-arguments a
         ((#:configure-flags flags)
          `(cons* "--disable-shared" "-static" ,flags))
         ((#:strip-flags flags)
          (if strip-all?
              ''("--strip-all")
              flags)))))
    (replacement (and=> (package-replacement p) static-package-qt))))

(define qtbase-static (static-package-qt qtbase))

(packages->manifest (cons qtbase-static))
--8<---------------cut here---------------end--------------->8---

Maxim Cournoyer (3):
  build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS.
  gnu: qtbase: Enable GTK support.
  gnu: qtbase: Specify configure flags via the #:configure-flags
    argument.

 gnu/packages/qt.scm            | 168 ++++++++++++++++-----------------
 guix/build/qt-build-system.scm |  14 +--
 2 files changed, 90 insertions(+), 92 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS.
  2021-06-25 18:04 [bug#49227] [PATCH 0/3] Some Qt/qtbase improvements Maxim Cournoyer
@ 2021-06-25 18:08 ` Maxim Cournoyer
  2021-06-25 18:08   ` [bug#49227] [PATCH 2/3] gnu: qtbase: Enable GTK support Maxim Cournoyer
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2021-06-25 18:08 UTC (permalink / raw)
  To: 49227; +Cc: Maxim Cournoyer

Before this change, XDG_DATA_DIRS was wrapped using '=, which meant that it
wouldn't pick up extra icons from the user's profile, for example.  When
enabling gtk+ theming support in qtbase, that led to crashes due to GTK not
finding icons from even the hicolor icon theme fallback (which is assumed to
exist).

* guix/build/qt-build-system.scm (variables-for-wrapping): Specify an extra
'wrap-type' information per variable that gets passed to the wrap-program
procedure.  Set the XDG_DATA_DIRS variable wrapping type to 'suffix', which
allows the user to both extend and override its value.
---
 guix/build/qt-build-system.scm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/guix/build/qt-build-system.scm b/guix/build/qt-build-system.scm
index f59b0c420f..59242f5fab 100644
--- a/guix/build/qt-build-system.scm
+++ b/guix/build/qt-build-system.scm
@@ -73,17 +73,17 @@
 
   (filter-map
    (match-lambda
-     ((variable file-type directory selectors ...)
+     ((variable wrap-type file-type directory selectors ...)
       (match (collect-sub-dirs base-directories file-type directory
                                selectors)
         (()
          #f)
         (directories
-         `(,variable = ,directories)))))
+         `(,variable ,wrap-type ,directories)))))
 
    ;; These shall match the search-path-specification for Qt and KDE
    ;; libraries.
-   (list '("XDG_DATA_DIRS" directory "/share"
+   (list '("XDG_DATA_DIRS" suffix directory "/share"
 
            ;; These are "selectors": consider /share if and only if at least
            ;; one of these sub-directories exist.  This avoids adding
@@ -91,10 +91,10 @@
            ;; /share sub-directory.
            "/glib-2.0/schemas" "/sounds" "/themes"
            "/cursors" "/wallpapers" "/icons" "/mime")
-         '("XDG_CONFIG_DIRS" directory "/etc/xdg")
-         '("QT_PLUGIN_PATH" directory "/lib/qt5/plugins")
-         '("QML2_IMPORT_PATH"  directory "/lib/qt5/qml")
-         '("QTWEBENGINEPROCESS_PATH" regular
+         '("XDG_CONFIG_DIRS" = directory "/etc/xdg")
+         '("QT_PLUGIN_PATH" = directory "/lib/qt5/plugins")
+         '("QML2_IMPORT_PATH" = directory "/lib/qt5/qml")
+         '("QTWEBENGINEPROCESS_PATH" = regular
            "/lib/qt5/libexec/QtWebEngineProcess"))))
 
 (define* (wrap-all-programs #:key inputs outputs
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#49227] [PATCH 2/3] gnu: qtbase: Enable GTK support.
  2021-06-25 18:08 ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxim Cournoyer
@ 2021-06-25 18:08   ` Maxim Cournoyer
  2021-06-25 18:08   ` [bug#49227] [PATCH 3/3] gnu: qtbase: Specify configure flags via the #:configure-flags argument Maxim Cournoyer
  2021-06-26 16:32   ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxime Devos
  2 siblings, 0 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2021-06-25 18:08 UTC (permalink / raw)
  To: 49227; +Cc: Maxim Cournoyer

This allows Qt applications to use the GTK themes present on the system,
providing a more integrated look and feel for many Qt applications used in the
context of a GTK/GNOME environment.

* gnu/packages/qt.scm (qtbase-5)[inputs]: Add gtk+.
---
 gnu/packages/qt.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 19fcc2f37e..dadfbfecb5 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -338,6 +338,7 @@ system, and the core design of Django is reused in Grantlee.")
        ("fontconfig" ,fontconfig)
        ("freetype" ,freetype)
        ("glib" ,glib)
+       ("gtk+" ,gtk+)                   ;for GTK theme support
        ("harfbuzz" ,harfbuzz)
        ("icu4c" ,icu4c)
        ("libinput" ,libinput-minimal)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#49227] [PATCH 3/3] gnu: qtbase: Specify configure flags via the #:configure-flags argument.
  2021-06-25 18:08 ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxim Cournoyer
  2021-06-25 18:08   ` [bug#49227] [PATCH 2/3] gnu: qtbase: Enable GTK support Maxim Cournoyer
@ 2021-06-25 18:08   ` Maxim Cournoyer
  2021-06-26 16:32   ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxime Devos
  2 siblings, 0 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2021-06-25 18:08 UTC (permalink / raw)
  To: 49227; +Cc: Maxim Cournoyer

* gnu/packages/qt.scm (qtbase): Delete trailing #t.
[phases]{configure}: Print build directory and configure flags.
Move configure flags to...
[#:configure-flags]: ... this new argument.
---
 gnu/packages/qt.scm | 167 ++++++++++++++++++++++----------------------
 1 file changed, 82 insertions(+), 85 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index dadfbfecb5..0a9fdb965f 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -303,25 +303,24 @@ system, and the core design of Django is reused in Grantlee.")
     (name "qtbase")
     (version "5.15.2")
     (source (origin
-             (method url-fetch)
-             (uri (qt5-urls name version))
-             (sha256
-              (base32
-               "1y70libf2x52lpbqvhz10lpk7nyl1ajjwzjxly9pjdpfj4jsv7wh"))
-             ;; Use TZDIR to avoid depending on package "tzdata".
-             (patches (search-patches "qtbase-use-TZDIR.patch"
-                                      "qtbase-moc-ignore-gcc-macro.patch"
-                                      "qtbase-absolute-runpath.patch"))
-             (modules '((guix build utils)))
-             (snippet
+              (method url-fetch)
+              (uri (qt5-urls name version))
+              (sha256
+               (base32
+                "1y70libf2x52lpbqvhz10lpk7nyl1ajjwzjxly9pjdpfj4jsv7wh"))
+              ;; Use TZDIR to avoid depending on package "tzdata".
+              (patches (search-patches "qtbase-use-TZDIR.patch"
+                                       "qtbase-moc-ignore-gcc-macro.patch"
+                                       "qtbase-absolute-runpath.patch"))
+              (modules '((guix build utils)))
+              (snippet
                ;; corelib uses bundled harfbuzz, md4, md5, sha3
-              '(begin
-                (with-directory-excursion "src/3rdparty"
-                  (for-each delete-file-recursively
-                            (list "double-conversion" "freetype" "harfbuzz-ng"
-                                  "libpng" "libjpeg" "pcre2" "sqlite" "xcb"
-                                  "zlib"))
-                  #t)))))
+               '(begin
+                  (with-directory-excursion "src/3rdparty"
+                    (for-each delete-file-recursively
+                              (list "double-conversion" "freetype" "harfbuzz-ng"
+                                    "libpng" "libjpeg" "pcre2" "sqlite" "xcb"
+                                    "zlib")))))))
     (build-system gnu-build-system)
     (outputs '("out" "debug"))
     (propagated-inputs
@@ -383,7 +382,56 @@ system, and the core design of Django is reused in Grantlee.")
        ("vulkan-headers" ,vulkan-headers)
        ("ruby" ,ruby)))
     (arguments
-     `(#:phases
+     `(#:configure-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list "-verbose"
+               "-prefix" out
+               "-docdir" (string-append out "/share/doc/qt5")
+               "-headerdir" (string-append out "/include/qt5")
+               "-archdatadir" (string-append out "/lib/qt5")
+               "-datadir" (string-append out "/share/qt5")
+               "-examplesdir" (string-append
+                               out "/share/doc/qt5/examples")
+               "-opensource"
+               "-confirm-license"
+
+               ;; Later stripped into the :debug output.
+               "-force-debug-info"
+
+               ;; These features require higher versions of Linux than the
+               ;; minimum version of the glibc.  See
+               ;; src/corelib/global/minimum-linux_p.h.  By disabling these
+               ;; features Qt5 applications can be used on the oldest
+               ;; kernels that the glibc supports, including the RHEL6
+               ;; (2.6.32) and RHEL7 (3.10) kernels.
+               "-no-feature-getentropy" ; requires Linux 3.17
+               "-no-feature-renameat2"  ; requires Linux 3.16
+
+               ;; Do not build examples; if desired, these could go
+               ;; into a separate output, but for the time being, we
+               ;; prefer to save the space and build time.
+               "-no-compile-examples"
+               ;; Most "-system-..." are automatic, but some use
+               ;; the bundled copy by default.
+               "-system-sqlite"
+               "-system-harfbuzz"
+               "-system-pcre"
+               ;; explicitly link with openssl instead of dlopening it
+               "-openssl-linked"
+               ;; explicitly link with dbus instead of dlopening it
+               "-dbus-linked"
+               ;; don't use the precompiled headers
+               "-no-pch"
+               ;; drop special machine instructions that do not have
+               ;; runtime detection
+               ,@(if (string-prefix? "x86_64"
+                                     (or (%current-target-system)
+                                         (%current-system)))
+                     '()
+                     '("-no-sse2"))
+               "-no-mips_dsp"
+               "-no-mips_dspr2"))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'configure 'patch-bin-sh
            (lambda _
@@ -391,18 +439,18 @@ system, and the core design of Django is reused in Grantlee.")
                             "configure"
                             "mkspecs/features/qt_functions.prf"
                             "qmake/library/qmakebuiltins.cpp")
-                          (("/bin/sh") (which "sh")))
-             #t))
+               (("/bin/sh") (which "sh")))))
          (add-after 'configure 'patch-xdg-open
            (lambda _
              (substitute* '("src/platformsupport/services/genericunix/qgenericunixservices.cpp")
-                          (("^.*const char \\*browsers.*$" all)
-                           (string-append "*browser = QStringLiteral(\""
-                                          (which "xdg-open")
-                                          "\"); return true; \n" all)))
-             #t))
+               (("^.*const char \\*browsers.*$" all)
+                (string-append "*browser = QStringLiteral(\""
+                               (which "xdg-open")
+                               "\"); return true; \n" all)))))
          (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
+           ;; Overridden to not pass "--enable-fast-install", which makes the
+           ;; configure process fail.
+           (lambda* (#:key outputs configure-flags #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                (substitute* "configure"
                  (("/bin/pwd") (which "pwd")))
@@ -415,57 +463,9 @@ system, and the core design of Django is reused in Grantlee.")
                ;; components can be installed in different places.
                (substitute* (find-files "." ".*\\.cmake")
                  (("NO_DEFAULT_PATH") ""))
-               ;; do not pass "--enable-fast-install", which makes the
-               ;; configure process fail
-               (invoke
-                 "./configure"
-                 "-verbose"
-                 "-prefix" out
-                 "-docdir" (string-append out "/share/doc/qt5")
-                 "-headerdir" (string-append out "/include/qt5")
-                 "-archdatadir" (string-append out "/lib/qt5")
-                 "-datadir" (string-append out "/share/qt5")
-                 "-examplesdir" (string-append
-                                  out "/share/doc/qt5/examples")
-                 "-opensource"
-                 "-confirm-license"
-
-                 ;; Later stripped into the :debug output.
-                 "-force-debug-info"
-
-                 ;; These features require higher versions of Linux than the
-                 ;; minimum version of the glibc.  See
-                 ;; src/corelib/global/minimum-linux_p.h.  By disabling these
-                 ;; features Qt5 applications can be used on the oldest
-                 ;; kernels that the glibc supports, including the RHEL6
-                 ;; (2.6.32) and RHEL7 (3.10) kernels.
-                 "-no-feature-getentropy"  ; requires Linux 3.17
-                 "-no-feature-renameat2"   ; requires Linux 3.16
-
-                 ;; Do not build examples; if desired, these could go
-                 ;; into a separate output, but for the time being, we
-                 ;; prefer to save the space and build time.
-                 "-no-compile-examples"
-                 ;; Most "-system-..." are automatic, but some use
-                 ;; the bundled copy by default.
-                 "-system-sqlite"
-                 "-system-harfbuzz"
-                 "-system-pcre"
-                 ;; explicitly link with openssl instead of dlopening it
-                 "-openssl-linked"
-                 ;; explicitly link with dbus instead of dlopening it
-                 "-dbus-linked"
-                 ;; don't use the precompiled headers
-                 "-no-pch"
-                 ;; drop special machine instructions that do not have
-                 ;; runtime detection
-                 ,@(if (string-prefix? "x86_64"
-                                       (or (%current-target-system)
-                                           (%current-system)))
-                     '()
-                     '("-no-sse2"))
-                 "-no-mips_dsp"
-                 "-no-mips_dspr2"))))
+               (format #t "build directory: ~s~%" (getcwd))
+               (format #t "configure flags: ~s~%" configure-flags)
+               (apply invoke "./configure" configure-flags))))
          (add-after 'install 'patch-mkspecs
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -497,8 +497,7 @@ system, and the core design of Django is reused in Grantlee.")
                         '("device_config.prf" "moc.prf" "qt_build_config.prf"
                           "qt_config.prf" "winrt/package_manifest.prf"))
                  (("\\$\\$\\[QT_HOST_DATA/get\\]") archdata)
-                 (("\\$\\$\\[QT_HOST_DATA/src\\]") archdata))
-               #t)))
+                 (("\\$\\$\\[QT_HOST_DATA/src\\]") archdata)))))
          (add-after 'patch-mkspecs 'patch-prl-files
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
@@ -507,8 +506,7 @@ system, and the core design of Django is reused in Grantlee.")
                ;; on context.  See <https://bugs.gnu.org/38405>
                (substitute* (find-files (string-append out "/lib") "\\.prl$")
                  (("\\$\\$\\[QT_INSTALL_LIBS\\]")
-                  (string-append out "/lib")))
-               #t)))
+                  (string-append out "/lib"))))))
          (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
@@ -520,7 +518,7 @@ system, and the core design of Django is reused in Grantlee.")
                (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))))
+                  (string-append a glibc "/lib/lib" b))))
              ;; libGL
              (substitute* "src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp"
                (("^\\s*(QLibrary lib\\(QLatin1String\\(\")(GL\"\\)\\);)" _ a b)
@@ -530,8 +528,7 @@ system, and the core design of Django is reused in Grantlee.")
                (("^\\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)))))
+                (string-append a (assoc-ref inputs "libxcursor") "/lib/lib" b))))))))
     (native-search-paths
      (list (search-path-specification
             (variable "QMAKEPATH")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS.
  2021-06-25 18:08 ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxim Cournoyer
  2021-06-25 18:08   ` [bug#49227] [PATCH 2/3] gnu: qtbase: Enable GTK support Maxim Cournoyer
  2021-06-25 18:08   ` [bug#49227] [PATCH 3/3] gnu: qtbase: Specify configure flags via the #:configure-flags argument Maxim Cournoyer
@ 2021-06-26 16:32   ` Maxime Devos
  2021-07-02 21:08     ` bug#49227: " Maxim Cournoyer
  2 siblings, 1 reply; 6+ messages in thread
From: Maxime Devos @ 2021-06-26 16:32 UTC (permalink / raw)
  To: Maxim Cournoyer, 49227

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

Maxim Cournoyer schreef op vr 25-06-2021 om 14:08 [-0400]:
>     ;; These shall match the search-path-specification for Qt and KDE
>     ;; libraries.
> -   (list '("XDG_DATA_DIRS" directory "/share"
> +   (list '("XDG_DATA_DIRS" suffix directory "/share"

I'd recomend adding a comment here, explaining why 'suffix' is necessary
and '=' is unsufficient, with a link to the bug and patches tracker,
for clarity.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#49227: [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS.
  2021-06-26 16:32   ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxime Devos
@ 2021-07-02 21:08     ` Maxim Cournoyer
  0 siblings, 0 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2021-07-02 21:08 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 49227-done

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op vr 25-06-2021 om 14:08 [-0400]:
>>     ;; These shall match the search-path-specification for Qt and KDE
>>     ;; libraries.
>> -   (list '("XDG_DATA_DIRS" directory "/share"
>> +   (list '("XDG_DATA_DIRS" suffix directory "/share"
>
> I'd recomend adding a comment here, explaining why 'suffix' is necessary
> and '=' is unsufficient, with a link to the bug and patches tracker,
> for clarity.

I realized that there had already been the same fix on staging.  I had
to spend some time to manually resolve "conflicts" (which were not
immediately apparent due to code having changed place on core-updates).
The conflict cherry-picked from core-updates which ended up fixing this
was 30759c4aadf279e470e8d7f94de332a31c1b9f42.

I rebased the commits that had been pushed to master on that and a few
related others, and pushed as d5c9cc6d9d979bfca5f035429bcf510a0a2285a3,
which contains extra comments.

Thank you!

Maxim




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-02 21:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 18:04 [bug#49227] [PATCH 0/3] Some Qt/qtbase improvements Maxim Cournoyer
2021-06-25 18:08 ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxim Cournoyer
2021-06-25 18:08   ` [bug#49227] [PATCH 2/3] gnu: qtbase: Enable GTK support Maxim Cournoyer
2021-06-25 18:08   ` [bug#49227] [PATCH 3/3] gnu: qtbase: Specify configure flags via the #:configure-flags argument Maxim Cournoyer
2021-06-26 16:32   ` [bug#49227] [PATCH 1/3] build: qt-build-system: Allow users to override/extend XDG_DATA_DIRS Maxime Devos
2021-07-02 21:08     ` bug#49227: " Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).