GNU bug report logs - #77552
[PATCH 0/5] gnu: cbqn: Update to 0.9.0.

Previous Next

Package: guix-patches;

Reported by: Lee Thompson <lee.p.thomp <at> gmail.com>

Date: Sat, 5 Apr 2025 15:06:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 77552 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#77552; Package guix-patches. (Sat, 05 Apr 2025 15:06:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lee Thompson <lee.p.thomp <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 05 Apr 2025 15:06:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lee Thompson <lee.p.thomp <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Lee Thompson <lee.p.thomp <at> gmail.com>
Subject: [PATCH 0/5] gnu: cbqn: Update to 0.9.0.
Date: Sat,  5 Apr 2025 15:59:16 +0100
This series of patches aims to update CBQN to use the latest v0.9.0 release;
also achieved via this patch series is a full source bootstrap of CBQN without
using pre-compiled bytecode or building DBQN.

I have added both (dzaima's fork of) REPLXX and Singeli as pure sources so CBQN 
can be compiled to make use of them.  Some of this builds on work done in the 
(as far as I can see uncompleted) bug#69023, though this patch series makes no 
attempt to add Singeli as a standalone package.  Regardless of Singeli's value 
here I believe REPLXX adds valuable quality of life improvements to using CBQN 
as an interactive interpreter.

`bqn-sources' has been updated to a recent patch.  I couldn't get the updates
to `cbqn' to build properly without updating `bqn-sources', though the CBQN
repo makes no suggestions as to where in history to take `bqn-sources' from.
I first updated to a commit from the same time as CBQN v0.9.0, but why not
update to something more recent?  In testing this produced no obvious bugs or
weird behaviour vs. CBQN v0.9.0-era checkout.

The `cbqn-bootstrap'->`cbqn' interaction has been rearranged to achieve what I
believe to be a reasonable full-source bootstrap without DBQN.  New tests have
been added also.

I've added comments everywhere I feel appropriate; this might be too verbose
for some so I'm happy to remove any.  `cbqn' has been linted and styled and 
builds and works fine as far as I can see.

Lee Thompson (5):
  gnu: bqn-sources: Update to 5880fa15.
  gnu: Add replxx-sources.
  gnu: Add singeli-sources.
  gnu: cbqn-bootstrap: Update to 0.9.0.
  gnu: cbqn: Update to 0.9.0.

 gnu/packages/bqn.scm | 175 ++++++++++++++++++++++++++++---------------
 1 file changed, 113 insertions(+), 62 deletions(-)

-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77552; Package guix-patches. (Sat, 05 Apr 2025 15:08:03 GMT) Full text and rfc822 format available.

Message #8 received at 77552 <at> debbugs.gnu.org (full text, mbox):

From: Lee Thompson <lee.p.thomp <at> gmail.com>
To: 77552 <at> debbugs.gnu.org
Cc: Lee Thompson <lee.p.thomp <at> gmail.com>
Subject: [PATCH 1/5] gnu: bqn-sources: Update to 5880fa15.
Date: Sat,  5 Apr 2025 16:07:29 +0100
* gnu/packages/bqn.scm (bqn-sources): Update to 5880fa15.

Change-Id: Ida46884232955c3090bca72928f0a6d4240ed45c
---
 gnu/packages/bqn.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index fd090ad433..c9f719939c 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -111,7 +111,7 @@ (define bqn-sources
   ;; Aside from dbqn above, the main bqn repository is used by other
   ;; implementations as a "known good" set of sources. CBQN uses dbqn to
   ;; generate an intermediate bytecode for its own compilation.
-    (let ((commit "71ce36141aaacfa714edca2e408ca522a3bc5554"))
+    (let ((commit "5880fa153bb3e3172afc59a711af7e471aeedcd3"))
       (origin
         (method git-fetch)
         (uri (git-reference
@@ -119,7 +119,7 @@ (define bqn-sources
               (commit commit)))
         (file-name (git-file-name "bqn-sources" commit))
         (sha256
-         (base32 "060a3r5m7hynzxj4iz1av2kj5jf8w3j8yswzzx9wkx31rdrsiv2c")))))
+         (base32 "1cap927i0s8ly4mckppw33ahlc5xnp3l2shk1m79wndf362x3r7c")))))
 
 (define cbqn-bootstrap
   (let* ((revision "2")
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77552; Package guix-patches. (Sat, 05 Apr 2025 15:08:03 GMT) Full text and rfc822 format available.

Message #11 received at 77552 <at> debbugs.gnu.org (full text, mbox):

From: Lee Thompson <lee.p.thomp <at> gmail.com>
To: 77552 <at> debbugs.gnu.org
Cc: Lee Thompson <lee.p.thomp <at> gmail.com>
Subject: [PATCH 2/5] gnu: Add replxx-sources.
Date: Sat,  5 Apr 2025 16:07:30 +0100
* gnu/packages/bqn.scm (replxx-sources): New variable.

Change-Id: I6ab4a714ec82165c7df9e5c67c26b43c40a5c625
---
 gnu/packages/bqn.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index c9f719939c..5c69a2740c 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -121,6 +121,20 @@ (define bqn-sources
         (sha256
          (base32 "1cap927i0s8ly4mckppw33ahlc5xnp3l2shk1m79wndf362x3r7c")))))
 
+(define replxx-sources
+  ;; Dzaima's fork of REPLXX can be used to enhance the CBQN REPL experience
+  ;; with syntax highlighting, readline-like history/navigation, and a
+  ;; prefixed keymap similar to BQNPAD.
+  (let ((commit "13f7b60f4f79c2f14f352a76d94860bad0fc7ce9"))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/dzaima/replxx")
+            (commit commit)))
+      (file-name (git-file-name "replxx" commit))
+      (sha256
+       (base32 "0440xjvdkrbpxqjrd6nsrnaxki0mgyinsb0b1dcshjj3h3jr1yy4")))))
+
 (define cbqn-bootstrap
   (let* ((revision "2")
          (commit "66584ce1491d300746963b8ed17170348b2a03e6"))
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77552; Package guix-patches. (Sat, 05 Apr 2025 15:08:04 GMT) Full text and rfc822 format available.

Message #14 received at 77552 <at> debbugs.gnu.org (full text, mbox):

From: Lee Thompson <lee.p.thomp <at> gmail.com>
To: 77552 <at> debbugs.gnu.org
Cc: Lee Thompson <lee.p.thomp <at> gmail.com>
Subject: [PATCH 3/5] gnu: Add singeli-sources.
Date: Sat,  5 Apr 2025 16:07:31 +0100
* gnu/packages/bqn.scm (singeli-sources): New variable.

Change-Id: I9a96915a23adc786a3c92fd7ad34aaa5ee938ad6
---
 gnu/packages/bqn.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index 5c69a2740c..11a5a48b33 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -135,6 +135,19 @@ (define replxx-sources
       (sha256
        (base32 "0440xjvdkrbpxqjrd6nsrnaxki0mgyinsb0b1dcshjj3h3jr1yy4")))))
 
+(define singeli-sources
+  ;; Singeli can be used to more efficiently implement CBQN primitive
+  ;; operations. Used in this way only its source is required.
+  (let ((commit "53f42ce4331176d281fa577408ec5a652bdd9127"))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/mlochbaum/Singeli")
+            (commit commit)))
+      (file-name (git-file-name "singeli" commit))
+      (sha256
+       (base32 "1dzg4gk74lhy6pwvxzhk4zj1qinc83l7i6x6zpvdajdlz5vqvc1m")))))
+
 (define cbqn-bootstrap
   (let* ((revision "2")
          (commit "66584ce1491d300746963b8ed17170348b2a03e6"))
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77552; Package guix-patches. (Sat, 05 Apr 2025 15:08:04 GMT) Full text and rfc822 format available.

Message #17 received at 77552 <at> debbugs.gnu.org (full text, mbox):

From: Lee Thompson <lee.p.thomp <at> gmail.com>
To: 77552 <at> debbugs.gnu.org
Cc: Lee Thompson <lee.p.thomp <at> gmail.com>
Subject: [PATCH 4/5] gnu: cbqn-bootstrap: Update to 0.9.0.
Date: Sat,  5 Apr 2025 16:07:32 +0100
* gnu/packages/bqn.scm (cbqn-bootstrap): Update to 0.9.0. dbqn dependency
removed. Now runs `make for-bootstrap'.

Change-Id: I54c39dbcad7f485b539cf5fc3156829efec4f8c4
---
 gnu/packages/bqn.scm | 77 ++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index 11a5a48b33..fb153696e6 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -149,47 +149,46 @@ (define singeli-sources
        (base32 "1dzg4gk74lhy6pwvxzhk4zj1qinc83l7i6x6zpvdajdlz5vqvc1m")))))
 
 (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.9.0")
+    (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
+                "0433hp9lgv6w6mhdz0k1kx2rmxia76yy9i0z7ps4qdk7snf2yr2q"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:tests? #f                     ; skipping tests for bootstrap
+      ;; `make for-bootstrap' implicitly disables REPLXX, Singeli
+      #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
+                           ;; Default behaviour is to extract git hash to use for version
+                           ;; string, here our version string is manually substituted in so
+                           ;; git isn't required for building.
+                           (string-append "version=" #$version)
+                           "nogit=1"
+                           "for-bootstrap")
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'configure)
+          (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")))))))
+    (inputs (list 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.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#77552; Package guix-patches. (Sat, 05 Apr 2025 15:08:05 GMT) Full text and rfc822 format available.

Message #20 received at 77552 <at> debbugs.gnu.org (full text, mbox):

From: Lee Thompson <lee.p.thomp <at> gmail.com>
To: 77552 <at> debbugs.gnu.org
Cc: Lee Thompson <lee.p.thomp <at> gmail.com>
Subject: [PATCH 5/5] gnu: cbqn: Update to 0.9.0.
Date: Sat,  5 Apr 2025 16:07:33 +0100
* gnu/packages/bqn.scm (cbqn): Update to 0.9.0. Source-only bootstrap phase to
generate bytecode added. Library dependencies on replxx-sources and
singeli-sources added. New tests added to list. Dependency on dbqn eliminated.

Change-Id: I97ba12dd9d67b944ef7be1d6d76a98f4f2d69e35
---
 gnu/packages/bqn.scm | 67 ++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index fb153696e6..fa3c7bbddc 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -196,39 +196,64 @@ (define-public cbqn
     (name "cbqn")
     (outputs '("out" "lib"))
     (arguments
-     (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)
+     (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
+            ;; Symlinking local copies of REPLXX and Singeli is allowed
+            ;; instead of cloning submodules. `singeli-source' and
+            ;; `replxx-source' git hashes match the submodule hashes for this
+            ;; release of CBQN.
+            (add-before 'build 'link-local-replxx
+              (lambda* (#:key inputs #:allow-other-keys)
+                (symlink #+replxx-sources "build/replxxLocal")))
+            (add-before 'build 'link-local-singeli
+              (lambda* (#:key inputs #:allow-other-keys)
+                (symlink #+singeli-sources "build/singeliLocal")))
+            ;; The BQN built as part of `cbqn-bootstrap' is used here to
+            ;; generate bytecode rather than downloading pre-built bytecode.
+            (add-before 'build 'generate-bytecode
+              (lambda* (#:key inputs #:allow-other-keys)
+                (mkdir-p "build/bytecodeLocal/gen")
+                (system (string-append #+cbqn-bootstrap
+                                       "/bin/bqn build/bootstrap.bqn "
+                                       #+bqn-sources))))
             (replace 'check
               (lambda* (#:key inputs tests? #:allow-other-keys)
                 (when tests?
                   (system (string-append "./BQN -M 1000 \""
-                                         #+bqn-sources
-                                         "/test/this.bqn\""))
+                                         #+bqn-sources "/test/this.bqn\""))
                   (map (lambda (x)
-                         (system (string-append "./BQN ./test/" x
-                                                ".bqn")))
-                       '("cmp" "equal" "copy" "random"))
+                         (system (string-append "./BQN ./test/" x ".bqn")))
+                       '("cmp" "equal"
+                         "copy"
+                         "bitcpy"
+                         "bit"
+                         "mut"
+                         "hash"
+                         "squeezeValid"
+                         "squeezeExact"
+                         "various"
+                         "random"
+                         "joinReuse"))
                   (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"))
+                (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
+                       (lib (string-append (assoc-ref outputs "lib") "/lib"))
                        (include (string-append (assoc-ref outputs "lib")
-                                           "/include")))
+                                               "/include")))
                   (mkdir-p bin)
                   (rename-file "BQN" "bqn")
                   (install-file "bqn" bin)
                   (install-file "libcbqn.so" lib)
                   (install-file "include/bqnffi.h" include))))))))
-    (native-inputs (list dbqn
-                         bqn-sources
-                         libffi))
-    (properties
-     `((tunable? . #t)))))
+    (native-inputs (list bqn-sources cbqn-bootstrap replxx-sources
+                         singeli-sources libffi))
+    (properties `((tunable? . #t)))))
-- 
2.48.1





This bug report was last modified 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.