Subject: [PATCH core-updates 1/2] gnu: samba: Fix build on i686-linux.

From: John Kehayias <[email-masked]>
Date: Mon, 17 Apr 2023 04:33:33 +0000

Empty Message

From 5f0faac057e9706e2c0c5d19895173c50d119434 Mon Sep 17 00:00:00 2001
From: John Kehayias <[email-masked]>
Date: Mon, 17 Apr 2023 00:09:25 -0400
Subject: [PATCH 1/2] gnu: samba: Fix build on i686-linux.

* gnu/packages/samba.scm (samba)[phases]{configure}: Make "--enable-selftest"
conditional on architectures with rust support, as python-cryptography is
needed.
[native-inputs]: Only include python-cryptography for architectures with rust.
---
 gnu/packages/samba.scm | 70 +++++++++++++++++++++++++-----------------
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index 8c004a1aac..1621706807 100644
--- a/gnu/packages/samba.scm
+++ b/gnu/packages/samba.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2022 Guillaume Le Vaillant <[email-masked]>
 ;;; Copyright © 2022 Maxime Devos <[email-masked]>
 ;;; Copyright © 2022 Simon Streit <[email-masked]>
+;;; Copyright © 2023 John Kehayias <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -208,21 +209,28 @@ (define-public samba/pinned
            (replace 'configure
              ;; Samba uses a custom configuration script that runs WAF.
              (lambda* (#:key inputs #:allow-other-keys)
-               (let* ((libdir (string-append #$output "/lib")))
-                 (invoke "./configure"
-                         "--enable-selftest"
-                         "--enable-fhs"
-                         (string-append "--prefix=" #$output)
-                         "--sysconfdir=/etc"
-                         "--localstatedir=/var"
-                         ;; Install public and private libraries into
-                         ;; a single directory to avoid RPATH issues.
-                         (string-append "--libdir=" libdir)
-                         (string-append "--with-privatelibdir=" libdir)
-                         "--with-system-mitkrb5"
-                         (string-append "--with-system-mitkdc="
-                                        (search-input-file inputs "sbin/krb5kdc"))
-                         "--with-experimental-mit-ad-dc"))))
+               (let* ((libdir (string-append #$output "/lib"))
+                      (system (or #$(%current-target-system)
+                                  #$(%current-system))))
+                 (apply invoke `("./configure"
+                                 ;; The selftest requires python-cryptography, only
+                                 ;; available where we have rust.
+                                 ,@(if (or (string-prefix? "x86_64-" system)
+                                           (string-prefix? "aarch64-" system))
+                                       '("--enable-selftest")
+                                       '())
+                                 "--enable-fhs"
+                                 ,(string-append "--prefix=" #$output)
+                                 "--sysconfdir=/etc"
+                                 "--localstatedir=/var"
+                                 ;; Install public and private libraries into
+                                 ;; a single directory to avoid RPATH issues.
+                                 ,(string-append "--libdir=" libdir)
+                                 ,(string-append "--with-privatelibdir=" libdir)
+                                 "--with-system-mitkrb5"
+                                 ,(string-append "--with-system-mitkdc="
+                                                 (search-input-file inputs "sbin/krb5kdc"))
+                                 "--with-experimental-mit-ad-dc")))))
            (add-before 'install 'disable-etc,var-samba-directories-setup
              (lambda _
                (substitute* "dynconfig/wscript"
@@ -255,19 +263,25 @@ (define-public samba/pinned
       ;; In Requires or Requires.private of pkg-config files.
       (list ldb talloc tevent))
      (native-inputs
-      (list perl-parse-yapp
-            pkg-config
-            python-cryptography         ;for krb5 tests
-            python-dnspython
-            python-iso8601
-            python-markdown
-            rpcsvc-proto                ;for 'rpcgen'
-            python-pyasn1               ;for krb5 tests
-            ;; For generating man pages.
-            docbook-xml-4.2
-            docbook-xsl
-            libxslt
-            libxml2))                   ;for XML_CATALOG_FILES
+      (append (list perl-parse-yapp
+                    pkg-config
+                    python-dnspython
+                    python-iso8601
+                    python-markdown
+                    rpcsvc-proto                ;for 'rpcgen'
+                    python-pyasn1               ;for krb5 tests
+                    ;; For generating man pages.
+                    docbook-xml-4.2
+                    docbook-xsl
+                    libxslt
+                    libxml2)                    ;for XML_CATALOG_FILES
+              ;; For krb5 tests, only where we have rust available.
+              (let ((system (or (%current-target-system)
+                                (%current-system))))
+                (if (or (string-prefix? "x86_64-" system)
+                        (string-prefix? "aarch64-" system))
+                    (list python-cryptography)
+                    '()))))
      (home-page "https://www.samba.org/")
      (synopsis
       "The standard Windows interoperability suite of programs for GNU and Unix")
-- 
2.39.2