[PATCH v1 1/5] gnu: bqn: Add bqn.scm and dbqn package.

DoneSubmitted by Christopher Rodriguez.
Details
6 participants
  • Liliana Marie Prikler
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • (
  • Christopher Rodriguez
Owner
unassigned
Severity
normal
Merged with
C
C
Christopher Rodriguez wrote on 5 Aug 04:20 +0200
(address . guix-patches@gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220805022023.5044-1-yewscion@gmail.com
Hello all,

This is a set of patches to add CBQN (and the packages required to build it
from source) to the official Guix repository.

CBQN is the recommended implementation of the BQN language, which is a new
array programming language in the same vein as APL, K, Q, J, Dyalog APL,
etc. Even better than most of those, it carries a FSDG compatible license
(the implementation is even under single-license GPL!) and so I feel as
though it should definitely be a part of GNU Guix.

While there are still a few outstanding issues I hope to address with those
upstream eventually (all documented in the comments), I believe I have
followed the guidelines in the manual. Please let me know what I can improve,
and how I might expedite this awesome language's inclusion in GNU Guix.

---
gnu/packages/bqn.scm | 92 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 gnu/packages/bqn.scm

Toggle diff (102 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
new file mode 100644
index 0000000000..53e2f0a057
--- /dev/null
+++ b/gnu/packages/bqn.scm
@@ -0,0 +1,92 @@
+(define-module (gnu packages bqn)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils)
+  #:use-module (guix deprecation)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages java))
+
+;; Currently this package is non-deterministic due to random generation in
+;; some of the primitives. This is marked as a TODO in the source code, but
+;; per the maintainer this package almost solely exists for the purpose of
+;; building CBQN at this point, and therefore is not a high priority. Git
+;; reports this here:
+;;
+;; src/BQN/types/callable/builtins/fns/EpsBuiltin.java:45:71:
+;; …<snip> // TODO these (and in ⊐) shouldn't be random numbers
+;;
+;; Reported Upstream Here: https://github.com/dzaima/BQN/issues/14
+;;
+;; This issue therefore means that none of the packages for bqn can be checked
+;; for non-determinism at this time, as dbqn is a prerequisite for all of
+;; them.
+(define-public dbqn
+  (let* ((tag "0.2.1")
+         (revision "1")
+         (commit "0bbe096fc07d278b679a8479318f1722d096a03e")
+         (hash "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0")
+         (version (git-version tag revision commit)))
+    (package
+      (name "dbqn")
+      (version version)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/dzaima/BQN")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  hash))))
+      (outputs '("out"))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f ;While there is a "test" directory, there is no
+             ;; mechanism to run the tests other than to feed the files into the
+             ;; binary and check for an error. This is outside the scope of a
+             ;; packaging workflow, and would need to be fixed upstream
+             ;; instead. Issue Reported: https://github.com/dzaima/BQN/issues/12
+             ;; Maintainer says many of the tests fail, and so they will remain off
+             ;; until this is sorted out.
+             #:phases #~(modify-phases %standard-phases
+                          (delete 'configure)
+                          (replace 'build
+                            (lambda* _
+                              (invoke "./build")))
+                          (replace 'install
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (let* ((out (assoc-ref outputs "out"))
+                                     (dest-bin (string-append out "/bin"))
+                                     (dest-jar (string-append out
+                                                              "/share/java")))
+                                (mkdir-p dest-bin)
+                                (mkdir-p dest-jar)
+                                (copy-recursively "BQN"
+                                                  (string-append dest-bin
+                                                                 "/dbqn"))
+                                (chmod (string-append dest-bin "/dbqn") 493)
+                                (install-file "BQN.jar" dest-jar))))
+                          (add-after 'install 'subjars
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (let* ((out (assoc-ref outputs "out"))
+                                     (dest-bin (string-append out "/bin"))
+                                     (dest-jar (string-append out
+                                                              "/share/java")))
+                                (substitute* (string-append dest-bin "/dbqn")
+                                  (("BQN.jar")
+                                   (string-append dest-jar "/BQN.jar")))))))))
+      (native-inputs (list `(,openjdk17 "jdk")
+                           coreutils))
+      (synopsis "BQN implementation based on dzaima/APL")
+      (description "BQN implementation based on dzaima/APL.")
+      (home-page "https://github.com/dzaima/BQN")
+      (license license:expat))))

base-commit: 116c0268ffd387c88b6b47135203fb330eb422f0
-- 
2.37.1
C
C
Christopher Rodriguez wrote on 5 Aug 07:46 +0200
[PATCH v2] gnu: bqn: Add bqn.scm and dbqn package.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220805054616.30620-1-yewscion@gmail.com
Thanks to some help from upstream and on IRC (thanks, dzaima and lilyp!) I
was able to remove the non-determinism issue. Here's an updated patch.

---
gnu/packages/bqn.scm | 102 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100644 gnu/packages/bqn.scm

Toggle diff (112 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
new file mode 100644
index 0000000000..261f29ece5
--- /dev/null
+++ b/gnu/packages/bqn.scm
@@ -0,0 +1,102 @@
+(define-module (gnu packages bqn)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils)
+  #:use-module (guix deprecation)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages compression))
+(define-public dbqn
+  (let* ((tag "0.2.1")
+         (revision "1")
+         (commit "0bbe096fc07d278b679a8479318f1722d096a03e")
+         (hash "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0")
+         (version (git-version tag revision commit)))
+    (package
+      (name "dbqn")
+      (version version)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/dzaima/BQN")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  hash))))
+      (outputs '("out"))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f ;While there is a "test" directory, there is no
+             ;; mechanism to run the tests other than to feed the files into the
+             ;; binary and check for an error. This is outside the scope of a
+             ;; packaging workflow, and would need to be fixed upstream
+             ;; instead. Issue Reported: https://github.com/dzaima/BQN/issues/12
+             ;; Maintainer says many of the tests fail, and so they will remain off
+             ;; until this is sorted out.
+             #:imported-modules `(,@%gnu-build-system-modules (guix build
+                                                                    syscalls)
+                                  (guix build ant-build-system))
+             #:modules `((guix build gnu-build-system)
+                         ((guix build ant-build-system)
+                          #:prefix ant:)
+                         (guix build utils))
+             #:phases #~(modify-phases %standard-phases
+                          (delete 'configure)
+                          (replace 'build
+                            (lambda* _
+                              (invoke "./build")))
+                          (add-after 'build 'strip-jar-timestamps
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (write %standard-phases)))
+                          (replace 'install
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (let* ((out (assoc-ref outputs "out"))
+                                     (dest-bin (string-append out "/bin"))
+                                     (dest-jar (string-append out
+                                                              "/share/java")))
+                                (mkdir-p dest-bin)
+                                (mkdir-p dest-jar)
+                                (copy-recursively "BQN"
+                                                  (string-append dest-bin
+                                                                 "/dbqn"))
+                                (chmod (string-append dest-bin "/dbqn") 493)
+                                (install-file "BQN.jar" dest-jar))))
+                          (add-after 'install 'subjars
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (let* ((out (assoc-ref outputs "out"))
+                                     (dest-bin (string-append out "/bin"))
+                                     (dest-jar (string-append out
+                                                              "/share/java")))
+                                (substitute* (string-append dest-bin "/dbqn")
+                                  (("BQN.jar")
+                                   (string-append dest-jar "/BQN.jar"))))))
+                          (add-after 'subjars 'reorder-jar-content
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (apply (cdr (assoc 'reorder-jar-content
+                                                 ant:%standard-phases))
+                                     #:outputs (list outputs))))
+                          (add-after 'reorder-jar-content 'jar-indices
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (apply (cdr (assoc 'generate-jar-indices
+                                                 ant:%standard-phases))
+                                     #:outputs (list outputs))))
+                          (add-after 'jar-indices 'fix-jar-timestamps
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (apply (cdr (assoc 'reorder-jar-content
+                                                 ant:%standard-phases))
+                                     #:outputs (list outputs)))))))
+      (native-inputs (list `(,openjdk17 "jdk") coreutils zip))
+      (synopsis "BQN implementation based on dzaima/APL")
+      (description "BQN implementation based on dzaima/APL.")
+      (home-page "https://github.com/dzaima/BQN")
+      (license license:expat))))

base-commit: 116c0268ffd387c88b6b47135203fb330eb422f0
-- 
2.37.1
L
L
Liliana Marie Prikler wrote on 5 Aug 09:15 +0200
(address . control@debbugs.gnu.org)
7742c07ce28494af40c74262277417e60fe6f500.camel@ist.tugraz.at
merge 56989 56990 56991 56992 56993
thanks

Regarding the patch title, just one level of grouping is enough.
That is, use "gnu: Add dbqn."

Also, you're missing a ChangeLog, i.e.

* gnu/packages/bqn.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register it here.

Note that the second change is lacking from your patch.

Am Freitag, dem 05.08.2022 um 01:46 -0400 schrieb Christopher
Rodriguez:
Toggle quote (41 lines)
> Thanks to some help from upstream and on IRC (thanks, dzaima and
> lilyp!) I
> was able to remove the non-determinism issue. Here's an updated
> patch.
>
> ---
>  gnu/packages/bqn.scm | 102
> +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 102 insertions(+)
>  create mode 100644 gnu/packages/bqn.scm
>
> diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
> new file mode 100644
> index 0000000000..261f29ece5
> --- /dev/null
> +++ b/gnu/packages/bqn.scm
> @@ -0,0 +1,102 @@
> +(define-module (gnu packages bqn)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix gexp)
> +  #:use-module (guix packages)
> +  #:use-module (guix download)
> +  #:use-module (guix git-download)
> +  #:use-module (guix build-system copy)
> +  #:use-module (guix build-system gnu)
> +  #:use-module (guix utils)
> +  #:use-module (guix deprecation)
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages libffi)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages pkg-config)
> +  #:use-module (gnu packages llvm)
> +  #:use-module (gnu packages java)
> +  #:use-module (gnu packages compression))
> +(define-public dbqn
> +  (let* ((tag "0.2.1")
> +         (revision "1")
> +         (commit "0bbe096fc07d278b679a8479318f1722d096a03e")
> +         (hash
> "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0")
> +         (version (git-version tag revision commit)))
Don't let-bind tag, version and hash, use them inline.
Toggle quote (9 lines)
> +    (package
> +      (name "dbqn")
> +      (version version)
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/dzaima/BQN")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
Note that version will be bound here even if you use the version field
to do so.
Toggle quote (19 lines)
> +                (sha256
> +                 (base32
> +                  hash))))
> +      (outputs '("out"))
> +      (build-system gnu-build-system)
> +      (arguments
> +       (list #:tests? #f ;While there is a "test" directory, there
> is no
> +             ;; mechanism to run the tests other than to feed the
> files into the
> +             ;; binary and check for an error. This is outside the
> scope of a
> +             ;; packaging workflow, and would need to be fixed
> upstream
> +             ;; instead. Issue Reported:
> https://github.com/dzaima/BQN/issues/12
> +             ;; Maintainer says many of the tests fail, and so they
> will remain off
> +             ;; until this is sorted out.
You could do
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(for-each (lambda (known-good-test)
(invoke my-glorious-bin known-good-test))
known-good-tests))))
FSVO my-glorious-bin and known-good-tests.
Toggle quote (51 lines)
> +             #:imported-modules `(,@%gnu-build-system-modules (guix
> build
> +                                                                   
> syscalls)
> +                                  (guix build ant-build-system))
> +             #:modules `((guix build gnu-build-system)
> +                         ((guix build ant-build-system)
> +                          #:prefix ant:)
> +                         (guix build utils))
> +             #:phases #~(modify-phases %standard-phases
> +                          (delete 'configure)
> +                          (replace 'build
> +                            (lambda* _
> +                              (invoke "./build")))
> +                          (add-after 'build 'strip-jar-timestamps
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (write %standard-phases)))
> +                          (replace 'install
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (let* ((out (assoc-ref outputs "out"))
> +                                     (dest-bin (string-append out
> "/bin"))
> +                                     (dest-jar (string-append out
> +                                                             
> "/share/java")))
> +                                (mkdir-p dest-bin)
> +                                (mkdir-p dest-jar)
> +                                (copy-recursively "BQN"
> +                                                  (string-append
> dest-bin
> +                                                                
> "/dbqn"))
> +                                (chmod (string-append dest-bin
> "/dbqn") 493)
> +                                (install-file "BQN.jar" dest-jar))))
> +                          (add-after 'install 'subjars
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (let* ((out (assoc-ref outputs "out"))
> +                                     (dest-bin (string-append out
> "/bin"))
> +                                     (dest-jar (string-append out
> +                                                             
> "/share/java")))
> +                                (substitute* (string-append dest-bin
> "/dbqn")
> +                                  (("BQN.jar")
> +                                   (string-append dest-jar
> "/BQN.jar"))))))
Could this be done in/before install?
Toggle quote (8 lines)
> +                          (add-after 'subjars 'reorder-jar-content
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (apply (cdr (assoc 'reorder-jar-
> content
> +                                                 ant:%standard-
> phases))
> +                                     #:outputs (list outputs))))
You can use #:rest args to bind args for apply. Also use assoc-ref
rather than cdr + assoc.
Toggle quote (19 lines)
> +                          (add-after 'reorder-jar-content 'jar-
> indices
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (apply (cdr (assoc 'generate-jar-
> indices
> +                                                 ant:%standard-
> phases))
> +                                     #:outputs (list outputs))))
> +                          (add-after 'jar-indices 'fix-jar-
> timestamps
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (apply (cdr (assoc 'reorder-jar-
> content
> +                                                 ant:%standard-
> phases))
> +                                     #:outputs (list outputs)))))))
> +      (native-inputs (list `(,openjdk17 "jdk") coreutils zip))
Is OpenJDK 17 required?
Toggle quote (4 lines)
> +      (synopsis "BQN implementation based on dzaima/APL")
> +      (description "BQN implementation based on dzaima/APL.")
> +      (home-page "https://github.com/dzaima/BQN")
> +      (license license:expat))))
Cheers
C
C
Christopher Rodriguez wrote on 5 Aug 17:12 +0200
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
87zggin1u0.fsf@gmail.com
Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes:

Toggle quote (3 lines)
> merge 56989 56990 56991 56992 56993
> thanks

Is this notation something anyone can do? I would very much like to be
able to fix my own mistakes in the future.

Toggle quote (8 lines)
> Regarding the patch title, just one level of grouping is enough.
> That is, use "gnu: Add dbqn."
>
> Also, you're missing a ChangeLog, i.e.
>
> * gnu/packages/bqn.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Register it here.

I have amended the commit message to reflect the above. Thanks for the
tips!

I've also added `%D%/packages/bqn.scm` to `gnu/local.mk`, as requested.

Toggle quote (1 lines)
> Don't let-bind tag, version and hash, use them inline.
...
Toggle quote (3 lines)
> Note that version will be bound here even if you use the version field
> to do so.

This makes sense, and I've removed the let binding entirely. My only
uncertainty is where "revision" should go; I've currently attached it to
the upstream version tag (version "0.2.1-1"), where "0.2.1" is the tag
and "1" is the revision. Is this correct?

Toggle quote (9 lines)
> You could do
> (replace 'check
> (lambda* (#:key tests? #:allow-other-keys)
> (when tests?
> (for-each (lambda (known-good-test)
> (invoke my-glorious-bin known-good-test))
> known-good-tests))))
> FSVO my-glorious-bin and known-good-tests.

I plan to do this once I've been able to look at each test and the
entire source and see if I can get it working. I've added an issue
upstream[1] where the author of the package has confirmed it is on "just
enough life support" to build the recommended implementation from
source.

As it stands, I would have to test each test individually anyway, and
only add it to the package if it arbitrarily passes on my machine for
some reason. I don't think there is value there, as tests are meant to
ensure consistency and I cannot do that using such a workflow.

And though this *is* and *should be* a public package, it is *not* the
recommended interpreter for the language. It is primarily included here
to build the recommended one (CBQN) from source, along with some other
tools I've yet to package that require it during build.

Toggle quote (2 lines)
> Could this be done in/before install?

It could, in fact. I've moved it to the above step, and deleted subjars
entirely.

Toggle quote (3 lines)
> You can use #:rest args to bind args for apply. Also use assoc-ref
> rather than cdr + assoc.

I had, for some reason, flipped the arguments on assoc-ref (which
obviously didn't work) and when that failed fell back to cdr + assoc. I
woke up this morning and noticed my mistake; It is fixed now.

As for the #:rest args recommendation: I cannot figure out how to
explicitly bind (list options) to #:options in the apply call using
#:rest. This is probably ignorance on my part; I am still learning the
some of the mechanisms in scheme, and have not used #:rest (or the dot
notation for it) much at all.

Is there an example You could point me to so I can educate myself?

Toggle quote (2 lines)
> Is OpenJDK 17 required?

Really, only a JDK 7+ is required. openjdk17 carries the "openjdk" label
currently, and so I defaulted to that one. Is there another I should use
in my packages instead?


Toggle quote (2 lines)
> Cheers

Thank You for the speedy response!

--

Christopher Rodriguez
(
Re: [bug#56989] [PATCH v2] gnu: bqn: Add bqn.scm and dbqn package.
CLY7GIC21LOR.1V8BM1LV78WAN@guix-aspire
On Fri Aug 5, 2022 at 4:12 PM BST, Christopher Rodriguez wrote:
Toggle quote (6 lines)
> > merge 56989 56990 56991 56992 56993
> > thanks
>
> Is this notation something anyone can do? I would very much like to be
> able to fix my own mistakes in the future.

Yes! :) You can send 'control messages' to <control@debbugs.gnu.org>
to perform operations such as `close`, `merge`, `reopen`, and `unarchive`.

For example:

Toggle quote (10 lines)
> To: control@debbugs.gnu.org
>
> close 19832
> merge 98123 83720 64932
> reopen 10284
> unarchive 29177
> thanks
>
> -- (

("thanks" just stops the processing of commands and treats the rest as
normal text.)

-- (
C
C
Christopher Rodriguez wrote on 5 Aug 17:50 +0200
(name . ()(address . paren@disroot.org)
87v8r6n0zb.fsf@gmail.com
"(" <paren@disroot.org> writes:

Toggle quote (28 lines)
> On Fri Aug 5, 2022 at 4:12 PM BST, Christopher Rodriguez wrote:
>> > merge 56989 56990 56991 56992 56993
>> > thanks
>>
>> Is this notation something anyone can do? I would very much like to be
>> able to fix my own mistakes in the future.
>
> Yes! :) You can send 'control messages' to <control@debbugs.gnu.org>
> to perform operations such as `close`, `merge`, `reopen`, and `unarchive`.
>
> For example:
>
>> To: control@debbugs.gnu.org
>>
>> close 19832
>> merge 98123 83720 64932
>> reopen 10284
>> unarchive 29177
>> thanks
>>
>> -- (
>
> ("thanks" just stops the processing of commands and treats the rest as
> normal text.)
>
> -- (


--
--

Christopher Rodriguez
C
C
Christopher Rodriguez wrote on 5 Aug 17:50 +0200
(name . ()(address . paren@disroot.org)
87sfman0ws.fsf@gmail.com
"(" <paren@disroot.org> writes:

Toggle quote (3 lines)
> Yes! :) You can send 'control messages' to <control@debbugs.gnu.org>
> to perform operations such as `close`, `merge`, `reopen`, and `unarchive`.

Ah, okay, thanks for the examples! I'll have to read up so I know what
all my options are.

--

Christopher Rodriguez
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJMQbvYVxvZ0eF/84XZ6FgaGVz3sFAmLtPKMACgkQXZ6FgaGV
z3v/WBAAxScHa1iztMoIRjkvqK2QgKWnxmSZ7SkbRli8CtZ+PjAjgV/HUc0vhQs7
KaAcRNmsDhmA474iDc9QUvPzcG1T6cosZJoPrcHFdFAXiijF8kmmeDj9sYMymEhQ
8fjAsrcL1OPLyKnCZhodLn4L9df2QfVN/hSzR0XNUx1xDcjdNdDn/ew7rGG7Jt5F
W/zGZj+bcol8Kl2EpWjiHqfZxGBqxkfQs0GJvfBaga1FWPzdkI1do2xlhHad2qvN
XycL7xBegenjh0sRLSgBIaeLMw3QfU6hHsvhn/EA097f1OfKukBiWicVHr4bQRcx
B+Na2jtRW/ID5XP9NErqz71lbTUIOT2XuwB2jGs2907Hjmt82WGnCRxFZDgnoIhh
pGxLHPHNDX0maQrXrGud4icOUAPHvpIkpt5GO1TfuGnoVPit1d3r6/2V4uAvPfOT
KV1N/DYi+VNlJhYuftyFSkPhMgNhK0PmxzEHvxPupLKXa07AEk+d9w1mSHmb/yvT
MQYsBKKMJAcc2l5ewXRNhxUIfm/dych1DIB2eoWfPiSkceyrP5C5j9gVKiubefGY
MkvTbe5x1cyFKwS1AFVBBZVIEAVULFJsji2L8Rq0tq+SjtTl4j9AAKeYCcZh/FDm
35Ln/Hg/ez/sGWRSuqjNqx4YsbNrVvaf/WbAldAbqrAdk4ZI6Kk=
=Xk87
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 6 Aug 00:33 +0200
Re: [PATCH v2] gnu: bqn: Add bqn.scm and dbqn package.
(name . Christopher Rodriguez)(address . yewscion@gmail.com)(address . 56989@debbugs.gnu.org)
5bffe66896dbebfe4716b924eb3d7a13e8e6344b.camel@gmail.com
Am Freitag, dem 05.08.2022 um 11:12 -0400 schrieb Christopher
Rodriguez:
Toggle quote (10 lines)
>
> > Don't let-bind tag, version and hash, use them inline.
> ...
> > Note that version will be bound here even if you use the version
> > field to do so.
>
> This makes sense, and I've removed the let binding entirely. My only
> uncertainty is where "revision" should go; I've currently attached it
> to the upstream version tag (version "0.2.1-1"), where "0.2.1" is the
> tag and "1" is the revision. Is this correct?
You should let-bind revision and commit. You should nt let-bind tag,
version and hash. Use git-version like (git-version "0.2.1" revision
commit).

Toggle quote (20 lines)
>
> > You could do
> >   (replace 'check
> >     (lambda* (#:key tests? #:allow-other-keys)
> >       (when tests?
> >         (for-each (lambda (known-good-test)
> >                     (invoke my-glorious-bin known-good-test))
> >                   known-good-tests))))
> > FSVO my-glorious-bin and known-good-tests.
>
> I plan to do this once I've been able to look at each test and the
> entire source and see if I can get it working. I've added an issue
> upstream[1] where the author of the package has confirmed it is on
> "just enough life support" to build the recommended implementation
> from source.
>
> As it stands, I would have to test each test individually anyway, and
> only add it to the package if it arbitrarily passes on my machine for
> some reason. I don't think there is value there, as tests are meant
> to ensure consistency and I cannot do that using such a workflow.
Fair enough.

Toggle quote (5 lines)
> And though this *is* and *should be* a public package, it is *not*
> the recommended interpreter for the language. It is primarily
> included here to build the recommended one (CBQN) from source, along
> with some other tools I've yet to package that require it during
> build.
That isn't really a good argument not to have tests though. While
package maintainers should check that dependant packages still build,
having early failure for a broken package (courtesy of the check phase)
goes a long way.

Toggle quote (7 lines)
>
> > You can use #:rest args to bind args for apply.  Also use assoc-ref
> > rather than cdr + assoc.
>
> I had, for some reason, flipped the arguments on assoc-ref (which
> obviously didn't work) and when that failed fell back to cdr + assoc.
> I woke up this morning and noticed my mistake; It is fixed now.
Ah, yes, the infamous flip :)

Toggle quote (5 lines)
> As for the #:rest args recommendation: I cannot figure out how to
> explicitly bind (list options) to #:options in the apply call using
> #:rest. This is probably ignorance on my part; I am still learning
> the some of the mechanisms in scheme, and have not used #:rest (or
> the dot notation for it) much at all.
(cons* #:options your-options rest) ?

Toggle quote (7 lines)
> Is there an example You could point me to so I can educate myself?
>
> > Is OpenJDK 17 required?
>
> Really, only a JDK 7+ is required. openjdk17 carries the "openjdk"
> label currently, and so I defaulted to that one. Is there another I
> should use in my packages instead?
If there is no *variable* named "openjdk", I'd suggest using the lowest
one that works. If people are so inclined to use a newer jdk they can
modify the package graph (which is easier than walking back to the
earliest supported version), plus it's lower bootstrap for those of us
building from source.

Cheers
C
C
Christopher Rodriguez wrote on 6 Aug 03:47 +0200
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87fsiam8aa.fsf@gmail.com
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (4 lines)
> You should let-bind revision and commit. You should nt let-bind tag,
> version and hash. Use git-version like (git-version "0.2.1" revision
> commit).

Copy that, I've implemented this change in the upcoming patch.

Toggle quote (6 lines)
> That isn't really a good argument not to have tests though. While
> package maintainers should check that dependant packages still build,
> having early failure for a broken package (courtesy of the check phase)
> goes a long way.
>

I agree with this.

I did check each test, and there were three failing in the cloned repo
on my local machine… Until I ran them inside the package build
environment, where they all passed 100%. I have run this with --check
--rounds=20 and have not seen a failure inside of the build environment,
so I will leave them enabled.

Toggle quote (3 lines)
> Ah, yes, the infamous flip :)
> (cons* #:options your-options rest) ?

I've left these as (#:outputs (list outputs)), as that is less
characters than the above and I'm just passing in a single variable
(inside a list, as that is what the procedure is expecting) without any
(other) modifications.

Toggle quote (6 lines)
> If there is no *variable* named "openjdk", I'd suggest using the lowest
> one that works. If people are so inclined to use a newer jdk they can
> modify the package graph (which is easier than walking back to the
> earliest supported version), plus it's lower bootstrap for those of us
> building from source.

I've successfully built it using icedtea-8 (icedtea-7 failed), so I've
switched the patch over to that.

--

Christopher Rodriguez
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJMQbvYVxvZ0eF/84XZ6FgaGVz3sFAmLtzY0ACgkQXZ6FgaGV
z3tB5w/+Oua4kkLS5hHAuuykT6vVlpWgya/wWnc4TCwHVzRJMIH71i90LgvI4SzJ
7mex9dkpitbR0YCEzX25eibEfPdnFlkk+kVCmBu6loAcFVuNQ+kwxJZiwR03SWut
WIuvV0cK/tbw3RGQf+rj8meOUlVKrl5a122pcm2lSkcD7rSJ+Ga1yID5rh33bvM+
eypfl7C8v2GJw0+gyaYKBUc/pPxBT7VHGV6mZOazYRq+R+sW01OnA4TWO2XH9I4i
0tVijXHkaQN8Lh/9Jr/P+4utxN0jWOWm3tqMrLKYOuQx9qpSSYbs3AeStSddjbl+
Hi5pCpco96YoCOcUWxC2wgNySzYX8EQkN0Zu5k/MSBMxJZQfBuEr79nmpgjZo1i3
miXob3Sl6VU27+Blf22f6ZqDHRLgLEmtIW3Nkwv7D9TvQKS9Olz/ropYQ4DqNj8n
VNN8ANjTUXfpd+SKVnV3GipnZH+0VWKncfPVKCigCcwVhPbNi32kZDFKW9Esf6yD
gosoFjQDWUuPHg03blfkF0qTVK8ZxAaNQMOmPRCXTDLXFjUIwzABF0WrjlN/8LzA
guk4T8DAIoXkVEkLVQn9bBNZToN+spWvVlXZFtroZbNRGl+nJ7SkgVaQ/pFuMozs
W3OHMAdRk2YROnBcBgrPfc/IpCf+Ob0Vvi4g2k3tLb9/gRptmbM=
=dtfS
-----END PGP SIGNATURE-----

C
C
Christopher Rodriguez wrote on 6 Aug 04:20 +0200
[PATCH v3] gnu: Add dbqn.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220806022022.24054-1-yewscion@gmail.com
* gnu/packages/bqn.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Registered it here.
---
gnu/local.mk | 1 +
gnu/packages/bqn.scm | 89 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+)
create mode 100644 gnu/packages/bqn.scm

Toggle diff (111 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 0e8b7b0447..c3f4cc782c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -138,6 +138,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/boost.scm			\
   %D%/packages/bootloaders.scm			\
   %D%/packages/bootstrap.scm			\
+  %D%/packages/bqn.scm				\
   %D%/packages/browser-extensions.scm		\
   %D%/packages/build-tools.scm			\
   %D%/packages/busybox.scm			\
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
new file mode 100644
index 0000000000..456983f71f
--- /dev/null
+++ b/gnu/packages/bqn.scm
@@ -0,0 +1,89 @@
+(define-module (gnu packages bqn)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils)
+  #:use-module (guix deprecation)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages compression))
+(define-public dbqn
+  (let ((commit "0bbe096fc07d278b679a8479318f1722d096a03e")
+        (revision "1"))
+    (package
+      (name "dbqn")
+      (version (git-version "0.2.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/dzaima/BQN")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0"))))
+      (outputs '("out"))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:imported-modules `(,@%gnu-build-system-modules (guix build
+                                                                    syscalls)
+                                  (guix build ant-build-system))
+             #:modules `((guix build gnu-build-system)
+                         ((guix build ant-build-system)
+                          #:prefix ant:)
+                         (guix build utils))
+             #:phases #~(modify-phases %standard-phases
+                          (delete 'configure)
+                          (replace 'build
+                            (lambda* _
+                              (invoke "./build")))
+                          (replace 'check
+                            (lambda* (:#key tests?
+                                            #:allow-other-tags)
+                              (when tests?
+                                (chmod "./BQN" 493)
+                                (system "./BQN ./test/test"))))
+                          (add-after 'install 'reorder-jar-content
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (apply (assoc-ref ant:%standard-phases
+                                                'reorder-jar-content)
+                                     #:outputs (list outputs))))
+                          (add-after 'reorder-jar-content 'jar-indices
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (apply (assoc-ref ant:%standard-phases
+                                                'generate-jar-indices)
+                                     #:outputs (list outputs))))
+                          (add-after 'jar-indices 'fix-jar-timestamps
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (apply (assoc-ref ant:%standard-phases
+                                                'reorder-jar-content)
+                                     #:outputs (list outputs))))
+                          (replace 'install
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (let* ((out (assoc-ref outputs "out"))
+                                     (dest-bin (string-append out "/bin"))
+                                     (dest-jar (string-append out
+                                                              "/share/java")))
+                                (mkdir-p dest-bin)
+                                (mkdir-p dest-jar)
+                                (copy-recursively "BQN"
+                                                  (string-append dest-bin
+                                                                 "/dbqn"))
+                                (chmod (string-append dest-bin "/dbqn") 493)
+                                (install-file "BQN.jar" dest-jar)
+                                (substitute* (string-append dest-bin "/dbqn")
+                                  (("BQN.jar")
+                                   (string-append dest-jar "/BQN.jar")))))))))
+      (native-inputs (list `(,icedtea-8 "jdk") coreutils zip))
+      (synopsis "BQN implementation based on dzaima/APL")
+      (description "BQN implementation based on dzaima/APL.")
+      (home-page "https://github.com/dzaima/BQN")
+      (license license:expat))))

base-commit: 116c0268ffd387c88b6b47135203fb330eb422f0
-- 
2.37.1
C
C
Christopher Rodriguez wrote on 7 Aug 16:43 +0200
Re: [PATCH v2] gnu: bqn: Add bqn.scm and dbqn package.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
8735e8m7t3.fsf@gmail.com
Please let me know if this is acceptable. I'm willing to make any other
changes needed.

I'll start working through the other patches and apply the given
feedback from this one as well, in the meantime.

Thanks!


--

Christopher Rodriguez
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJMQbvYVxvZ0eF/84XZ6FgaGVz3sFAmLvz/gACgkQXZ6FgaGV
z3sGHxAAznLdcPqjpdyENMf/D/kWFvtKVJVn6ZJchNiNCL3dbZNX95A/8Bq+VGcw
WWNE5xDFdD2osHL4xvK5KSzOFfmWsnaLwxas+dDZnFW/LMrVwJ55QEXfoZB0yHrh
0x/4Pu4jPIg5vZSZEgxkJD8VUxq7SV69T8dFS1wfcfJcO+TR1eDDeCJu+EVU5Ywi
lrXLMbSt17mnB+0MHmaEQxv1uFpWOgvWpjnKG2scQkKLNzu3y8mDtDhGF36QeGM9
kqu06uG+XfWogL2tQBhlxGrTULeauiGE+Z8MIE812hdmYq/mgrvs6PuZ2wgyk5aA
w59AGFNITZRgampU5dszrQFBaoXO1Kv8oJtiqv5XUSearQG2B+MIo5Da/S50qFH2
KeeGmL1rb2WAefsIK9WDA0glg+BUN13wOGkc1vAJ82ARgiH+ywiKGsN3VaXpwHNB
syg3D9RYmjfle4mQEZjvt0DNVUm0x1qVKIvcR2dpeYi0FyPRm48b274sPFXdvoub
sAMXtfwdrMp51huKl5CUxv7uGPeWdQ53/FcZahKdYHhZzUIAQWwsfv0sCmkYyTu5
ZsYVA8chelV4o/S3th0/eic6M2jCRTTWZ9x43JHKKBN2HsoJ5CblUhk9EW3YWMVu
t+vReAf40ZdJu/TP2b+fVt8U/pX7a+07cYptrwIosqJ/NB7jLHE=
=DoCU
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 7 Aug 18:28 +0200
Re: [PATCH v3] gnu: Add dbqn.
24ad558d70673af82e334a759e887f0b49a757c8.camel@gmail.com
Am Freitag, dem 05.08.2022 um 22:20 -0400 schrieb Christopher
Rodriguez:
Toggle quote (2 lines)
> * gnu/packages/bqn.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Registered it here.
Don't know if that's just my preference or everyone's, but I like
present tense.

Toggle quote (66 lines)
> ---
>  gnu/local.mk         |  1 +
>  gnu/packages/bqn.scm | 89
> ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 90 insertions(+)
>  create mode 100644 gnu/packages/bqn.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 0e8b7b0447..c3f4cc782c 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -138,6 +138,7 @@ GNU_SYSTEM_MODULES
> =                                \
>    %D%/packages/boost.scm                       \
>    %D%/packages/bootloaders.scm                 \
>    %D%/packages/bootstrap.scm                   \
> +  %D%/packages/bqn.scm                         \
>    %D%/packages/browser-extensions.scm          \
>    %D%/packages/build-tools.scm                 \
>    %D%/packages/busybox.scm                     \
> diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
> new file mode 100644
> index 0000000000..456983f71f
> --- /dev/null
> +++ b/gnu/packages/bqn.scm
> @@ -0,0 +1,89 @@
> +(define-module (gnu packages bqn)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix gexp)
> +  #:use-module (guix packages)
> +  #:use-module (guix download)
> +  #:use-module (guix git-download)
> +  #:use-module (guix build-system copy)
> +  #:use-module (guix build-system gnu)
> +  #:use-module (guix utils)
> +  #:use-module (guix deprecation)
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages libffi)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages pkg-config)
> +  #:use-module (gnu packages llvm)
> +  #:use-module (gnu packages java)
> +  #:use-module (gnu packages compression))
> +(define-public dbqn
> +  (let ((commit "0bbe096fc07d278b679a8479318f1722d096a03e")
> +        (revision "1"))
> +    (package
> +      (name "dbqn")
> +      (version (git-version "0.2.1" revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/dzaima/BQN")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                 
> "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0"))))
> +      (outputs '("out"))
> +      (build-system gnu-build-system)
> +      (arguments
> +       (list #:imported-modules `(,@%gnu-build-system-modules (guix
> build
> +                                                                   
> syscalls)
Put #:imported modules on a new line, same for (guix build syscalls).
Toggle quote (15 lines)
> +                                  (guix build ant-build-system))
> +             #:modules `((guix build gnu-build-system)
> +                         ((guix build ant-build-system)
> +                          #:prefix ant:)
> +                         (guix build utils))
> +             #:phases #~(modify-phases %standard-phases
> +                          (delete 'configure)
> +                          (replace 'build
> +                            (lambda* _
> +                              (invoke "./build")))
> +                          (replace 'check
> +                            (lambda* (:#key tests?
> +                                            #:allow-other-tags)
> +                              (when tests?
> +                                (chmod "./BQN" 493)
Use octal notation for chmod.
Toggle quote (48 lines)
> +                                (system "./BQN ./test/test"))))
> +                          (add-after 'install 'reorder-jar-content
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (apply (assoc-ref ant:%standard-phases
> +                                                'reorder-jar-
> content)
> +                                     #:outputs (list outputs))))
> +                          (add-after 'reorder-jar-content 'jar-
> indices
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (apply (assoc-ref ant:%standard-phases
> +                                                'generate-jar-
> indices)
> +                                     #:outputs (list outputs))))
> +                          (add-after 'jar-indices 'fix-jar-
> timestamps
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (apply (assoc-ref ant:%standard-phases
> +                                                'reorder-jar-
> content)
> +                                     #:outputs (list outputs))))
> +                          (replace 'install
> +                            (lambda* (#:key outputs #:allow-other-
> keys)
> +                              (let* ((out (assoc-ref outputs "out"))
> +                                     (dest-bin (string-append out
> "/bin"))
> +                                     (dest-jar (string-append out
> +                                                             
> "/share/java")))
> +                                (mkdir-p dest-bin)
> +                                (mkdir-p dest-jar)
> +                                (copy-recursively "BQN"
> +                                                  (string-append
> dest-bin
> +                                                                
> "/dbqn"))
> +                                (chmod (string-append dest-bin
> "/dbqn") 493)
> +                                (install-file "BQN.jar" dest-jar)
> +                                (substitute* (string-append dest-bin
> "/dbqn")
> +                                  (("BQN.jar")
> +                                   (string-append dest-jar
> "/BQN.jar")))))))))
Other than that LGTM modulo not having tested anything as of yet.

Cheers
M
M
Maxime Devos wrote on 8 Aug 11:19 +0200
Re: [bug#56989] [PATCH v3] gnu: Add dbqn.
00125176-9e1f-6d91-21d8-0d2fd9558aca@telenet.be
On 06-08-2022 04:20, Christopher Rodriguez wrote:
Toggle quote (1 lines)
> +(define-module (gnu packages bqn)
Copyright and license headers are missing. Also, usually we don't do
per-package modules but rather thematic modules, though that's not a
hard rule especially if there are technical problems with that.
Toggle quote (9 lines)
> + #:use-module ((guix licenses) #:prefix license:)
> + #:use-module (guix gexp)
> + #:use-module (guix packages)
> + #:use-module (guix download)
> + #:use-module (guix git-download)
> + #:use-module (guix build-system copy)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix utils)
> + #:use-module (guix deprecation)
I don't think you are using (guix deprecation) below?
Toggle quote (22 lines)
> + #:use-module (gnu packages)
> + #:use-module (gnu packages libffi)
> + #:use-module (gnu packages base)
> + #:use-module (gnu packages pkg-config)
> + #:use-module (gnu packages llvm)
> + #:use-module (gnu packages java)
> + #:use-module (gnu packages compression))
> +(define-public dbqn
> + (let ((commit "0bbe096fc07d278b679a8479318f1722d096a03e")
> + (revision "1"))
> + (package
> + (name "dbqn")
> + (version (git-version "0.2.1" revision commit))
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url"https://github.com/dzaima/BQN")
> + (commit commit)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0"))))
I have looked at the 'v0.2.1' tag, and it points at the 0bbe096...
commit, so you are actually packaging version 0.2.1, not some git commit
after v0.2.1. As such, no need for (git-version ...), you can just write
"0.2.1" there. Then 'revision' becomes unused and can be dropped, and
'commit' is only used in a single place anymore so it can be inlined.
Toggle quote (1 lines)
> + (native-inputs (list `(,icedtea-8 "jdk") coreutils zip))
coreutils is an implicit (native-)input, likely no need to to mention it.
Also, the Makefile mentions that the executable to start things has
#!/bin/bash -- to properly patch is when cross-compiling, you need
'bash-minimal' or 'bash' in inputs, otherwise it will be patched for the
wrong architecture.
Also, that script runs 'java' -- make sure it is patched too such that
java will actually be found -- and to patch it, you need to have
icedtea:out or openjdk:out in 'inputs'.
Toggle quote (1 lines)
> + (outputs '("out"))
That's the default, no need to set it.
Toggle quote (2 lines)
> + (list #:imported-modules `(,@%gnu-build-system-modules (guix build
> + syscalls)
For formatting, (guix build syscalls) should be on a separate line.
Toggle quote (2 lines)
> + (synopsis "BQN implementation based on dzaima/APL")
> + (description "BQN implementation based on dzaima/APL.")
The synopsis and description are identical, and this doesn't explain
much to people who don't know what 'BQN' is. Can it be rewritten such
that people not familiar with BQN can decide whether this ‘BQN’ is
something that's useful for them? '(guix)Synopses and Descriptions' has
more information.
Toggle quote (2 lines)
> + (lambda* (:#key tests?
> + #:allow-other-tags)
Why the : before #:key? Also, no need to break it in separate lines.
Toggle quote (5 lines)
> + (add-after 'install 'reorder-jar-content
> + (lambda* (#:key outputs #:allow-other-keys)
> + (apply (assoc-ref ant:%standard-phases
> + 'reorder-jar-content)
> + #:outputs (list outputs))))
'output's is a list of strings, now you are giving reorder-jar-content a
list of lists of strings
However, looking at (guix build ant-build-system), it looks like it just
wants a list of strings.
As such, maybe it should be:
(add-after 'install 'reorder-jar-content
  (assoc-ref ant:%standard-phases 'reorder-jar-content))
? (untested)  Possibly likewise for the other phases.
Toggle quote (1 lines)
> (the implementation is even under single-license GPL!) [...]
You are writing license:expat in the 'license' field, not
license:gplN/license:gplN+. Is it Expat or is it GPL?
Toggle quote (1 lines)
> + (synopsis "Official BQN sources in BQN")
If they are just sources, you can do (define bqn-bytecode-sources
(origin ...))
Toggle quote (2 lines)
> + (license license:gpl3))))
The 'LICENSE' file says something different. I don't think that's the
home page, maybe https://mlochbaum.github.io/BQN/ instead?
Toggle quote (1 lines)
> + (chmod "BQN" 493)
Hexadecimal would be clearer.
Toggle quote (2 lines)
> + "The expected implementation for the BQN language,
> +according to the official documentation of that specification.")
expected -> standard (what's 'expected' depends on the user, they might
want a different implementation), unless it's not the standard
implementation.
'documentation of that specification' -> 'the specification (pleonasm)
And maybe remove 'official', given the absence of 'official' in the
descriptions of, say, guile, gcc, openjdk and java, this sounds
marketing and unfair to me.
(singeli-bootstrap:)
Toggle quote (5 lines)
> + (let* ((tag "0")
> + (revision "1")
> + (commit "fd17b144483549dbd2bcf23e3a37a09219171a99")
> + (hash "1rr4l7ijzcg25n2igi1mzya6qllh5wsrf3m5i429rlgwv1fwvfji")
> + (version (git-version tag revision commit)))
I'm not seeing a '0' tag anywhere in the repository -- I dont see any
tags at all tere.
Toggle quote (1 lines)
> + (inputs (list bqn-bytecode-sources libffi singeli-bootstrap))))
For cross-compilation, I would have expected sengili-bootstrap in
native-inputs, not inputs, assuming that it is used as a compiler. Does
cross-compilation (with --target) work?
Greetings,
Maxime.
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 8 Aug 11:20 +0200
Re: [bug#56989] [PATCH v1 1/5] gnu: bqn: Add bqn.scm and dbqn package.
c0c3e85a-20b2-d00a-c0aa-1bb85088393a@telenet.be
Nevermind my remarks on hexadecimal, octal would be better I think, like
lilyp wrote.
Greetings,
Maxime.
Attachment: OpenPGP_signature
C
C
Christopher Rodriguez wrote on 8 Aug 15:54 +0200
Re: [bug#56989] [PATCH v3] gnu: Add dbqn.
(name . Maxime Devos)(address . maximedevos@telenet.be)
87h72mx0t7.fsf@gmail.com
Toggle quote (4 lines)
> Maxime Devos <maximedevos@telenet.be> writes:
> Copyright and license headers are missing. Also, usually we don't do
> per-package modules but rather thematic modules, though that's not a hard
> rule especially if there are technical problems with that.
Ah, right, I forgot about those. Not used to creating new files. Will be
in the patch I'm sending shortly.

As for the per-package rule, this will not be the only package for this
file. Aside from the 2 user-facing packages and 3 bootstrap packages in
this series, I'm hoping to package a further (at least) 3 packages—a
standard library, a DSL, and a primer (info).

I'm also hoping to package an emacs mode, a few fonts, and an update to
a few packages to add BQN support. But those have their own files, and
won't be included here.

Is that enough of a justification for a new file, or should I look to
add this to another? I /suppose/ apl.scm would work, though technically
that would be like scheme, common lisp, arc, clojure, et al being
grouped in the same language. WDYT?

Toggle quote (1 lines)
> I don't think you are using (guix deprecation) below?
I don't think I am either, now that You mention it. Somehow that made
its way into my starting template; I will remove it in the forthcoming
patch.

Toggle quote (5 lines)
> I have looked at the 'v0.2.1' tag, and it points at the 0bbe096... commit, so
> you are actually packaging version 0.2.1, not some git commit after
> v0.2.1. As such, no need for (git-version ...), you can just write "0.2.1"
> there. Then 'revision' becomes unused and can be dropped, and 'commit' is
> only used in a single place anymore so it can be inlined.
This honestly confused me a bit at first, but I think I see what You
mean now. Since it's an official upstream version, that can be the
version, instead of using git-version. I will apply these changes as well.

Toggle quote (11 lines)
>> + (native-inputs (list `(,icedtea-8 "jdk") coreutils zip))
> coreutils is an implicit (native-)input, likely no need to to mention it.
>
> Also, the Makefile mentions that the executable to start things has
> #!/bin/bash -- to properly patch is when cross-compiling, you need
> 'bash-minimal' or 'bash' in inputs, otherwise it will be patched for the
> wrong architecture.
>
> Also, that script runs 'java' -- make sure it is patched too such that java
> will actually be found -- and to patch it, you need to have icedtea:out or
> openjdk:out in 'inputs'.
Per the feedback I received from Liliana, I will use icedtea:out to (as
there is less bootstrapping required if building everything from
source). I'll also add bash-minimal in place of the unneeded
coreutils, and place both icedtea:out and bash-minimal in inputs rather
than native, as they are expected for the target machine.

Toggle quote (14 lines)
>> + (outputs '("out"))
> That's the default, no need to set it.
>> + (list #:imported-modules `(,@%gnu-build-system-modules (guix build
>> + syscalls)
> For formatting, (guix build syscalls) should be on a separate line.
>> + (synopsis "BQN implementation based on dzaima/APL")
>> + (description "BQN implementation based on dzaima/APL.")
> The synopsis and description are identical, and this doesn't explain much to
> people who don't know what 'BQN' is. Can it be rewritten such that people not
> familiar with BQN can decide whether this ‘BQN’ is something that's useful
> for them? '(guix)Synopses and Descriptions' has more information.
>> + (lambda* (:#key tests?
>> + #:allow-other-tags)
> Why the : before #:key? Also, no need to break it in separate lines.
All of these points are addressed in the forthcoming (v4) patch. In
particular, thanks for calling out the description: It had been a
placeholder while I was getting things working, and I'm happy to replace
it with something more descriptive. And the `:#key` was a typo, unsure
how it has worked thus far, as I had tests disabled up until
recently. Maybe I was using the stock check phase, then. I forget, tbh.

Toggle quote (16 lines)
>> + (add-after 'install 'reorder-jar-content
>> + (lambda* (#:key outputs #:allow-other-keys)
>> + (apply (assoc-ref ant:%standard-phases
>> + 'reorder-jar-content)
>> + #:outputs (list outputs))))
> 'output's is a list of strings, now you are giving reorder-jar-content a list
> of lists of strings
> However, looking at (guix build ant-build-system), it looks like it just
> wants a list of strings.
>
> As such, maybe it should be:
>
> (add-after 'install 'reorder-jar-content
>   (assoc-ref ant:%standard-phases 'reorder-jar-content))
>
> ? (untested)  Possibly likewise for the other phases.
This intrigues me. The list of outputs was a kludge to allow the
function to accept the singleton output. If the singleton is still
wrapped in a list, then I'm unsure why it fails. Perhaps I need to test
this more; will do so before sending v4.

Toggle quote (3 lines)
>> (the implementation is even under single-license GPL!) [...]
> You are writing license:expat in the 'license' field, not
> license:gplN/license:gplN+. Is it Expat or is it GPL?
So, this package (dbqn) is expat. The implementation I referenced above
(which is recommended and actively developed) is a different one (cbqn)
that relies on this one as a dependency for bootstrapping, and is under
gpl.

I really just wanted to add cbqn to guix, but can't do so without dbqn,
which /is/ still functional, is depended on by a bunch of tooling for
the language, and may as well also be a package because of the above
(sort of like how someone using common lisp may view clisp as a slow
dependency of sbcl, or they may instead choose to use it as their target
implementation).

Toggle quote (3 lines)
>> + (synopsis "Official BQN sources in BQN")
> If they are just sources, you can do (define bqn-bytecode-sources (origin
> ...))
I had not realized the package was unneeded! That might simplify things
greatly. I love packaging things for guix; I always learn something new.

Toggle quote (4 lines)
>> + (license license:gpl3))))
> The 'LICENSE' file says something different. I don't think that's the home
> page, maybe <https://mlochbaum.github.io/BQN/> instead?
So, https://mlochbaum.github.io/BQN is the homepage of the language,
but the sources we're using are only a part of that language
definition.

In particular, we're only using the src/ and test/ directories of that
repository. We're ignoring the docs, commentary, editor plugins, fonts,
implementation instructions, spec, tutorial, javascript implementation,
etc. We really are just targetting the sources for the bytecode and the
tests, which is why I thought the repo itself makes a better homepage.

Should I change that to the homepage for the language?

As for the LICENSE file, indeed, it is isc. Thanks for the catch.

Toggle quote (3 lines)
>
>> + (chmod "BQN" 493)
> Hexadecimal would be clearer.
As in Your second message, I will use the octal notation per Liliana.

Toggle quote (10 lines)
>> + "The expected implementation for the BQN language,
>> +according to the official documentation of that specification.")
> expected -> standard (what's 'expected' depends on the user, they might want
> a different implementation), unless it's not the standard implementation.
>
> 'documentation of that specification' -> 'the specification (pleonasm)
>
> And maybe remove 'official', given the absence of 'official' in the
> descriptions of, say, guile, gcc, openjdk and java, this sounds marketing and
> unfair to me.
I will change this to "The standard implementation of the BQN language,
according to the specification." (Also, thank You for teaching me
'pleonasm'!)

Toggle quote (9 lines)
> (singeli-bootstrap:)
>
>> + (let* ((tag "0")
>> + (revision "1")
>> + (commit "fd17b144483549dbd2bcf23e3a37a09219171a99")
>> + (hash "1rr4l7ijzcg25n2igi1mzya6qllh5wsrf3m5i429rlgwv1fwvfji")
>> + (version (git-version tag revision commit)))
> I'm not seeing a '0' tag anywhere in the repository -- I dont see any tags at
> all tere.
There are none; I thought the absence of any tage necessitates a '0' for
the version number, and wanted to keep the definitions
standardized. Should I inline the 0 instead in the git-version?

Toggle quote (4 lines)
>> + (inputs (list bqn-bytecode-sources libffi singeli-bootstrap))))
> For cross-compilation, I would have expected sengili-bootstrap in
> native-inputs, not inputs, assuming that it is used as a compiler. Does
> cross-compilation (with --target) work?
Singeli is written in BQN, which is an interpreted language. So, as long
as the BQN interpreter is for the correct architecture, it will work. It
will never be compiled itelf.

Thank You for all of the feedback! I'll try to have a revised set of
patches in by this evening EDT, in the next 8 hours.

--

Christopher Rodriguez
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJMQbvYVxvZ0eF/84XZ6FgaGVz3sFAmLxHqQACgkQXZ6FgaGV
z3uqJRAAjC1FB/NLE6/5KQpQrhPVq08yHVlpKBDDneJnAOooV87Xg0RpFi//xUJn
RySRacvDI6OGjhcUiAA2/toUKULBzlw1gOZjJoZ4PBwhWyJQtfCHoskDmLo74G9f
7SbOQmRh385fmz5szdKETScJ6832KL3yVklfDpGhotoxn6EySG6mNoBFg7gCM0Il
nDXoAI1UnUGrV+LhAExk76DnVGoYViPdle8kDObh9h3r8SJ45zE6qI25uKqwW4nc
jb3nToZT9/dd22xyQmHiAjjoyjcm/MQjz2RgE8+tG8A+8irM6tijH4tVe2ky5N1g
s326d/FrUEk46xWjUJZDhSarrm0s8ah0acI6RGqQ8PJBOgVkEN8mH/U7YVG6u4sx
wvVYIDyxCK8RiQlO4PCJPe6+7vnZmOaEJGOerrqjpiBJqv1yiTGTcfvE7VYJtETh
yQkNUd2ilwnliMVyBH8O0rSDF6ECJsLE17HzPwDUJPE+qBcwKKV2ssqFZ0bdVAmJ
OcQahkRHuy2tuxeON+pF0RmXxsA1B2+qmzRg4IJ9ZR/tGhbs1m2QoiqNcqOiMOHp
PqMBFkCnW8QKWOOsUfjRrdOZ9HFwRMINRAFlg1U9upg6NxOiYNrIBvfCmhc9RrnH
rf9O2+3U1HeUSpzX83tX1j3+Z+BmJP0J8XP+PAV3FFYPOmRfbl4=
=bee8
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 8 Aug 23:09 +0200
(name . Christopher Rodriguez)(address . yewscion@gmail.com)(address . 56989@debbugs.gnu.org)
6d6ba7e4-06f7-cecc-d31c-e84c9a35893c@telenet.be
On 08-08-2022 15:54, Christopher Rodriguez wrote:
Toggle quote (19 lines)
>> Maxime Devos<maximedevos@telenet.be> writes:
>> Copyright and license headers are missing. Also, usually we don't do
>> per-package modules but rather thematic modules, though that's not a hard
>> rule especially if there are technical problems with that.
> Ah, right, I forgot about those. Not used to creating new files. Will be
> in the patch I'm sending shortly.
>
> As for the per-package rule, this will not be the only package for this
> file. Aside from the 2 user-facing packages and 3 bootstrap packages in
> this series, I'm hoping to package a further (at least) 3 packages—a
> standard library, a DSL, and a primer (info).
>
> I'm also hoping to package an emacs mode, a few fonts, and an update to
> a few packages to add BQN support. But those have their own files, and
> won't be included here.
>
> Is that enough of a justification for a new file, or should I look to
> add this to another? I/suppose/ apl.scm would work, though technically
> that would be like scheme, common lisp, arc, clojure, et al being
I didn't notice the [2/5, 3/5, 4/5, 5/5] patches, the new file should be
fine I think
Greetings,
Maxime
Attachment: file
Attachment: OpenPGP_signature
C
C
Christopher Rodriguez wrote on 9 Aug 03:22 +0200
[PATCH v4] gnu: Add dbqn.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220809012205.8692-1-yewscion@gmail.com
* gnu/packages/bqn.scm: Create module.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register module.
---
gnu/local.mk | 1 +
gnu/packages/bqn.scm | 105 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 106 insertions(+)
create mode 100644 gnu/packages/bqn.scm

Toggle diff (127 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 0e8b7b0447..c3f4cc782c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -138,6 +138,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/boost.scm			\
   %D%/packages/bootloaders.scm			\
   %D%/packages/bootstrap.scm			\
+  %D%/packages/bqn.scm				\
   %D%/packages/browser-extensions.scm		\
   %D%/packages/build-tools.scm			\
   %D%/packages/busybox.scm			\
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
new file mode 100644
index 0000000000..1fc2dc82af
--- /dev/null
+++ b/gnu/packages/bqn.scm
@@ -0,0 +1,105 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Christopher Rodriguez <yewscion@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+(define-module (gnu packages bqn)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages compression))
+(define-public dbqn
+  (package
+    (name "dbqn")
+    (version "0.2.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/dzaima/BQN")
+                    (commit "0bbe096fc07d278b679a8479318f1722d096a03e")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1kxzxz2hrd1871281s4rsi569qk314aqfmng9pkqn8gv9nqhmph0"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:imported-modules `(,@%gnu-build-system-modules
+                           (guix build syscalls)
+                           (guix build ant-build-system))
+      #:modules `((guix build gnu-build-system)
+                  ((guix build ant-build-system)
+                   #:prefix ant:)
+                  (guix build utils))
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'configure)
+                   (replace 'build
+                     (lambda* _
+                       (invoke "./build")
+                       (chmod "./BQN" #o755)))
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (system "./BQN ./test/test"))))
+                   (add-after 'install 'reorder-jar-content
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (apply (assoc-ref ant:%standard-phases
+                                         'reorder-jar-content)
+                              #:outputs (list outputs))))
+                   (add-after 'reorder-jar-content 'jar-indices
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (apply (assoc-ref ant:%standard-phases
+                                         'generate-jar-indices)
+                              #:outputs (list outputs))))
+                   (add-after 'jar-indices 'fix-jar-timestamps
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (apply (assoc-ref ant:%standard-phases
+                                         'reorder-jar-content)
+                              #:outputs (list outputs))))
+                   (replace 'install
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (dest-bin (string-append out "/bin"))
+                              (dest-jar (string-append out "/share/java")))
+                         (mkdir-p dest-bin)
+                         (mkdir-p dest-jar)
+                         (copy-recursively "BQN"
+                                           (string-append dest-bin
+                                                          "/dbqn"))
+                         (install-file "BQN.jar" dest-jar)
+                         (substitute* (string-append dest-bin "/dbqn")
+                           (("BQN.jar")
+                            (string-append dest-jar "/BQN.jar")))))))))
+    (native-inputs (list `(,icedtea-8 "jdk") zip))
+    (inputs (list icedtea-8 bash-minimal))
+    (synopsis "BQN implementation based on dzaima/APL")
+    (description
+     "dbqn is a java implementation of the BQN programming
+language that does not need to be bootstrapped, based on an earlier java
+implementation of APL by the same author.")
+    (home-page "https://github.com/dzaima/BQN")
+    (license license:expat)))

base-commit: 116c0268ffd387c88b6b47135203fb330eb422f0
-- 
2.37.1
M
M
Maxime Devos wrote on 9 Aug 10:58 +0200
Re: [bug#56989] [PATCH v3] gnu: Add dbqn.
(name . Christopher Rodriguez)(address . yewscion@gmail.com)(address . 56989@debbugs.gnu.org)
fd83320f-5181-c929-4598-4ea386165b83@telenet.be
On 08-08-2022 15:54, Christopher Rodriguez wrote:
Toggle quote (9 lines)
>>> + (commit "fd17b144483549dbd2bcf23e3a37a09219171a99")
>>> + (hash "1rr4l7ijzcg25n2igi1mzya6qllh5wsrf3m5i429rlgwv1fwvfji")
>>> + (version (git-version tag revision commit)))
>> I'm not seeing a '0' tag anywhere in the repository -- I dont see any tags at
>> all tere.
> There are none; I thought the absence of any tage necessitates a '0' for
> the version number, and wanted to keep the definitions
> standardized. Should I inline the 0 instead in the git-version?
>
Yes, if upstream doesn't do versioning we use "0" or sometimes "0.0", in
combination with git-version (or hg-version, ...). However, "0" is not a
tag, so the variable 'tag' needs to be renamed or inlined.  As it is
only used in a signle place, I would recommend inlining it. Likewise for
'version'.
Additionally, 'hash' needs to be inlined -- not only because it is used
in a single place, but also because there is some compile-time error
checking for hashes that only can work when it is inlined.
Also, I've seen a v2 for the first patch, but what happened to 2/5, 3/5,
4/5 and 5/5?
Greetings,
Maxime.
Attachment: file
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 9 Aug 11:02 +0200
(name . Christopher Rodriguez)(address . yewscion@gmail.com)(address . 56989@debbugs.gnu.org)
369a70b6-fbb9-b646-d1a4-2db09a368566@telenet.be
On 09-08-2022 10:58, Maxime Devos wrote:
Toggle quote (2 lines)
> Also, I've seen a v2 for the first patch, but what happened to 2/5,
> 3/5, 4/5 and 5/5?
I meant v4.
Greetings,
Maxime.
Attachment: OpenPGP_signature
C
C
Christopher Rodriguez wrote on 10 Aug 19:27 +0200
[PATCH v5 1/5] gnu: Add dbqn package.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220810172800.13189-1-yewscion@gmail.com
* gnu/packages/bqn.scm: Create module.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register module.
---
gnu/packages/bqn.scm | 108 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
create mode 100644 gnu/packages/bqn.scm

Toggle diff (118 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
new file mode 100644
index 0000000000..f00392a4f9
--- /dev/null
+++ b/gnu/packages/bqn.scm
@@ -0,0 +1,108 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Christopher Rodriguez <yewscion@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+(define-module (gnu packages bqn)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system copy)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu packages compression))
+(define-public dbqn
+  (let ((commit "88f2b43966a75cc2c382421218eb30003bb16f4a")
+        (revision "1"))
+  (package
+    (name "dbqn")
+    (version (git-version "0.2.1" revision commit))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/dzaima/BQN")
+                    (commit commit)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "06mzvv7kmandhgwb6jwz3rivsj4ic549sy8afnb5zr6mfn5isyg5"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:imported-modules `(,@%gnu-build-system-modules
+                           (guix build syscalls)
+                           (guix build ant-build-system))
+      #:modules `((guix build gnu-build-system)
+                  ((guix build ant-build-system)
+                   #:prefix ant:)
+                  (guix build utils))
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'configure)
+                   (replace 'build
+                     (lambda* _
+                       (invoke "./build")
+                       (chmod "./BQN" #o755)))
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (system "./BQN ./test/test"))))
+                   (add-after 'install 'reorder-jar-content
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (apply (assoc-ref ant:%standard-phases
+                                         'reorder-jar-content)
+                              #:outputs (list outputs))))
+                   (add-after 'reorder-jar-content 'jar-indices
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (apply (assoc-ref ant:%standard-phases
+                                         'generate-jar-indices)
+                              #:outputs (list outputs))))
+                   (add-after 'jar-indices 'fix-jar-timestamps
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (apply (assoc-ref ant:%standard-phases
+                                         'reorder-jar-content)
+                              #:outputs (list outputs))))
+                   (replace 'install
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (dest-bin (string-append out "/bin"))
+                              (dest-jar (string-append out "/share/java")))
+                         (mkdir-p dest-bin)
+                         (mkdir-p dest-jar)
+                         (copy-recursively "BQN"
+                                           (string-append dest-bin
+                                                          "/dbqn"))
+                         (install-file "BQN.jar" dest-jar)
+                         (substitute* (string-append dest-bin "/dbqn")
+                           (("BQN.jar")
+                            (string-append dest-jar "/BQN.jar")))))))))
+    (native-inputs (list `(,icedtea-8 "jdk") zip))
+    (inputs (list icedtea-8 bash-minimal))
+    (synopsis "BQN implementation based on dzaima/APL")
+    (description
+     "dbqn is a java implementation of the BQN programming
+language that does not need to be bootstrapped, based on an earlier java
+implementation of APL by the same author.")
+    (home-page "https://github.com/dzaima/BQN")
+    (license license:expat))))

base-commit: b21d05d232ec0aba5abec20e83cc52c1d5163cc3
-- 
2.37.1
C
C
Christopher Rodriguez wrote on 10 Aug 19:27 +0200
[PATCH v5 2/5] gnu: Add bqn-sources.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220810172800.13189-2-yewscion@gmail.com
* gnu/packages/bqn.scm: Add bqn-sources origin definition.
---
gnu/packages/bqn.scm | 13 +++++++++++++
1 file changed, 13 insertions(+)

Toggle diff (23 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index f00392a4f9..3c98102659 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -106,3 +106,16 @@ (define-public dbqn
 implementation of APL by the same author.")
     (home-page "https://github.com/dzaima/BQN")
     (license license:expat))))
+(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 "e219af48401473a7bac49bdd8b89d69082cf5dd8"))
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/mlochbaum/BQN")
+              (commit commit)))
+        (file-name (git-file-name "bqn-sources" commit))
+        (sha256
+         (base32 "0r6pa9lscl2395g4xlvmg90vpdsjzhin4f1r0s7brymmpvmns2yc")))))
-- 
2.37.1
C
C
Christopher Rodriguez wrote on 10 Aug 19:27 +0200
[PATCH v5 3/5] gnu: Add cbqn-bootstrap.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220810172800.13189-3-yewscion@gmail.com
* gnu/packages/bqn.scm: Add cbqn-bootstrap package.
---
gnu/packages/bqn.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (50 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index 3c98102659..61aa37fdf5 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -119,3 +119,43 @@ (define bqn-sources
         (file-name (git-file-name "bqn-sources" commit))
         (sha256
          (base32 "0r6pa9lscl2395g4xlvmg90vpdsjzhin4f1r0s7brymmpvmns2yc")))))
+(define cbqn-bootstrap
+  (let* ((revision "1")
+         (commit "9c1cbdc99863b1da0116df61cd832137b196dc5c"))
+    (package
+      (name "cbqn-bootstrap")
+      (version (git-version "0" "1" 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
+                  "0w38fhwf20drkyijy6nfnhmc5g5gw0zmzgmy1q605x57znlj85a2"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f ;Skipping Tests for Bootstrap.
+             #: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)
+                              (copy-recursively "BQN"
+                                                (string-append #$output
+                                                               "/bin/bqn")))))))
+      (native-inputs (list dbqn clang-toolchain bqn-sources))
+      (inputs (list icedtea-8 libffi))
+      (synopsis "BQN implementation in C")
+      (description "The standard implementation of the BQN language,
+according to the specification.")
+      (home-page "https://mlochbaum.github.io/BQN/")
+      (license license:gpl3))))
-- 
2.37.1
C
C
Christopher Rodriguez wrote on 10 Aug 19:27 +0200
[PATCH v5 4/5] gnu: Add singeli-sources.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220810172800.13189-4-yewscion@gmail.com
* gnu/packages/bqn.scm: Add singeli-sources origin definition.
---
gnu/packages/bqn.scm | 10 ++++++++++
1 file changed, 10 insertions(+)

Toggle diff (20 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index 61aa37fdf5..a87534fcd5 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -159,3 +159,13 @@ (define cbqn-bootstrap
 according to the specification.")
       (home-page "https://mlochbaum.github.io/BQN/")
       (license license:gpl3))))
+(define singeli-sources
+  (let* ((commit "fd17b144483549dbd2bcf23e3a37a09219171a99"))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/mlochbaum/Singeli")
+            (commit commit)))
+      (file-name (git-file-name "singeli-sources" commit))
+      (sha256
+         (base32 "1rr4l7ijzcg25n2igi1mzya6qllh5wsrf3m5i429rlgwv1fwvfji")))))
-- 
2.37.1
C
C
Christopher Rodriguez wrote on 10 Aug 19:28 +0200
[PATCH v5 5/5] gnu: Add cbqn.
(address . 56989@debbugs.gnu.org)(name . Christopher Rodriguez)(address . yewscion@gmail.com)
20220810172800.13189-5-yewscion@gmail.com
* gnu/packages/bqn.scm: Add cbqn package.
---
gnu/packages/bqn.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index a87534fcd5..95bc2f2eab 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -169,3 +169,49 @@ (define singeli-sources
       (file-name (git-file-name "singeli-sources" commit))
       (sha256
          (base32 "1rr4l7ijzcg25n2igi1mzya6qllh5wsrf3m5i429rlgwv1fwvfji")))))
+(define-public cbqn
+  (package
+    (inherit cbqn-bootstrap)
+    (name "cbqn")
+    (outputs '("out" "lib"))
+    (arguments
+     (list #:make-flags '(list "shared-o3" "o3n-singeli")
+           #:phases #~(modify-phases %standard-phases
+                        (delete 'configure)
+                        (add-before 'build 'link-singeli
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (symlink #+singeli-sources "Singeli")))
+                        (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)))))))
+    (native-inputs (list dbqn
+                         bqn-sources
+                         singeli-sources
+                         libffi
+                         clang-toolchain
+                         linux-libre-headers))))
-- 
2.37.1
L
L
Ludovic Courtès wrote on 31 Aug 23:10 +0200
Re: bug#56993: [PATCH v1 5/5] gnu: bqn: Add cbqn.
(name . Christopher Rodriguez)(address . yewscion@gmail.com)
87a67k9l0r.fsf_-_@gnu.org
Hi Christopher,

Christopher Rodriguez <yewscion@gmail.com> skribis:

Toggle quote (3 lines)
> * gnu/packages/bqn.scm: Create module.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Register module.

I applied the whole series with minor changes: adding newlines in
between definitions, tweaking descriptions, etc.

Thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 56989@debbugs.gnu.org