Subject: [PATCH v2 1/3] gnu: xfig: Use G-Expressions.

From: Bruno Victal <[email-masked]>
Date: Sun, 24 Sep 2023 16:30:25 +0100

* gnu/packages/xfig.scm (xfig)[arguments]<#:phases>: Relocate
'strip-bogus-exec-prefix into …
[sources]: … here, as a snippet instead.
[inputs]: Restyle.
---
 gnu/packages/xfig.scm | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/xfig.scm b/gnu/packages/xfig.scm
index 8efe561433..f68ddb01f9 100644
--- a/gnu/packages/xfig.scm
+++ b/gnu/packages/xfig.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2021 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2022 Ivan Vilata i Balaguer <[email-masked]>
+;;; Copyright © 2023 Bruno Victal <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@ (define-module (gnu packages xfig)
   #:use-module (guix packages)
   #:use-module ((guix licenses) #:select (bsd-2))
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages freedesktop)
@@ -43,27 +45,23 @@ (define-public xfig
                            name "-" version ".tar.xz"))
        (sha256
         (base32
-         "0fndgbm1mkqb1sn2v2kj3nx9mxj70jbp31y2bjvzcmmkry0q3k5j"))))
+         "0fndgbm1mkqb1sn2v2kj3nx9mxj70jbp31y2bjvzcmmkry0q3k5j"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; The patch-dot-desktop-files phase requires a relative name.
+        #~(substitute* "xfig.desktop"
+            (("^(Exec=)/usr/bin/" _ key) key)))))
     (build-system gnu-build-system)
     (native-inputs
      ;; For tests.
      (list desktop-file-utils ghostscript))
     (inputs
-     `(("libxaw3d" ,libxaw3d)
-       ("libjpeg" ,libjpeg-turbo)
-       ("libpng" ,libpng)
-       ("libxpm" ,libxpm)
-       ("libx11" ,libx11)
-       ("libxt" ,libxt)))
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'strip-bogus-exec-prefix
-           (lambda* (#:key outputs #:allow-other-keys)
-             (substitute* "xfig.desktop"
-               ;; The patch-dot-desktop-files phase requires a relative name.
-               (("Exec=/usr/bin/xfig") "Exec=xfig"))
-             #t)))))
+     (list libxaw3d
+           libjpeg-turbo
+           libpng
+           libxpm
+           libx11
+           libxt))
     (home-page "https://mcj.sourceforge.net/")
     (synopsis "Interactive drawing tool")
     (description
-- 
2.41.0