[PATCH] gnu: add j version 902.

OpenSubmitted by Joseph Novakovich.
Details
5 participants
  • Joseph Novakovich
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
  • Philip Kaludercic
Owner
unassigned
Severity
normal
Merged with
J
J
Joseph Novakovich wrote on 28 Aug 2020 02:05
(address . guix-patches@gnu.org)
CAHwqnzFgDBp6PcU0Qi2NB5P+=Xcu3oqRZdbDtsooZD2B588BMQ@mail.gmail.com
Hello!

I added the file gnu/packages/j.scm for a package definition for the J
programming language. I have also written expressions for jqt and the
majority of the J addons, but I thought it made sense to start with
only the base language and repl.

Hopefully nothing is too horribly off about this patch!

Joseph
From 798d0e3c2b635cfe3a936937fd3dd3ea1b8c5812 Mon Sep 17 00:00:00 2001
From: Joseph Novakovich <josephnovakovich@gmail.com>
Date: Thu, 27 Aug 2020 19:16:16 -0400
Subject: [PATCH] gnu: add j version 902.

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

Toggle diff (188 lines)
diff --git a/gnu/packages/j.scm b/gnu/packages/j.scm
new file mode 100644
index 0000000000..f017c14f03
--- /dev/null
+++ b/gnu/packages/j.scm
@@ -0,0 +1,180 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Joseph Novakovich <josephnovakovich@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 j)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system gnu)
+  #:use-module ((guix licenses) :select (gpl3))
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages algebra)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages libedit)
+  #:use-module (gnu packages pcre)
+  #:use-module (gnu packages readline))
+
+(define-public j
+  (package
+    (name "j")
+    (version "902")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/jsoftware/jsource")
+         (commit "59324abbc6c9c3709d39096f5a41e0a4ef28e9f6")))
+       (sha256
+        (base32 "031mncgbnn89s9k34aml7jn9pr3cfmvfm06v8785br483jmdmn20"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("bash" ,bash)
+       ("readline" ,readline)
+       ("bc" ,bc)
+       ("libedit" ,libedit)
+       ("pcre2" ,pcre2)
+       ("zlib" ,zlib)))
+    (outputs '("out"))
+    (arguments
+     `(#:modules
+       ((guix build gnu-build-system)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((jplatform "linux")
+                    (out (assoc-ref %outputs "out")))
+               (with-output-to-file "jsrc/jversion.h"
+                 (lambda ()
+                   (display "#define jversion  ") (write ,version)  (newline)
+                   (display "#define jplatform ") (write jplatform) (newline)
+                   (display "#define jtype     ") (write "beta")    (newline)
+                   (display "#define jlicense  ") (write "GPL3")    (newline)
+                   (display "#define jbuilder  ") (write "guix.gnu.org")
+                   (newline)))
+               (substitute* `("jlibrary/system/main/regex.ijs")
+                 (("pcre2dll=: f")
+                  (string-append "pcre2dll=: '"
+                                 (assoc-ref %build-inputs "pcre2")
+                                 "/lib/libpcre2-8.so.0'")))
+               (substitute* `("jlibrary/system/util/tar.ijs")
+                 (("libz=: .+$")
+                  (string-append "zlib=: '"
+                                 (assoc-ref %build-inputs "zlib")
+                                 "/lib/libz.so'\n")))
+               #t)))
+         (replace 'build
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((jplatform "linux")
+                   (j64x "j64avx2"))
+               (chdir "make2")
+               (system
+                (format #f
+                        "jplatform=~a j64x=~a USE_SLEEF=1 ./build_jconsole.sh"
+                        jplatform j64x))
+               (system
+                (format #f
+                        "jplatform=~a j64x=~a USE_SLEEF=1 ./build_tsdll.sh"
+                        jplatform j64x))
+               (system
+                (format #f
+                        "jplatform=~a j64x=~a USE_SLEEF=1 ./build_libj.sh"
+                        jplatform
+                        j64x))
+               (chdir "..")
+               #t)))
+         (replace 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((jplatform "linux")
+                    (j64x "j64avx2")
+                    (tsu (string-append (getcwd) "/test/tsu.ijs"))
+                    (jbld (string-append "bin/" jplatform "/" j64x)))
+               ; following instructions from make2/make.txt
+               (copy-recursively jbld "jlibrary/bin")
+               (chdir "jlibrary/bin")
+               (system "echo \"RUN ddall\" | ./jconsole ../../test/tsu.ijs")
+               (chdir "../..")
+               #t)))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((bin-out (string-append (assoc-ref %outputs "out") "/bin"))
+                    (share-out (string-append (assoc-ref %outputs "out")
+                                              "/share/j"))
+                    (jconsole "jlibrary/bin/jconsole")
+                    (libj.so  "jlibrary/bin/libj.so"))
+               (install-file jconsole bin-out)
+               (install-file libj.so bin-out)
+               (copy-recursively "jlibrary/addons"
+                                 (string-append share-out "/addons"))
+               (copy-recursively "jlibrary/system"
+                                 (string-append share-out "/system"))
+               ; custom profile.ijs to work with guix
+               (with-output-to-file (string-append bin-out "/profile.ijs")
+                 (lambda ()
+                   (display
+                    "NB. J profile
+NB. JFE sets BINPATH_z_ and ARGV_z_
+
+jpathsep_z_=: '/'&(('\\' I.@:= ])})
+home=. 2!:5'HOME'
+BINPATH_z_=: home,'/.guix-profile/bin/jconsole'
+
+bin=. BINPATH
+install=. home,'/.guix-profile/share/j'
+addons=. install,'/addons'
+system=. install,'/system'
+tools=. install,'/tools'
+isroot=. 0
+userx=. '/j902-user'
+user=. home,userx
+break=. user,'/break'
+config=. user,'/config'
+snap=. user,'/snap'
+temp=. user,'/temp'
+ids=. ;:'addons bin break config home install snap system tools temp user'
+
+SystemFolders_j_=: ids,.jpathsep@\".&.>ids
+
+NB. used to create mutable j user directories for temp
+NB. files/configuring jqt/projects and so on
+md=. 3 : 0 NB. recursive makedir
+a=. jpathsep y,'/'
+if. -.#1!:0 }:a do.
+  for_n. I. a='/' do. 1!:5 :: [ <n{.a end.
+end.
+)
+
+NB. try to ensure user folders exist
+md user,'/projects'
+md break
+md config
+md snap
+md temp
+
+NB. boot up J and load startup.ijs if it exists
+0!:0 <jpathsep (4!:55 (;:'isroot userx ids md'), ids)]system,'/util/boot.ijs'
+")))
+               #t))))))
+    (synopsis "APL Dialect")
+    (description "J is a programming language that works with arrays,
+verbs, adverbs, and conjunctions.  For example, +/x sums array x and
+/:~x sorts it.")
+    (home-page "https://code.jsoftware.com/wiki/Main_Page")
+    (license gpl3)))
+
-- 
2.28.0
J
J
Joseph Novakovich wrote on 1 Sep 2020 15:19
(address . 43080@debbugs.gnu.org)
CAHwqnzFApZu4bBm4EsRv5rNfQuak=do0vSsCULeZPN61EdTwHQ@mail.gmail.com
On irc, lfam recommended noting that J is implemented in C, so there
are no bootstrapping issues. Also, I was also wondering about better
ways to do libraries/addons. As written, this lets J find them by
pointing to '~/.guix-profile/share/j/addons' but nckx (irc) mentioned
native-search-paths and an environment variable. By default, J doesn't
use one, but that could be changed by modifying the 'profile.ijs'
that's output here.

Joseph
L
L
Ludovic Courtès wrote on 12 Oct 2020 19:37
(name . Joseph Novakovich)(address . josephnovakovich@gmail.com)(address . 43080@debbugs.gnu.org)
87eem3ny64.fsf@gnu.org
Hi Joseph,

Joseph Novakovich <josephnovakovich@gmail.com> skribis:

Toggle quote (8 lines)
> From 798d0e3c2b635cfe3a936937fd3dd3ea1b8c5812 Mon Sep 17 00:00:00 2001
> From: Joseph Novakovich <josephnovakovich@gmail.com>
> Date: Thu, 27 Aug 2020 19:16:16 -0400
> Subject: [PATCH] gnu: add j version 902.
>
> ---
> gnu/packages/j.scm | 180 +++++++++++++++++++++++++++++++++++++++++++++

Sorry for the loooong delay!

A few comments—if needed we can make those changes on your behalf, let
us know.

Could you add j.scm to ‘gnu/local.mk’?

Toggle quote (10 lines)
> + (name "j")
> + (version "902")
> + (source
> + (origin
> + (method git-fetch)
> + (uri
> + (git-reference
> + (url "https://github.com/jsoftware/jsource")
> + (commit "59324abbc6c9c3709d39096f5a41e0a4ef28e9f6")))

Why this commit? If there’s a tag, it would be clearer to refer to the
tag (the ‘commit’ field can name a tag).

Toggle quote (2 lines)
> + (outputs '("out"))

Unnecessary, you can remove it.

Toggle quote (4 lines)
> + `(#:modules
> + ((guix build gnu-build-system)
> + (guix build utils))

Likewise.

Toggle quote (9 lines)
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let ((jplatform "linux")
> + (j64x "j64avx2"))
> + (chdir "make2")
> + (system
> + (format #f
> + "jplatform=~a j64x=~a USE_SLEEF=1 ./build_jconsole.sh"
> + jplatform j64x))

Note that we cannot assume AVX2 support (on x86_64, but especially on
non-Intel platforms). Can you check this doesn’t create binaries that
require AVX2?

Also, it would be more robust to replace ‘system’ by something like:

(Seton "jplatform" "linux")
(setenv "USE_SLEEF" "1")
(invoke "./build_jconsole.sh")

since ‘invoke’ checks the exit code of the given command.

Toggle quote (7 lines)
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((bin-out (string-append (assoc-ref %outputs "out") "/bin"))
> + (share-out (string-append (assoc-ref %outputs "out")
> + "/share/j"))
> + (jconsole "jlibrary/bin/jconsole")
> + (libj.so "jlibrary/bin/libj.so"))

I’d omit ‘-out’ from variable names.

Toggle quote (2 lines)
> + (synopsis "APL Dialect")

What about “Dialect of the APL programming language” for clarity?

Toggle quote (4 lines)
> + (description "J is a programming language that works with arrays,
> +verbs, adverbs, and conjunctions. For example, +/x sums array x and
> +/:~x sorts it.")

Please use @code markup for code snippets. Bonus points if you can
expound a bit!


Toggle quote (2 lines)
> + (license gpl3)))

I confirm that this is “version 3 only” per ‘license.txt’.

Could you send an updated patch?

Thanks,
Ludo’.
T
T
Tobias Geerinckx-Rice wrote on 12 Oct 2020 20:13
Re: [bug#43080]
(name . Joseph Novakovich)(address . josephnovakovich@gmail.com)
87362jia76.fsf@nckx
Joseph,

Thank you for submitting this!

If I don't point this out then someone else will, so...

Joseph Novakovich 写道:
Toggle quote (4 lines)
> +(define-public j
> + (package
> + (name "j")

...single-letter package names are frowned upon, with ‘r’ being a
grandfathered exception.

I suggest calling this ‘j-language’ (or ‘j-toolchain’, if that
word makes sense in J's worldview) instead.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCX4Sc3Q0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15NjsA/0rs6JfXecV0q/GDOTcUfDntAQMAmUc7AtTgpwkH
HT2PAQC2WjEvjKTlwUkOWYegmHaLJLiDzzTKXwDgjksYfgkQBg==
=frkp
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 18 Dec 2020 14:07
Re: [bug#43080] [PATCH] gnu: add j version 902.
(name . Joseph Novakovich)(address . josephnovakovich@gmail.com)(address . 43080@debbugs.gnu.org)
87im8zdzzj.fsf@gnu.org
Hi Joseph,

Did you have a chance to look into it?

Thanks,
Ludo’.

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (94 lines)
> Hi Joseph,
>
> Joseph Novakovich <josephnovakovich@gmail.com> skribis:
>
>> From 798d0e3c2b635cfe3a936937fd3dd3ea1b8c5812 Mon Sep 17 00:00:00 2001
>> From: Joseph Novakovich <josephnovakovich@gmail.com>
>> Date: Thu, 27 Aug 2020 19:16:16 -0400
>> Subject: [PATCH] gnu: add j version 902.
>>
>> ---
>> gnu/packages/j.scm | 180 +++++++++++++++++++++++++++++++++++++++++++++
>
> Sorry for the loooong delay!
>
> A few comments—if needed we can make those changes on your behalf, let
> us know.
>
> Could you add j.scm to ‘gnu/local.mk’?
>
>> + (name "j")
>> + (version "902")
>> + (source
>> + (origin
>> + (method git-fetch)
>> + (uri
>> + (git-reference
>> + (url "https://github.com/jsoftware/jsource")
>> + (commit "59324abbc6c9c3709d39096f5a41e0a4ef28e9f6")))
>
> Why this commit? If there’s a tag, it would be clearer to refer to the
> tag (the ‘commit’ field can name a tag).
>
>> + (outputs '("out"))
>
> Unnecessary, you can remove it.
>
>> + `(#:modules
>> + ((guix build gnu-build-system)
>> + (guix build utils))
>
> Likewise.
>
>> + (lambda* (#:key inputs outputs #:allow-other-keys)
>> + (let ((jplatform "linux")
>> + (j64x "j64avx2"))
>> + (chdir "make2")
>> + (system
>> + (format #f
>> + "jplatform=~a j64x=~a USE_SLEEF=1 ./build_jconsole.sh"
>> + jplatform j64x))
>
> Note that we cannot assume AVX2 support (on x86_64, but especially on
> non-Intel platforms). Can you check this doesn’t create binaries that
> require AVX2?
>
> Also, it would be more robust to replace ‘system’ by something like:
>
> (Seton "jplatform" "linux")
> (setenv "USE_SLEEF" "1")
> …
> (invoke "./build_jconsole.sh")
>
> since ‘invoke’ checks the exit code of the given command.
>
>> + (lambda* (#:key inputs outputs #:allow-other-keys)
>> + (let* ((bin-out (string-append (assoc-ref %outputs "out") "/bin"))
>> + (share-out (string-append (assoc-ref %outputs "out")
>> + "/share/j"))
>> + (jconsole "jlibrary/bin/jconsole")
>> + (libj.so "jlibrary/bin/libj.so"))
>
> I’d omit ‘-out’ from variable names.
>
>> + (synopsis "APL Dialect")
>
> What about “Dialect of the APL programming language” for clarity?
>
>> + (description "J is a programming language that works with arrays,
>> +verbs, adverbs, and conjunctions. For example, +/x sums array x and
>> +/:~x sorts it.")
>
> Please use @code markup for code snippets. Bonus points if you can
> expound a bit!
>
> https://guix.gnu.org/manual/en/html_node/Synopses-and-Descriptions.html
>
>> + (license gpl3)))
>
> I confirm that this is “version 3 only” per ‘license.txt’.
>
> Could you send an updated patch?
>
> Thanks,
> Ludo’.
P
P
Philip Kaludercic wrote on 1 Oct 2021 12:27
[PATCH] gnu: add j version 902.
(address . 43080@debbugs.gnu.org)
87fstl11md.fsf@posteo.net
Has there been any further progress on including J?

--
Philip K.
L
L
Liliana Marie Prikler wrote on 1 Oct 2021 17:06
(address . control@debbugs.gnu.org)(name . Philip Kaludercic)(address . philipk@posteo.net)
237300610e48e3e7cc4c256e835b43a800b197f1.camel@gmail.com
merge 48463 43080
thanks

Toggle quote (1 lines)
> Has there been any further progress on including J?
Yes, but that further progress got stalled as well, sadly. Trying to
resume...
?