Subject: bug#47569: ‘qt-build-system’ retains too many references via wrappers

From: Maxim Cournoyer <[email-masked]>
Date: Wed, 07 Apr 2021 17:03:33 -0400

Hi Ludo,

I just had another thought on this!

Ludovic Courtès <[email-masked]> writes:

[...]

> -  (filter
> -   (lambda (var-to-wrap) (not (null? (last var-to-wrap))))
> -   (map
> -    (lambda (var-spec)
> -      `(,(first var-spec) = ,(collect-sub-dirs base-directories (last var-spec))))
> -    (list
> -     ;; these shall match the search-path-specification for Qt and KDE
> -     ;; libraries
> -     '("XDG_DATA_DIRS" "/share")
> -     '("XDG_CONFIG_DIRS" "/etc/xdg")
> -     '("QT_PLUGIN_PATH" "/lib/qt5/plugins")
> -     '("QML2_IMPORT_PATH" "/lib/qt5/qml")))))
> +  (filter-map
> +   (match-lambda
> +     ((variable directory selectors ...)
> +      (match (collect-sub-dirs base-directories directory
> +                               selectors)
> +        (()
> +         #f)
> +        (directories
> +         `(,variable = ,directories)))))
> +
> +   ;; These shall match the search-path-specification for Qt and KDE
> +   ;; libraries.
> +   (list '("XDG_DATA_DIRS" "/share"
> +
> +           ;; These are "selectors": consider /share if and only if these
> +           ;; sub-directories exist.  This avoids adding irrelevant packages
> +           ;; to XDG_DATA_DIRS just because they have a /share sub-directory.
> +           "/glib-2.0/schemas" "/sounds" "/themes"
> +           "/cursors" "/wallpapers" "/icons" "/mime")
> +         '("XDG_CONFIG_DIRS" "/etc/xdg")
> +         '("QT_PLUGIN_PATH" "/lib/qt5/plugins")
> +         '("QML2_IMPORT_PATH" "/lib/qt5/qml"))))
>
>  (define* (wrap-all-programs #:key inputs outputs
>                              (qt-wrap-excluded-outputs '())

Seeing a growing number of packages require a custom wrap phase for
qtwebengine, I think the following additions could make sense to be
incorporated as part as this Qt-world rebuild:

2 files changed, 5 insertions(+), 1 deletion(-)
gnu/packages/qt.scm            | 3 +++
guix/build/qt-build-system.scm | 3 ++-

modified   gnu/packages/qt.scm
@@ -538,6 +538,9 @@ system, and the core design of Django is reused in Grantlee.")
            (search-path-specification
             (variable "QT_PLUGIN_PATH")
             (files '("lib/qt5/plugins")))
+           (search-path-specification
+            (variable "QTWEBENGINEPROCESS_PATH")
+            (files '("lib/qt5/libexec/QtWebEngineProcess")))
            (search-path-specification
             (variable "XDG_DATA_DIRS")
             (files '("share")))
modified   guix/build/qt-build-system.scm
@@ -86,7 +86,8 @@
            "/cursors" "/wallpapers" "/icons" "/mime")
          '("XDG_CONFIG_DIRS" "/etc/xdg")
          '("QT_PLUGIN_PATH" "/lib/qt5/plugins")
-         '("QML2_IMPORT_PATH" "/lib/qt5/qml"))))
+         '("QML2_IMPORT_PATH" "/lib/qt5/qml")
+         '("QTWEBENGINEPROCESS_PATH" "lib/qt5/libexec/QtWebEngineProcess"))))

 (define* (wrap-all-programs #:key inputs outputs
                             (qt-wrap-excluded-outputs '())

Thanks,

Maxim