Subject: [PATCH v2 4/5] gnu: bqn: Update cbqn-bootstrap.

From: aecepoglu <[email-masked]>
Date: Tue, 30 Apr 2024 01:50:33 +0100

gnu/packages/bqn.scm (cbqn-bootstrap): Update cbqn-bootstrap version.
Pass make flags to disable git submodules, disable REPLXX dependency.
Update system invocation to generate bytecode.
Add 'install phase (carried over from cbqn) so other packages can use
cbqn-bootstrap to generate bytecode.

Change-Id: I115737006ef56a90e643c00009155b02a22bf0b1
---
 gnu/packages/bqn.scm | 88 ++++++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index e6cc2aeef1..aca30f38b7 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -147,47 +147,57 @@ (define bqn-sources
       (sha256 (base32 "0jhrazwp4s1a0pzrzyxi7szpchp4avqsvpmslfsgk3c88wf57q6b")))))
 
 (define cbqn-bootstrap
-  (let* ((revision "2")
-         (commit "66584ce1491d300746963b8ed17170348b2a03e6"))
-    (package
-      (name "cbqn-bootstrap")
-      (version (git-version "0" revision commit))
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                      (url "https://github.com/dzaima/CBQN")
-                      (commit commit)))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "13gg96aa56b8k08bjvv8i0f5nxrah2sij7g6pg7i21fdv08rd9iv"))))
-      (build-system gnu-build-system)
-      (arguments
-       (list
-        #:tests? #f                     ; skipping tests for bootstrap
-        #:make-flags #~(list (string-append "CC=" #$(cc-for-target)))
-        #: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 'install
-              (lambda* (#:key outputs #:allow-other-keys)
-                (mkdir-p (string-append #$output "/bin"))
-                (chmod "BQN" #o755)
-                (rename-file "BQN" "bqn")
-                (install-file "bqn" (string-append #$output "/bin")))))))
-      (native-inputs (list dbqn bqn-sources))
-      (inputs (list icedtea-8 libffi))
-      (synopsis "BQN implementation in C")
-      (description "This package provides the reference implementation of
+  (package
+    (name "cbqn-bootstrap")
+    (version "0.6.0")
+    (outputs '("out"))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/dzaima/CBQN")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1qh5hv76bj55ajna8smwniqfa1nmnyqahk40in5bzjsx3vvikpw5"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:tests? #f
+      #:make-flags #~(list (string-append "version="
+                                          #$version)
+                           (string-append "CC="
+                                          #$(cc-for-target)) "REPLXX=0"
+                           "nogit=1" "notui=1")
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'configure)
+                   (add-before 'build 'generate-bytecode
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let ((out (assoc-ref outputs "out")))
+                         (mkdir-p (string-append "./build/bytecodeLocal/gen"))
+                         (system (string-append #+dbqn
+                                  "/bin/dbqn ./build/genRuntime "
+                                  #+bqn-sources " " "./build/bytecodeLocal")))))
+                   (add-after 'generate-bytecode 'symlink-singeli
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (symlink (string-append (assoc-ref inputs "singeli")
+                                               "/lib") "build/singeliLocal")))
+                   (replace 'install
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (mkdir-p (string-append #$output "/bin"))
+                       (chmod "BQN" #o755)
+                       (rename-file "BQN" "bqn")
+                       (install-file "bqn"
+                                     (string-append #$output "/bin")))))))
+    (native-inputs (list singeli dbqn bqn-sources))
+    (inputs (list icedtea-8 libffi))
+    (synopsis "BQN implementation in C")
+    (description
+     "This package provides the reference implementation of
 @uref{https://mlochbaum.github.io/BQN/, BQN}, a programming language inspired
 by APL.")
-      (home-page "https://mlochbaum.github.io/BQN/")
-      (license license:gpl3))))
+    (home-page "https://mlochbaum.github.io/BQN/")
+    (license license:gpl3)))
 
 (define-public cbqn
   (package
-- 
2.44.0