Subject: [bug#58100] [PATCH v2 4/8] gnu: cbqn: Rewrite in terms of cbqn-bootstrap.

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 22 Oct 2022 20:34:37 +0200

* gnu/packages/bqn.scm (cbqn)[arguments]: Use substitute-keyword-arguments
to preserve options from cbqn-bootstrap.
---
 gnu/packages/bqn.scm | 59 +++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index 8a1b1dfba2..bc714c3d49 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -171,37 +171,34 @@ (define-public cbqn
     (name "cbqn")
     (outputs '("out" "lib"))
     (arguments
-     (list #:make-flags '(list "shared-o3" "o3")
-           #:phases #~(modify-phases %standard-phases
-                        (delete 'configure)
-                        (add-before 'build 'generate-bytecode
-                          (lambda* (#:key inputs #:allow-other-keys)
-                            (system (string-append #+dbqn
-                                                   "/bin/dbqn ./genRuntime "
-                                                   #+bqn-sources))))
-                        (replace 'check
-                          (lambda* (#:key inputs tests? #:allow-other-keys)
-                            (when tests?
-                              (system (string-append "./BQN -M 1000 \""
-                                                     #+bqn-sources
-                                                     "/test/this.bqn\""))
-                              (map (lambda (x)
-                                     (system (string-append "./BQN ./test/" x
-                                                            ".bqn")))
-                                   '("cmp" "equal" "copy" "random"))
-                              (system "make -C test/ffi"))))
-                        (replace 'install
-                          (lambda* (#:key outputs #:allow-other-keys)
-                            (let* ((bin (string-append (assoc-ref outputs
-                                                                  "out")
-                                                       "/bin"))
-                                   (lib (string-append (assoc-ref outputs
-                                                                  "lib")
-                                                       "/lib")))
-                              (mkdir-p bin)
-                              (copy-recursively "BQN"
-                                                (string-append bin "/bqn"))
-                              (install-file "libcbqn.so" lib)))))))
+     (substitute-keyword-arguments (strip-keyword-arguments
+                                    (list #:tests?)
+                                    (package-arguments cbqn-bootstrap))
+       ((#:make-flags flags #~(list))
+        #~(cons* "shared-o3" "o3" #$flags))
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (replace 'check
+              (lambda* (#:key inputs tests? #:allow-other-keys)
+                (when tests?
+                  (system (string-append "./BQN -M 1000 \""
+                                         #+bqn-sources
+                                         "/test/this.bqn\""))
+                  (map (lambda (x)
+                         (system (string-append "./BQN ./test/" x
+                                                ".bqn")))
+                       '("cmp" "equal" "copy" "random"))
+                  (system "make -C test/ffi"))))
+            (replace 'install
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((bin (string-append (assoc-ref outputs "out")
+                                           "/bin"))
+                       (lib (string-append (assoc-ref outputs "lib")
+                                           "/lib")))
+                  (mkdir-p bin)
+                  (copy-recursively "BQN"
+                                    (string-append bin "/bqn"))
+                  (install-file "libcbqn.so" lib))))))))
     (native-inputs (list dbqn
                          bqn-sources
                          libffi
-- 
2.38.0