Subject: [bug#59052] Add sbcl-triads:bin patch

From: Charles <[email-masked]>
Date: Wed, 14 Dec 2022 05:06:48 +0000

It seems like a :bin suffix is the usuall way. This also opens up the possibility of ecl-triads:bin, and even ccl-triads:bin, clasp-triads:bin, abcl-triads:bin.

From 3ac729c376dd25d4f7295d237d0f25e3abd63a5f Mon Sep 17 00:00:00 2001
From: Charles <[email-masked]>
Date: Tue, 13 Dec 2022 22:56:23 -0600
Subject: [PATCH] gnu: sbcl-triads: Add bin output.

* gnu/packages/lisp-xyz.scm (sbcl-triads): Add phase to build and install
binary executable (build-binary).

* gnu/packages/lisp-xyz.scm (ecl-triads): Remove the build-binary phase
because this program has not been tested on ECL upstream.
---
 gnu/packages/lisp-xyz.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index 364be8c7a5..fd1b9b82f4 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -26264,8 +26264,25 @@ (define-public sbcl-triads
          (sha256
           (base32 "146mwshynhdw82m2nxrcjvf1nk0z3fn6ywcd2vqxkly5qricc53w"))))
       (build-system asdf-build-system/sbcl)
+      (outputs '("out" "bin"))
       (arguments
-       '(#:asd-systems '("charje.triads")))
+       '(#:asd-systems '("charje.triads")
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'create-asdf-configuration 'build-binary
+             (lambda* (#:key outputs #:allow-other-keys)
+               (setenv "HOME" (getcwd))
+               (system*
+                "sbcl" "--eval" "(require :asdf)" "--eval"
+                (format
+                 #f "~S"
+                 `(progn
+                   (require "charje.triads"
+                            ,(string-append (getcwd) "/charje.triads.asd"))
+                   (asdf:make "charje.triads"))))
+               (install-file
+                (string-append (getcwd) "/triads")
+                (string-append (assoc-ref outputs "bin") "/bin")))))))
       (inputs
        (list sbcl-cl-str
              sbcl-serapeum
@@ -26282,7 +26299,15 @@ (define-public cl-triads
   (sbcl-package->cl-source-package sbcl-triads))
 
 (define-public ecl-triads
-  (sbcl-package->ecl-package sbcl-triads))
+  (let ((ecl-package (sbcl-package->ecl-package sbcl-triads)))
+    (package
+      (inherit ecl-package)
+      (outputs '("out"))
+      (arguments
+       (substitute-keyword-arguments (package-arguments ecl-package)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (delete 'build-binary))))))))
 
 (define-public sbcl-closure-template
   ;; There are no releases since 2015.
-- 
2.38.1