Subject: [PATCH 1/3] gnu: heimdal: Build from Git.

From: Felix Lechner <[email-masked]>
Date: Tue, 16 May 2023 21:20:55 -0700

This is in preparation to drop obsolete tools from the Automake files. The
tarball comes with a ./configure script. It was not clear to the author what
the best way was to run 'autoreconf -f -i' with the tarball in Guix's
gnu-build-system.

* gnu/packages/kerberos (heimdal): Build from Git; prepare to drop obsolete
tools from Automake.
---
 gnu/packages/kerberos.scm | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/kerberos.scm b/gnu/packages/kerberos.scm
index c553f8180a..af67bff6c9 100644
--- a/gnu/packages/kerberos.scm
+++ b/gnu/packages/kerberos.scm
@@ -56,6 +56,7 @@ (define-module (gnu packages kerberos)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix gexp)
+  #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu))
 
@@ -171,26 +172,22 @@ (define-public shishi
     (license license:gpl3+)))
 
 (define-public heimdal
+  (let ((commit "a6cf94577c0d1e5bca5304342e4ddffb18255afe")
+        (revision "1"))
   (package
     (name "heimdal")
-    (version "7.8.0")
+    (version (git-version "7.8.0" revision commit))
     (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://github.com/heimdal/heimdal/releases/download/"
-                    "heimdal-" version "/" "heimdal-" version ".tar.gz"))
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/heimdal/heimdal")
+                    (commit commit)))
+              (file-name (git-file-name name version))
               (sha256
                (base32
-                "0f4dblav859p5hn7b2jdj1akw6d8p32as6bj6zym19kghh3s51zx"))
+                "0df646hzi10s0w07kqzj10aniv6jsbmlpx6j3lqjvpsjpmm9lww9"))
               (patches
-               (search-patches "heimdal-CVE-2022-45142.patch"))
-              (modules '((guix build utils)))
-              (snippet
-               '(begin
-                  (substitute* "configure"
-                    (("User=.*$") "User=Guix\n")
-                    (("Host=.*$") "Host=GNU")
-                    (("Date=.*$") "Date=2022\n"))))))
+               (search-patches "heimdal-CVE-2022-45142.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
@@ -224,6 +221,10 @@ (define-public heimdal
                   (add-before 'configure 'pre-configure
                     (lambda* (#:key inputs #:allow-other-keys)
                       (substitute* "configure"
+                        ;; Reproducible build date, etc.
+                        (("User=.*$") "User=Guix\n")
+                        (("Host=.*$") "Host=GNU")
+                        (("Date=.*$") "Date=2022\n")
                         ;; The e2fsprogs input is included for libcom_err,
                         ;; let's use it even if cross-compiling.
                         (("test \"\\$\\{krb_cv_com_err\\}\" = \"yes\"")
@@ -255,12 +256,17 @@ (define-public heimdal
                           (format #t "#!~a~%exit 1~%" (which "sh")))))))
        ;; Tests fail when run in parallel.
        #:parallel-tests? #f))
-    (native-inputs (list bison
+    (native-inputs (list autoconf
+                         automake
+                         bison
                          e2fsprogs      ;for 'compile_et'
                          flex
+                         libtool
                          texinfo
                          unzip          ;for tests
                          pkg-config
+                         perl
+                         perl-json
                          python))
     (inputs (list readline
                   bash-minimal
@@ -274,4 +280,5 @@ (define-public heimdal
     (description
      "Heimdal is an implementation of Kerberos 5 network authentication
 service.")
-    (license license:bsd-3)))
+    (license license:bsd-3))))
+
-- 
2.40.1