Subject: [PATCH v4 4/4] gnu: quilt: Build emacs package.

From: Morgan Smith <[email-masked]>
Date: Sun, 13 Apr 2025 16:08:16 -0400

* gnu/packages/patchutils.scm (quilt): Build emacs package.

Change-Id: I4d70ad1c137a377f71cd9d3f1b69f5ed95e4debd
---
 gnu/packages/patchutils.scm | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm
index 3da1e7b3b4..4b0fcde8a8 100644
--- a/gnu/packages/patchutils.scm
+++ b/gnu/packages/patchutils.scm
@@ -44,6 +44,7 @@ (define-module (gnu packages patchutils)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages django)
+  #:use-module (gnu packages emacs)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages file)
   #:use-module (gnu packages gawk)
@@ -179,7 +180,7 @@ (define-public quilt
         (base32 "09l4nf6qb8y8l62z8ypdg5mraz0lvqxg1j1p6xdyh1n10gg0k37y"))))
     (build-system gnu-build-system)
     (native-inputs
-     (list gettext-minimal))
+     (list emacs-minimal gettext-minimal))
     (inputs
      (list bash-minimal perl less file gzip ed
            diffutils diffstat findutils tar
@@ -187,8 +188,36 @@ (define-public quilt
            guile-3.0))
     (arguments
      (list
+      #:imported-modules `(,@%default-gnu-imported-modules
+                           (guix build emacs-build-system)
+                           (guix build emacs-utils))
+      #:modules `(,@%default-gnu-modules
+                  ((guix build emacs-build-system) #:prefix emacs:)
+                  (guix build emacs-utils))
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'unpack 'no-emacs-build
+            (lambda _
+              ;; Don't build using makefile
+              (substitute* "Makefile.in"
+                ((".*lib/quilt.el.*") ""))))
+          (add-after 'no-emacs-build 'chdir-emacs-build
+            (lambda _
+              (chdir "lib")))
+          (add-after 'chdir-emacs-build 'emacs-ensure-package-description
+            (assoc-ref emacs:%standard-phases 'ensure-package-description))
+          (add-after 'emacs-ensure-package-description 'emacs-make-autoloads
+            (assoc-ref emacs:%standard-phases 'make-autoloads))
+          ;; Don't include Emacs check phase as there are no Emacs tests
+          (add-after 'emacs-make-autoloads 'emacs-install
+            (assoc-ref emacs:%standard-phases 'install))
+          (add-after 'emacs-install 'emacs-build
+            (assoc-ref emacs:%standard-phases 'build))
+          (add-after 'emacs-build 'emacs-validate-compiled-autoloads
+            (assoc-ref emacs:%standard-phases 'validate-compiled-autoloads))
+          (add-after 'emacs-validate-compiled-autoloads 'chdir-out-of-emacs-build
+            (lambda _
+              (chdir "..")))
           (delete 'check)
           (add-after 'install 'wrap-script
             ;; quilt's configure checks for the absolute path to the utilities it

base-commit: 03edfea126a88110b520469e96eae73ce86d4b7d
prerequisite-patch-id: f80d0520f7c77a03803856fd859879875614851b
prerequisite-patch-id: f94ece5e1fb310c55583bca97c977d3132ae2a78
prerequisite-patch-id: 93f40b5d1a83ff8a6c9a9243f2141f7f4c1f4af1
-- 
2.49.0