unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: 45193@debbugs.gnu.org, guix-patches@gnu.org
Cc: "Jakub Kądziołka" <kuba@kadziolka.net>
Subject: bug#45193: [PATCH 3/4] build-system: qt: Exclude useless inputs from wrapped variables.
Date: Mon, 11 Jan 2021 15:41:43 +0100	[thread overview]
Message-ID: <e0758f9eb31b9457770d18909bbdcd619f74069d.1610376081.git.h.goebel@crazy-compilers.com> (raw)
In-Reply-To: <e8cfff4ab1dd7f0c39875d22057e4ef45a10cc7b.1610376081.git.h.goebel@crazy-compilers.com>

From: Jakub Kądziołka <kuba@kadziolka.net>

* guix/build-system/qt.scm (qt-build)[qt-wrap-excluded-inputs]: New argument.
* guix/build/qt-utils.scm (%qt-wrap-excluded-inputs): New variable.
  (wrap-qt-program*)[qt-wrap-excluded-inputs]: New argument. Filter excluded
  inputs.
  (wrap-qt-program)[qt-wrap-excluded-inputs]: New argument.
  (wrap-all-qt-programs)[qt-wrap-excluded-inputs]: New argument.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
---
 guix/build-system/qt.scm |  5 +++++
 guix/build/qt-utils.scm  | 29 ++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm
index 1bd89bfa4d..e1368db1d9 100644
--- a/guix/build-system/qt.scm
+++ b/guix/build-system/qt.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,6 +23,8 @@
 (define-module (guix build-system qt)
   #:use-module (guix store)
   #:use-module (guix utils)
+  #:use-module ((guix build qt-utils)
+                #:select (%qt-wrap-excluded-inputs))
   #:use-module (guix derivations)
   #:use-module (guix search-paths)
   #:use-module (guix build-system)
@@ -125,6 +128,7 @@
                    (phases '(@ (guix build qt-build-system)
                                %standard-phases))
                    (qt-wrap-excluded-outputs ''())
+                   (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs)
                    (system (%current-system))
                    (imported-modules %qt-build-system-modules)
                    (modules '((guix build qt-build-system)
@@ -148,6 +152,7 @@ provides a 'CMakeLists.txt' file as its build system."
                                        search-paths)
                  #:phases ,phases
                  #:qt-wrap-excluded-outputs ,qt-wrap-excluded-outputs
+                 #:qt-wrap-excluded-inputs ,qt-wrap-excluded-inputs
                  #:configure-flags ,configure-flags
                  #:make-flags ,make-flags
                  #:out-of-source? ,out-of-source?
diff --git a/guix/build/qt-utils.scm b/guix/build/qt-utils.scm
index 030059522d..a03b09f05e 100644
--- a/guix/build/qt-utils.scm
+++ b/guix/build/qt-utils.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2019, 2020, 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,8 +24,11 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (wrap-qt-program
-            wrap-all-qt-programs))
+            wrap-all-qt-programs
+            %qt-wrap-excluded-inputs))
 
+(define %qt-wrap-excluded-inputs
+  '(list "cmake" "extra-cmake-modules" "qttools"))
 
 (define (variables-for-wrapping base-directories)
 
@@ -50,13 +54,16 @@
      '("QML2_IMPORT_PATH" prefix "/lib/qt5/qml")))))
 
 
-(define* (wrap-qt-program* program #:key inputs output-dir)
+(define* (wrap-qt-program* program #:key inputs output-dir
+                           qt-wrap-excluded-inputs)
 
   (define input-directories
-    ;; FIXME: Filter out unwanted inputs, e.g. cmake
-    (match inputs
-           (((_ . dir) ...)
-            dir)))
+    (filter-map
+     (match-lambda
+      ((label . directory)
+       (and (not (member label qt-wrap-excluded-inputs))
+            directory)))
+     inputs))
 
   (let ((vars-to-wrap (variables-for-wrapping
                        (cons output-dir input-directories))))
@@ -64,18 +71,21 @@
       (apply wrap-program program vars-to-wrap))))
 
 
-(define* (wrap-qt-program program-name #:key inputs output)
+(define* (wrap-qt-program program-name #:key inputs output
+                          (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs))
   "Wrap the specified programm (which must reside in the OUTPUT's \"/bin\"
 directory) with suitably set environment variables.
 
 This is like qt-build-systems's phase \"qt-wrap\", but only the named program
 is wrapped."
   (wrap-qt-program* (string-append output "/bin/" program-name)
-                    #:output-dir output #:inputs inputs))
+                    #:output-dir output #:inputs inputs
+                    #:qt-wrap-excluded-inputs qt-wrap-excluded-inputs))
 
 
 (define* (wrap-all-qt-programs #:key inputs outputs
                                (qt-wrap-excluded-outputs '())
+                               (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs)
                                #:allow-other-keys)
   "Implement qt-build-systems's phase \"qt-wrap\": look for executables in
 \"bin\", \"sbin\" and \"libexec\" of all outputs and create wrappers with
@@ -99,7 +109,8 @@ add a dependency of that output on Qt."
      ((output . output-dir)
       (unless (member output qt-wrap-excluded-outputs)
         (for-each (cut wrap-qt-program* <>
-                       #:output-dir output-dir #:inputs inputs)
+                       #:output-dir output-dir #:inputs inputs
+                       #:qt-wrap-excluded-inputs qt-wrap-excluded-inputs)
                   (find-files-to-wrap output-dir))))))
 
   (for-each handle-output outputs)
-- 
2.21.3





      parent reply	other threads:[~2021-01-11 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e8cfff4ab1dd7f0c39875d22057e4ef45a10cc7b.1610376081.git.h.goebel@crazy-compilers.com>
2021-01-11 14:41 ` bug#45193: [PATCH 2/4] guix: qt-utils: Wrapped executables honor user's envvars Hartmut Goebel
2021-01-11 14:41 ` Hartmut Goebel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0758f9eb31b9457770d18909bbdcd619f74069d.1610376081.git.h.goebel@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --cc=45193@debbugs.gnu.org \
    --cc=guix-patches@gnu.org \
    --cc=kuba@kadziolka.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).