Subject: [PATCH v1 3/4] gnu: btrfs-progs: Make the python-sphinx input conditional.

From: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Wed, 10 May 2023 18:39:24 +0200

* gnu/packages/linux.scm (btrfs-progs) [native-inputs]:
  Make the python-sphinx input conditional.
  [arguments]: Conditionally add --disable-documentation to
  configure flags.

Signed-off-by: Denis 'GNUtoo' Carikli <[email-masked]>
---
 gnu/packages/linux.scm | 42 ++++++++++++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index a71100baab..e910c47ab9 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -5894,9 +5894,18 @@ (define-public btrfs-progs
     (arguments
      (list
       #:configure-flags
-      ;; The ‘Python support’ was never actually installed by previous
-      ;; versions of this package, but did prevent cross-compilation.
-      #~(list "--disable-python")
+      #~(append
+         ;; Without --disable-documentation, it complains about missing
+         ;; python-sphinx on systems where this package isn't available
+         ;; (because it requires Rust).
+         (if #$@(member (%current-system)
+                        (package-transitive-supported-systems
+                         python-sphinx))
+             '()
+             (list "--disable-documentation"))
+         ;; The ‘Python support’ was never actually installed by previous
+         ;; versions of this package, but did prevent cross-compilation.
+         (list "--disable-python"))
       #:phases #~(modify-phases %standard-phases
                    (add-after 'unpack 'patch-makefile
                      (lambda* (#:key outputs #:allow-other-keys)
@@ -5935,15 +5944,24 @@ (define-public btrfs-progs
                   `(,zlib "static")
                   `(,zstd "lib")
                   `(,zstd "static")))
-    (native-inputs (list pkg-config
-                         python-sphinx ;; For building documentation.
-                         acl           ;; For tests.
-                         lvm2          ;; For dmsetup.
-                         grep          ;; Need Perl regexp support.
-                         libaio
-                         liburing
-                         util-linux    ;; For fallocate.
-                         which))
+    (native-inputs
+     (append
+      ;; For building documentation. Since python-sphinx
+      ;; requires Rust, add it conditionally depending on such
+      ;; support.
+      (if (member (%current-system)
+                  (package-transitive-supported-systems
+                   python-sphinx))
+          (list python-sphinx)
+          '())
+      (list pkg-config
+            acl           ;; For tests.
+            lvm2          ;; For dmsetup.
+            grep          ;; Need Perl regexp support.
+            libaio
+            liburing
+            util-linux    ;; For fallocate.
+            which)))
     (home-page "https://btrfs.wiki.kernel.org/index.php/Main_Page")
     (synopsis "Create and manage btrfs copy-on-write file systems")
     (description
-- 
2.39.2