Subject: [bug#48849] [PATCH core-updates]: Add #:sh argument to wrap-qt-program

From: Maxime Devos <[email-masked]>
Date: Sat, 05 Jun 2021 13:49:23 +0200

Hi guix,

This patch series adds a #:sh keyword argument to wrap-qt-program
and adjusts callers to set this keyword argument appropriately.

Setting this argument appropriately is required for cross-compilation.
Otherwise, a bash for SYSTEM (as in --system=..) is used instead
of a bash for TARGET (as in --target=...).

I didn't test building some qt programs with this patch series yet,
as I'm currently waiting on the substitute servers to catch up
with recent changed to core-updates (to avoid building a tower
of rusts). I'll do that later.

Greetings,
Maxime
From 27d42f25f54b16f382e18b9ef0fb202fb00da90d Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:02:16 +0200
Subject: [PATCH 1/8] qt-utils: Allow overriding the shell interpreter in
 'wrap-qt-program'.

* guix/build/qt-utils.scm (wrap-qt-program): Introduce a #:sh keyword
  argument and pass it to 'wrap-program'.
---
 guix/build/qt-utils.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/guix/build/qt-utils.scm b/guix/build/qt-utils.scm
index d2486ee86c..60e699fe39 100644
--- a/guix/build/qt-utils.scm
+++ b/guix/build/qt-utils.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 David Craven <[email-masked]>
+;;; Copyright © 2021 Maxime Devos <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,7 +21,7 @@
   #:use-module (guix build utils)
   #:export (wrap-qt-program))
 
-(define (wrap-qt-program out program)
+(define* (wrap-qt-program out program #:key (sh (which "bash")))
   (define (suffix env-var path)
     (let ((env-val (getenv env-var)))
       (if env-val (string-append env-val ":" path) path)))
@@ -34,6 +35,7 @@
         (xdg-config-path (suffix "XDG_CONFIG_DIRS"
                                  (string-append out "/etc/xdg"))))
     (wrap-program (string-append out "/bin/" program)
+      #:sh sh
       `("QML2_IMPORT_PATH" = (,qml-path))
       `("QT_PLUGIN_PATH" = (,plugin-path))
       `("XDG_DATA_DIRS" = (,xdg-data-path))
-- 
2.31.1

From 8ed53a6840b1099c8ccc50a1779187e186dfb7af Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:20 +0200
Subject: [PATCH 2/8] gnu: qbittorrent: Set #:sh argument of 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/bittorrent.scm
  (qbittorrent)[arguments]<#:phases>{wrap-qt}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/bittorrent.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bittorrent.scm b/gnu/packages/bittorrent.scm
index 29b0d62ad2..339248da94 100644
--- a/gnu/packages/bittorrent.scm
+++ b/gnu/packages/bittorrent.scm
@@ -448,8 +448,9 @@ desktops.")
        #:phases
        (modify-phases %standard-phases
          (add-after 'install 'wrap-qt
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-qt-program (assoc-ref outputs "out") "qbittorrent")
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (wrap-qt-program (assoc-ref outputs "out") "qbittorrent"
+                              #:sh (search-input-file inputs "bin/bash"))
              #t)))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
-- 
2.31.1

From b02b0ea202d5e3970e5df2a461b83990c9edfc81 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:20 +0200
Subject: [PATCH 3/8] gnu: electron-cash: Set #:sh argument of
 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/finance.scm
  (electron-cash)[arguments]<#:phases>{wrap-qt}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/finance.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index fbd7df783c..029df4f934 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -618,8 +618,9 @@ other machines/servers.  Electrum does not download the Bitcoin blockchain.")
                                (assoc-ref inputs "libsecp256k1")
                                "/lib/libsecp256k1.so.0'")))))
          (add-after 'install 'wrap-qt
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-qt-program (assoc-ref outputs "out") "electron-cash"))))))
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (wrap-qt-program (assoc-ref outputs "out") "electron-cash"
+                              #:sh (search-input-file inputs "bin/bash")))))))
     (home-page "https://electroncash.org/")
     (synopsis "Bitcoin Cash wallet")
     (description
-- 
2.31.1

From eac4a9fbd09bde8d52bd38f00a23aa11cd24ffa0 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:20 +0200
Subject: [PATCH 4/8] gnu: qgis: Set #:sh argument of 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/geo.scm
  (qgis)[arguments]<#:phases>{wrap-qt}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/geo.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index c4bdb6aca0..65b763ecbe 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -2224,8 +2224,9 @@ growing set of geoscientific methods.")
          (add-after 'install 'wrap-python
            (assoc-ref python:%standard-phases 'wrap))
          (add-after 'wrap-python 'wrap-qt
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-qt-program (assoc-ref outputs "out") "qgis")
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (wrap-qt-program (assoc-ref outputs "out") "qgis"
+                              #:sh (search-input-file "bin/bash"))
              #t))
          (add-after 'wrap-qt 'wrap-gis
            (lambda* (#:key inputs outputs #:allow-other-keys)
-- 
2.31.1

From d34d7b0cd464b6abbe7ffa30f8c674a61a14f886 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:20 +0200
Subject: [PATCH 5/8] gnu: keepassxc: Set #:sh argument of 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/password-utils.scm
  (keepassxc)[arguments]<#:phases>{wrap-qt}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/password-utils.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 310253c2a4..2a5a1e5c9f 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -146,8 +146,9 @@ human.")
        #:phases
        (modify-phases %standard-phases
          (add-after 'install 'wrap-qt
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-qt-program (assoc-ref outputs "out") "keepassxc")
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (wrap-qt-program (assoc-ref outputs "out") "keepassxc"
+                              #:sh (search-input-file inputs "bin/bash"))
              #t)))))
     (native-inputs
      `(("asciidoctor" ,ruby-asciidoctor)
-- 
2.31.1

From 256910012b96e0c7489ac65e7748f4806906c360 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:21 +0200
Subject: [PATCH 6/8] gnu: qtpass: Set #:sh argument of 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/password-utils.scm
  (qtpass)[arguments]<#:phases>{wrap-qt}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/password-utils.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 2a5a1e5c9f..19b1b5623c 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -683,8 +683,9 @@ key URIs using the standard otpauth:// scheme.")
                (install-file "qtpass.1" man)
                #t)))
          (add-after 'install 'wrap-qt
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-qt-program (assoc-ref outputs "out") "qtpass")
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (wrap-qt-program (assoc-ref outputs "out") "qtpass"
+                              #:sh (search-input-file inputs "bin/bash"))
              #t))
          (add-before 'check 'check-setup
            ;; Make Qt render "offscreen", required for tests.
-- 
2.31.1

From 23486d123442d63aac7b54ec0c4d0b4786237762 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:21 +0200
Subject: [PATCH 7/8] gnu: openshot: Set #:sh argument of 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/video.scm
  (openshot)[arguments]<#:phases>{wrap-program}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/video.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 4b1d2540e4..250ca944aa 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -4560,9 +4560,10 @@ API.  It includes bindings for Python, Ruby, and other languages.")
                       (setenv "HOME" "/tmp")
                       #t))
                   (add-after 'install 'wrap-program
-                    (lambda* (#:key outputs #:allow-other-keys)
+                    (lambda* (#:key inputs outputs #:allow-other-keys)
                       (let ((out (assoc-ref outputs "out")))
-                        (wrap-qt-program out "openshot-qt"))
+                        (wrap-qt-program out "openshot-qt"
+                                         #:sh (search-input-file "bin/bash")))
                       #t)))))
     (home-page "https://www.openshot.org/")
     (synopsis "Video editor")
-- 
2.31.1

From 92803cbef5affa3dbbf049262e1fcf290d8d8622 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Sat, 5 Jun 2021 11:04:21 +0200
Subject: [PATCH 8/8] gnu: kristall: Set #:sh argument of 'wrap-qt-program'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/web-browsers.scm
  (kristall)[arguments]<#:phases>{wrap-program}:
  Set #:sh argument of ‘wrap-qt-program’.
---
 gnu/packages/web-browsers.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/web-browsers.scm b/gnu/packages/web-browsers.scm
index af178f9092..3633ff34a8 100644
--- a/gnu/packages/web-browsers.scm
+++ b/gnu/packages/web-browsers.scm
@@ -443,9 +443,10 @@ access.")
                    "/share/fonts/truetype/NotoColorEmoji")))
                #t))
            (add-after 'install 'wrap-program
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (wrap-qt-program out "kristall"))
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out"))
+                     (bash (search-input-file inputs "bin/bash")))
+                 (wrap-qt-program out "kristall" #:sh bash))
                #t)))))
       (native-inputs
        `(("breeze-stylesheet"
-- 
2.31.1