Subject: [PATCH 0/1] gnu: emu8051: Using snippet to replace patch-ncurses phases

From: c4droid <[email-masked]>
Date: Wed, 22 Mar 2023 09:58:24 +0800

Replace patch-ncurses phases with snippet field.

>From 8f4aeb1d2f99b87ced20242cff6ed282649243d4 Mon Sep 17 00:00:00 2001
From: c4droid <[email-masked]>
Date: Wed, 22 Mar 2023 09:57:13 +0800
Subject: [PATCH] gnu: emu8051: Using snippet to replace patch-ncurses phases

---
 gnu/packages/embedded.scm | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 50658e4..fdf950f 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -1763,28 +1763,27 @@ (define-public emu8051
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))))
+                  "1xxmkcwvd5fjnhwbricafg4xvxvr8dxhfanyfp4rbksw37dgk2fx"))
+		(modules '((guix build utils)))
+		(snippet
+		 #~(begin
+		     ;; Replace LDFLAGS -lcurses to -lncurses
+		     (substitute* "Makefile"
+		       (("-lcurses") "-lncurses"))))))
       (build-system gnu-build-system)
       (arguments
        `(#:tests? #f ;No test suite
-         #:make-flags (list (string-append "CC="
-                                           ,(cc-for-target)))
-         #:phases (modify-phases %standard-phases
-                    (delete 'configure) ;No ./configure script
-                    (add-before 'build 'patch-ncurses
-                      ;; Replace LDFLAGS -lcurses to -lncurses
-                      (lambda* _
-                        (substitute* "Makefile"
-                          (("-lcurses")
-                           "-lncurses"))))
-                    (replace 'install
-                      ;; No installation procedure
-                      (lambda _
-                        (install-file "emu"
-                                      (string-append (assoc-ref %outputs "out")
-                                                     "/bin")))))))
+         #:make-flags #~(list (string-append "CC="
+                                             ,(cc-for-target)))
+         #:phases #~(modify-phases %standard-phases
+                      (delete 'configure) ;No ./configure script
+                      (replace 'install
+			;; No installation procedure
+			(lambda _
+                          (install-file "emu"
+					(string-append #$output "/bin")))))))
       (inputs (list ncurses))
-      (home-page "https://github.comjarikomppa/emu8051")
+      (home-page "https://github.com/jarikomppa/emu8051")
       (synopsis "8051/8052 emulator with curses-based UI")
       (description "emu8051 is a simulator of the 8051/8052 microcontrollers.")
       (license license:expat))))
-- 
2.39.2

When changing install phases with gexp, report: Unbound variables: gexp