me
/
guix
Archived
1
0
Fork 0

guix: qt-utils: Don't include useless inputs in wrapped variables.

Include only those inputs into XDG_DATA_DIRS having
some subdirectory of /share which is typically used by Qt.

* guix/build/qt-utils.scm (variables-for-wrapping): Take the
  output directory as an argument for special handling. Check for
  subdirectories of /share used by Qt before including inputs in
  XDG_DATA_DIRS.
  (wrap-qt-program*): Pass the output directory to variables-for-wrapping.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
master
Jakub Kądziołka 2021-01-10 21:28:36 +01:00 committed by Maxim Cournoyer
parent 76174aa991
commit 86c9f5a5fa
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 27 additions and 9 deletions

View File

@ -30,25 +30,42 @@
(define %qt-wrap-excluded-inputs (define %qt-wrap-excluded-inputs
'(list "cmake" "extra-cmake-modules" "qttools")) '(list "cmake" "extra-cmake-modules" "qttools"))
(define (variables-for-wrapping base-directories) ;; NOTE: Apart from standard subdirectories of /share, Qt also provides
;; facilities for per-application data directories, such as
;; /share/quassel. Thus, we include the output directory even if it doesn't
;; contain any of the standard subdirectories.
(define (variables-for-wrapping base-directories output-directory)
(define (collect-sub-dirs base-directories subdirectory) (define (collect-sub-dirs base-directories subdirectory-spec)
(filter-map (filter-map
(lambda (dir) (lambda (dir)
(let ((directory (string-append dir subdirectory))) (match
(if (directory-exists? directory) directory #f))) subdirectory-spec
((subdir)
(and (directory-exists? (string-append dir subdir))
(string-append dir (car subdirectory-spec))))
((subdir children)
(and
(or
(and (string=? dir output-directory)
(directory-exists? (string-append dir subdir)))
(or-map
(lambda (kid) (directory-exists? (string-append dir subdir kid)))
children))
(string-append dir subdir)))))
base-directories)) base-directories))
(filter (filter
(lambda (var-to-wrap) (not (null? (last var-to-wrap)))) (lambda (var-to-wrap) (not (null? (last var-to-wrap))))
(map (map
(lambda (var-spec) (match-lambda
(list (first var-spec) (second var-spec) ((var kind . subdir-spec)
(collect-sub-dirs base-directories (third var-spec)))) `(,var ,kind ,(collect-sub-dirs base-directories subdir-spec))))
(list (list
;; these shall match the search-path-specification for Qt and KDE ;; these shall match the search-path-specification for Qt and KDE
;; libraries ;; libraries
'("XDG_DATA_DIRS" suffix "/share") '("XDG_DATA_DIRS" suffix "/share" ("/applications" "/fonts"
"/icons" "/mime"))
'("XDG_CONFIG_DIRS" suffix "/etc/xdg") '("XDG_CONFIG_DIRS" suffix "/etc/xdg")
'("QT_PLUGIN_PATH" prefix "/lib/qt5/plugins") '("QT_PLUGIN_PATH" prefix "/lib/qt5/plugins")
'("QML2_IMPORT_PATH" prefix "/lib/qt5/qml"))))) '("QML2_IMPORT_PATH" prefix "/lib/qt5/qml")))))
@ -66,7 +83,8 @@
inputs)) inputs))
(let ((vars-to-wrap (variables-for-wrapping (let ((vars-to-wrap (variables-for-wrapping
(cons output-dir input-directories)))) (cons output-dir input-directories)
output-dir)))
(when (not (null? vars-to-wrap)) (when (not (null? vars-to-wrap))
(apply wrap-program program vars-to-wrap)))) (apply wrap-program program vars-to-wrap))))