From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 15 09:06:19 2022 Received: (at 48463) by debbugs.gnu.org; 15 Jan 2022 14:06:19 +0000 Received: from localhost ([127.0.0.1]:39560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8jh5-0002IR-8X for submit@debbugs.gnu.org; Sat, 15 Jan 2022 09:06:19 -0500 Received: from m42-5.mailgun.net ([69.72.42.5]:28222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8jh1-0002I8-Oi for 48463@debbugs.gnu.org; Sat, 15 Jan 2022 09:06:10 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1642255567; h=Content-Type: MIME-Version: Message-Id: In-Reply-To: References: From: Subject: Cc: To: Date: Sender; bh=XAnNNB9yGko7znAV+H8/qRVsxUmf1EXcuNva3BkGBAM=; b=jdycPzGSmOiG8gjx5p4fEuWBO/8CB5ARcjH3u4+J1/AY2FWXIyTw7KmcXKRWuTeq4g6UySis E9oLVi0y4LT8im1UYbp2w/7e1vS/ZzjPvgUcPOTTi76kv0lG6FSbyJtBs6yQwNPxR/ges4N9 3NHVoFC7qM4gUWjEzx7NegM5XCeeFNpuKVFfDvMYQi0YBGo9J7fgUmY36RnZoOKMy1LKEEPR 7LpWw650PiUrsmRmJC00Rx1U9AqKk3HpzjbJc+aOj5k44+a+lD5+SdsIR4weNe+iiUOm5koI 7czsr1Z+gP7VD2V4oGAkDmxkHh3giE9c5L/FtvpEQ1NIy14Tvt2mmw== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyJjZGI4NCIsICI0ODQ2M0BkZWJidWdzLmdudS5vcmciLCAiMDg1NDdhIl0= Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 61e2d4ca69943108c558ec6d (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Sat, 15 Jan 2022 14:06:01 GMT Received: from localhost (aj097104.dynamic.ppp.asahi-net.or.jp [220.150.97.104]) by wilsonb.com (Postfix) with ESMTPSA id A5C0BA0AC0; Sat, 15 Jan 2022 14:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1642255556; bh=XAnNNB9yGko7znAV+H8/qRVsxUmf1EXcuNva3BkGBAM=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=8hqsFIAII2X1D1ZuVlxq48J86ZF9doSY3jQ+VEOq5oyb/vWxxsJqUIdpPxGlj4rjd fWWeZWJjZtXFy6hDjNDlQrcxuGfiC6Qk7Ed5Ba5T1uWViiqkXJaLstqGP7LgJAcP7/ yiDz6g/Qv7PQfTHuUMZ3wUVgoFLFFEPmvNyRr/JpDUYrHqykRU2i41K9eKTe9pTVeA hakRC3Ronl4gmk7HzsZ3litBFVC7rQ1wTkuH+5Ic7ft0Bqrp8DvfF0wU/uTWi1A1aW zylFQ2YjoM3vgRiri2YYZtEejS3XOQYQpkHiDnuAhZGY4rG0EFdAVtvOnL6rUfqiZv DapQpHgzOGmMmCvabKsIC19JuleySJnYSnml37dQ6jcgi2XwYMGbJgNXSQ76+aQdhV pm6pD3xp5A3LV5thXTDRk1eHiM1NRC7H4nNP6KdonyGwwFBxmSYzmo1RIv2bNgd4N/ lp2JPOCYJN3IZYX37e8ec6YG78EVRBHaufXpBrg48Sxx0vROiRSAnV5JfCpz62zdZP J5p3FhTlShytWA9z3a/SdCL17SGkMBC82F6Bc2FenrW/CYAYw2935vG56fJV7UYBEX Y68BCMEipenfVIjOmZ6KMsowFBlBz3AKpe5pM1RyeaIoZoHlOQmTlRyX+m1uuCkkAr Tlm7BlAEsRliLAd21VK3N9kw= Date: Sat, 15 Jan 2022 23:05:24 +0900 To: Liliana Marie Prikler Subject: Re: [bug#48463] gnu: Add j. From: elaexuotee@wilsonb.com References: <3LOAUDT0FLL4U.2SOD925YP915T@wilsonb.com> <8b853d0585505ce29c9afc638b644fa34805e6c0.camel@student.tugraz.at> <293L8YPQS4CLB.3VK1B1A36XNAY@wilsonb.com> <5d30160bd2a4592459cd407f99cbd3edadb1db1b.camel@student.tugraz.at> <27DCD25Y68ZWJ.2HRC4G65PWIA7@wilsonb.com> <94f4625dcb0479d873cf60449631527e841fd457.camel@gmail.com> <2JQJMV0O718S1.31FZE8GKCTLPF@wilsonb.com> <90704c2259f576a14fb1268219e8c0dc2b3bf289.camel@telenet.be> <2P322C327XW0Q.21O5A4IFGMNDI@wilsonb.com> <72aff035c93f9f91afa54ef5b51c7381b0b02ccb.camel@gmail.com> <3MMTDZQJQ8IR6.334ZWY8AD0487@wilsonb.com> <62d37956f16c08bc4ce26e44da16dce704ddd0f8.camel@gmail.com> In-Reply-To: <62d37956f16c08bc4ce26e44da16dce704ddd0f8.camel@gmail.com> Message-Id: <24ZUUMG4QYSHN.2OS7YAMCKREUA@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_33e6df1872b8c2946bb50f5f_=_" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 48463 Cc: Maxime Devos , 48463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multipart message in MIME format. ------_=_33e6df1872b8c2946bb50f5f_=_ Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks for staying on top of this patch review. Liliana Marie Prikler wrote: > Hi, >=20 > Note, that the current version still ignores commit. I've attached a > proof of concept patch, which fixes that, plus some other minor things, > but it now uses a pair for version. Also it's untested, so treat with > care. Oh! I see. You're wanting the version string to have optional REVISION and COMMIT parts, like `git-version'. That makes a lot of sense. There was a small issue with `jversion->string' in your patch, which produc= es MAJOR-REVISION-COMMIT if no MINOR value is provided. I want to make sure th= at users can always have specifications like "jsoftware-j@MAJOR" in their prof= ile manifest, but guix doesn't treat hyphen as a version separator. I just changed the logic to always keep a dot after MAJOR, and then use hyp= hens after that. > > Good idea. Upstream's build scripts condition a *lot* of behaviour on > > the j64avx environment variable, so it might not be straightforward, > > but I will put this on the to-do list of future improvements. > >=20 > > (Note, the code block quoted here got much simplified in the current > > patch.) > Reading /proc/cpuinfo is not nice. Please use (guix cpu), which also > provides you the flags that you need. Oh nice. A new, shiny module! This is exactly what I was looking for when originally writing the script. Updated. ------_=_33e6df1872b8c2946bb50f5f_=_ Content-Disposition: attachment; filename=0001-gnu-Add-j.patch Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable =46rom 13450733d99eafc3bc3fe84629224e653dd85753 Mon Sep 17 00:00:00 2001 =46rom: "B. Wilson" =44ate: Wed, 12 Jan 2022 18:44:36 +0900 =53ubject: [PATCH] gnu: Add j. =54o: guix-patches@gnu.org =0A* gnu/packages/jsoftware.scm: New file. =2A gnu/packages/patches/jsoftware-j901-f-fixes.patch: New file. =2A gnu/local.mk: Register it. =2D-- =20gnu/local.mk | 1 + =20gnu/packages/jsoftware.scm | 452 ++++++++++++++++++ =20.../patches/jsoftware-j901-f-fixes.patch | 80 ++++ =203 files changed, 533 insertions(+) =20create mode 100644 gnu/packages/jsoftware.scm =20create mode 100644 gnu/packages/patches/jsoftware-j901-f-fixes.patch =0Adiff --git a/gnu/local.mk b/gnu/local.mk =69ndex f72d2680af..b90295278a 100644 =2D-- a/gnu/local.mk =2B++ b/gnu/local.mk =40@ -1293,6 +1293,7 @@ dist_patch_DATA =3D \ =20 %D%/packages/patches/irrlicht-use-system-libs.patch \ =20 %D%/packages/patches/isc-dhcp-gcc-compat.patch \ =20 %D%/packages/patches/isl-0.11.1-aarch64-support.patch \ =2B %D%/packages/patches/jsoftware-j901-f-fixes.patch \ =20 %D%/packages/patches/json-c-0.13-CVE-2020-12762.patch \ =20 %D%/packages/patches/json-c-0.12-CVE-2020-12762.patch \ =20 %D%/packages/patches/jsoncpp-pkg-config-version.patch \ =64iff --git a/gnu/packages/jsoftware.scm b/gnu/packages/jsoftware.scm =6Eew file mode 100644 =69ndex 0000000000..6f5aeeb1cb =2D-- /dev/null =2B++ b/gnu/packages/jsoftware.scm =40@ -0,0 +1,452 @@ =2B;;; GNU Guix --- Functional package management for GNU =2B;;; Copyright =C2=A9 2022 B. Wilson =2B;;; =2B;;; This file is part of GNU Guix. =2B;;; =2B;;; GNU Guix is free software; you can redistribute it and/or modify it =2B;;; under the terms of the GNU General Public License as published by =2B;;; the Free Software Foundation; either version 3 of the License, or (a= =74 =2B;;; your option) any later version. =2B;;; =2B;;; GNU Guix is distributed in the hope that it will be useful, but =2B;;; WITHOUT ANY WARRANTY; without even the implied warranty of =2B;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the =2B;;; GNU General Public License for more details. =2B;;; =2B;;; You should have received a copy of the GNU General Public License =2B;;; along with GNU Guix. If not, see . =2B =2B(define-module (gnu packages jsoftware) =2B #:use-module (guix build utils) =2B #:use-module (guix build-system gnu) =2B #:use-module (guix build-system trivial) =2B #:use-module (guix git-download) =2B #:use-module ((guix licenses) #:prefix license:) =2B #:use-module (guix packages) =2B #:use-module (guix utils) =2B #:use-module (gnu packages) =2B #:use-module (gnu packages libedit) =2B #:use-module (gnu packages llvm) =2B #:use-module (gnu packages maths) =2B #:use-module (guix gexp) =2B #:use-module (ice-9 ftw) =2B #:use-module (ice-9 match) =2B #:use-module (ice-9 regex) =2B #:use-module (ice-9 rdelim) =2B #:use-module (srfi srfi-1) =2B #:use-module (srfi srfi-26) =2B #:use-module (srfi srfi-71)) =2B =2B =2B;;; TODO: Make importer and packages for J addons: =2B;;; http://www.jsoftware.com/jal/ =2B =2B;;; TODO: Package up j80x series =2B =2B =2B(define (jname prefix release-type) =2B "Return a package name for J, including RELEASE-TYPE only if not 'rele= =61se." =2B (match release-type =2B ('release prefix) =2B (_ (string-append prefix "-" (symbol->string release-type))))= =29 =2B =2B;; We want a version string where packages specifications like pkg@MAJOR= =20work. =2B;; This requires that the first version part separator be dot. Subseque= =6Et =2B;; separators are hyphen, mirror `git-version' etc. =2B(define* (jversion->string major #:optional minor revision commit) =2B "Return a version string formatted like MAJOR.MINOR-REVISION-COMMIT. = =4Fnly =2B MAJOR is required, but ensure that the first separator is dot and subs= =65quent =2B are hypen." =2B (let* ((commit (and commit (string-take commit 7))) =2B (sub-parts (filter (cut (compose not eq?) #f <>) =2B (list minor revision commit)))) =2B (match sub-parts =2B (() major) =2B (_ (string-append major "." (string-join sub-parts "-")))))) =2B =2B(define* (jrelease-string release-type #:optional version-minor) =2B "Construct J release identifier string." =2B (let ((release-type (symbol->string release-type))) =2B (if version-minor =2B (string-append release-type "-" version-minor) =2B release-type))) =2B =2B(define* (jinfo->git-tag version-major release-type #:optional version-m= =69nor) =2B "Given version parameters, construct a git tag for upstream releases."= =0A+ (string-append "j" version-major (jrelease-string release-type versio= =6E-minor))) =2B =2B(define (ijconsole) =2B "Generate a G-exp script that detects AVX/AVX2 support at runtime and =2B executes jconsole with the appropriate libj.so and profile.ijs." =2B (with-imported-modules '((guix cpu) =2B (guix memoization) =2B (guix profiling) =2B (guix sets) =2B (srfi srfi-26)) =2B (program-file "ijconsole" =2B #~(begin =2B (use-modules ((guix cpu) #:select (cpu-flags current-cpu))= =0A+ ((guix sets) #:select (set-contains?)) =2B ((srfi srfi-26) #:select (cute))) =2B =2B ;; Assume that this script will be installed under bin/. =2B (define %basedir (dirname (dirname (current-filename)))) =2B =2B (let* ((jconsole (string-append %basedir "/libexec/j/jconsole"= =29) =2B (cpu-has-flag? =2B (cute set-contains? (cpu-flags (current-cpu)) <>)) =2B (libj (format #f "~a/lib/j/libj~a.so" %basedir =2B (cond ((cpu-has-flag? "avx2") "-avx2") =2B ((cpu-has-flag? "avx") "-avx") =2B (else "")))) =2B (jprofile (string-append %basedir "/etc/j/profile.ijs")= =29) =2B (apply execl jconsole "ijconsole" "-lib" libj "-jprofile" jp= =72ofile =2B (cdr (command-line)))))))) =2B =2B(define* (make-j #:key =2B version =2B revision =2B hash =2B tag =2B commit =2B (release-type 'release) =2B (patches '()) =2B (extra-inputs '()) =2B (extra-envars '()) =2B (builder "guix.gnu.org")) =2B (let* ((version-major version-minor (if (pair? version) =2B (car+cdr version) =2B (values version #f)))) =2B (package =2B (name (jname "jsoftware-j" release-type)) =2B (version (jversion->string version-major version-minor revision commi= =74)) =2B (source =2B (origin =2B (method git-fetch) =2B (uri (git-reference =2B (url "https://github.com/jsoftware/jsource") =2B (commit (or commit tag =2B (jinfo->git-tag version-major =2B release-type =2B version-minor))))) =2B (sha256 (base32 hash)) =2B (file-name (git-file-name name version)) =2B (patches patches))) =2B (build-system gnu-build-system) =2B (native-inputs `(("clang-toolchain" ,clang-toolchain))) =2B (inputs (cons* `("libedit" ,libedit) =2B `("libomp" ,libomp) =2B `("ijconsole" ,(ijconsole)) =2B extra-inputs)) =2B (arguments =2B `(#:modules (((ice-9 ftw) #:select (scandir)) =2B ((ice-9 popen) #:select (open-pipe* close-pipe)) =2B ((ice-9 regex) #:select (match:substring string-match))= =0A+ ((ice-9 threads) #:select (parallel par-for-each)) =2B ((srfi srfi-26) #:select (cut)) =2B ((srfi srfi-1) #:select (fold)) =2B ,@%gnu-build-system-modules) =2B #:phases =2B ;; Upstream's build system consists of ad-hoc scripts that build b= =75ild up =2B ;; (very complicated) environment variables to pass to make. The = =62asic =2B ;; build process looks like this: =2B ;; =2B ;; 1) Copy jsrc/jversion-x.h to jsrc/jversion.h and edit values;= =0A+ ;; 2) Set jplatform and j64x environment variables; =2B ;; 3) Run make2/build_jconsole.sh and make2/build_libj.sh; =2B ;; =2B ;; However, upstream expects users to run J directly from the sour= =63e =2B ;; directory; they do not supply a make `install' target. Thus it= =20takes =2B ;; some massaging to install files in FHS-style directories. =2B (modify-phases %standard-phases =2B ;; In particular, we have to set up =2B ;; =2B ;; 1) jsrc/jversion.h as in a typical build; =2B ;; 2) jlibrary/bin/profilex.ijs to point to writable directori= =65s; =2B ;; 3) make2/build_*.sh to respect standard build conventions; =2B ;; 4) jsrc/jconsole.c to fix libedit dlopen; and =2B ;; 5) Hard coded references to addons directory. =2B (replace 'configure =2B (lambda* (#:key target inputs outputs #:allow-other-keys) =2B (let* ((clang-toolchain (assoc-ref inputs "clang-toolchain")= =29 =2B (clang (string-append clang-toolchain "/bin/clang")) =2B (libedit (assoc-ref inputs "libedit")) =2B (out (assoc-ref outputs "out"))) =2B ;; Set up build constants =2B (copy-file "jsrc/jversion-x.h" "jsrc/jversion.h") =2B (substitute* "jsrc/jversion.h" =2B (("^#define jversion.*$") =2B (format #f "#define jversion ~s\n" ,version-major)) =2B (("^#define jtype.*$") =2B (format #f "#define jtype ~s\n" =2B ,(jrelease-string release-type version-minor)))= =0A+ (("^#define jbuilder.*$") =2B (format #f "#define jbuilder ~s\n" ,builder))) =2B ;; Create profilex.ijs overrides to point to the correct s= =74ore =2B ;; items. Note that we set ~install and ~addons directori= =65s to =2B ;; reside under ~user to allow installing and loading addo= =6Es. =2B ;; TODO: Guix-ify J addons as well. =2B (call-with-output-file "jlibrary/bin/profilex.ijs" =2B (lambda (port) =2B (display =2B (string-join =2B (list =2B "share=3D. '/share/j',~ ({.~ _2 { I.@:=3D&'/') B= =49NPATH" =2B "system=3D. share,'/system'" =2B "tools=3D. share,'/tools'" =2B ;; Upstream defaults to spamming $HOME with unhi= =64den =2B ;; userdata directories. Set this to be =2B ;; $HOME/.config/j/ instead =2B "'jtype jversion'=3D. (3&{,{.) <;._2 ,&'/' 9!:14= =27'" =2B "jversion=3D. ({.~ i.&'-') jversion" =2B "user=3D. home,'/.config/j/',jversion" =2B "addons=3D. user,'/addons'" =2B "break=3D. user,'/break'" =2B "config=3D. user,'/config'" =2B "install=3D. user,'/install'" =2B "snap=3D. user,'/snap'" =2B "temp=3D. user,'/temp'" =2B "\n") =2B "\n") =2B port))) =2B ;; Munge the build scripts into reason: =2B ;; 1. Short-circuit the fragile compiler detection; =2B ;; 2. Make sure to include our CFLAGS and LFLAGS; and =2B ;; 3. Propagate script errors to top level. =2B (for-each =2B (lambda (file) =2B (with-directory-excursion "make2" =2B (substitute* file =2B ;; The `compiler' variable doesn't point to the act= =75al =2B ;; compiler. It is just a switch to tell the build= =0A+ ;; scripts whether to use gcc- or clang-specific f= =6Cags. =2B (("^compiler=3D.*$") "compiler=3Dclang\n") =2B (("^LDFLAGS=3D\"" def) (string-append def "$LDFLAGS= =20")) =2B (("^(common=3D\")(\\$USETHREAD.*)$" _ def rest) =2B (string-append def "$CFLAGS " rest)) =2B (("^#!.*" shebang) =2B (string-append shebang "set -o errexit\n"))))) =2B '("build_jconsole.sh" "build_libj.sh")) =2B ;; The jconsole manually loads libedit with dlopen. The p= =61th =2B ;; must be absolute to correctly point to our input. =2B (substitute* "jsrc/jconsole.c" =2B (("libedit\\.so\\.[0-9]" so-file) =2B (format #f "~a/lib/~a" libedit so-file))) =2B ;; The ~addons/dev directory supplies tentative J-script =2B ;; definitions of new J engine functionality. Since we po= =69nt =2B ;; ~addons under the ~user directory, we move it under ~sy= =73tem =2B ;; instead, which sits as-is in the output. =2B (with-directory-excursion "jsrc" =2B (for-each =2B (lambda (file) =2B (substitute* file (("~addons/dev") "~system/dev"))) =2B (scandir "." =2B (lambda (f) (eq? (stat:type (stat f)) 'regular))))) =2B ;; Implementation of 9!:14 records build time which breaks= =20build =2B ;; reproducibility. Note that upstream code depends on th= =65 exact =2B ;; format of these strings, so we need to mimic the standa= =72d. =2B (substitute* "jsrc/j.c" =2B (("__DATE__") "\"Jan 01 1970\"") =2B (("__TIME__") "\"00:00:00\"")) =2B ;; Upstream recommends using clang, with GCC support being= =0A+ ;; second-class, often resulting in build failures. =2B (setenv "CC" clang)))) =2B =2B ;; The build output depends primarily on the values of the `jpla= =74form' =2B ;; and `j64x' environment variables. If the target is ARM, then= =0A+ ;; `jplatform' is "raspberry", otherwise it is `linux'. In add= =69tion to =2B ;; 32- and 64- bit versions, `j64x' controlls whether AVX or AVX= =32 =2B ;; variants of libj are built. =2B ;; =2B ;; However, build targets are not fine-grained enough to disting= =75ish =2B ;; between CPU features. Thus we build and install all variants= =20of =2B ;; libj, expecting jconsole to be called with a wrapper script t= =68at =2B ;; detects AVX features and loads the appropriate libj at runtim= =65. =2B (replace 'build =2B (lambda _ =2B (setenv "USE_OPENMP" "1") =2B (setenv "USE_THREAD" "1") =2B (for-each (lambda (var-val) (apply setenv var-val)) =2B (quote ,extra-envars)) =2B ;; The build scripts assume that PWD is make2. =2B (with-directory-excursion "make2" =2B (let* ((platform ,(if (target-arm?) "raspberry" "linux")) =2B (target-bit ,(if (target-64bit?) "64" "32")) =2B (run (lambda* (script #:key (avx "")) =2B (invoke "env" =2B (string-append "jplatform=3D" platfo= =72m) =2B (string-append "j64x=3Dj" target-bit= =20avx) =2B script)))) =2B (parallel =2B ;; Since jconsole doesn't depend on AVX features, we j= =75st =2B ;; build it once. =2B (run "./build_jconsole.sh") =2B (run "./build_libj.sh") =2B (if ,(target-64bit?) =2B (parallel =2B (run "./build_libj.sh" #:avx "avx") =2B (run "./build_libj.sh" #:avx "avx2")))))))) =2B ;; The test suite is expected to be run as follows for each vari= =61nt of =2B ;; libj that we build: =2B ;; =2B ;; $ echo 'RUN ddall' | jconsole test/tsu.ijs =2B ;; =2B ;; This requires a working jconsole with accessible jlibrary fil= =65s. We =2B ;; simply place these all under test/bin. =2B (replace 'check =2B (lambda* (#:key tests? #:allow-other-keys) =2B (when tests? =2B (let ((platform ,(if (target-arm?) "raspberry" "linux"))) =2B (mkdir-p "test/bin") =2B (for-each =2B (lambda (dir) =2B (let ((source (string-append "jlibrary/" dir)) =2B (dest (string-append "test/bin/" dir))) =2B (begin =2B (mkdir-p dest) =2B (copy-recursively source dest)))) =2B '("system" "tools" "addons")) =2B ;; The jlibrary/dev directory only sometimes exists, but= =20needs =2B ;; to be copied into the ~system directory when it does.= =0A+ (for-each =2B (lambda (dev-dir) =2B (if (file-exists? dev-dir) =2B (copy-recursively dev-dir "test/bin/system/dev")))= =0A+ '("jlibrary/dev" "jlibrary/addons/dev")) =2B (par-for-each =2B (lambda (dir) =2B (let* ((bin (string-append "bin/" platform)) =2B (jbit ,(if (target-64bit?) "j64" "j32")) =2B (jconsole (string-append bin "/" jbit =2B "/jconsole")) =2B (source (string-append bin "/" dir)) =2B (dest (string-append "test/bin/" dir))) =2B (begin =2B (mkdir-p dest) =2B (copy-recursively source dest) =2B (install-file "jlibrary/bin/profile.ijs" dest) =2B (install-file jconsole dest) =2B (let* ((jconsole (string-append dest "/jconsole"= =29) =2B (tests "test/tsu.ijs") =2B (port (open-pipe* OPEN_WRITE jconsole tes= =74s))) =2B (display "RUN ddall\n" port) =2B (when (not (zero? (status:exit-val =2B (close-pipe port)))) =2B (error "Some J build tests failed.")))))) =2B (scandir (string-append "bin/" platform) =2B (negate (cut member <> '("." ".."))))) =2B #t)))) =2B ;; Now that everything is built, installation is fairly =2B ;; straightforward, following FHS conventions. The only quirk i= =73 that =2B ;; we install jconsole under /libexec to make room for the wrapp= =65r =2B ;; replacement under /bin. =2B (replace 'install =2B (lambda* (#:key outputs inputs #:allow-other-keys) =2B (let* ((platform ,(if (target-arm?) "raspberry" "linux")) =2B (jbit ,(if (target-64bit?) "j64" "j32")) =2B (ijconsole (assoc-ref inputs "ijconsole")) =2B (jconsole (string-append "bin/" platform "/" =2B jbit "/jconsole")) =2B (out (assoc-ref outputs "out")) =2B (bin (string-append out "/bin")) =2B (etc (string-append out "/etc/j")) =2B (lib (string-append out "/lib/j")) =2B (libexec (string-append out "/libexec/j")) =2B (share (string-append out "/share/j")) =2B (system (string-append share "/system")) =2B (dev (string-append system "/dev"))) =2B (mkdir-p bin) =2B (copy-file ijconsole (string-append bin "/ijconsole-" =2B ,version-major)) =2B (mkdir-p lib) =2B (for-each =2B (lambda (jarch) =2B (let* ((jbin (string-join `("bin" ,platform ,jarch) "/= =22)) =2B (javx-match (string-match "avx.*" jarch)) =2B (javx (if (not javx-match) "" =2B (match:substring javx-match))) =2B (sep (if javx-match "-" "")) =2B (source (string-append jbin "/libj.so")) =2B (dest (format #f "~a/libj~a~a.so" lib sep javx)= =29) =2B (copy-file source dest))) =2B (scandir (string-append "bin/" platform) =2B (negate (cut member <> '("." ".."))))) =2B (install-file jconsole libexec) =2B (copy-recursively "jlibrary/system" system) =2B (for-each =2B (lambda (source-dev) =2B (if (access? source-dev R_OK) =2B (copy-recursively source-dev dev))) =2B '("jlibrary/dev" "jlibrary/addons/dev")) =2B (install-file "jlibrary/bin/profile.ijs" etc) =2B (install-file "jlibrary/bin/profilex.ijs" etc))))))) =2B (home-page "https://www.jsoftware.com/") =2B (synopsis "Ascii-only, array programming language in the APL family")= =0A+ (description =2B "J is a high-level, general-purpose programming language that is =2Bparticularly suited to the mathematical, statistical, and logical analys= =69s of =2Bdata. It is a powerful tool for developing algorithms and exploring pro= =62lems =2Bthat are not already well understood.") =2B (license license:gpl3+)))) =2B =2B =2B(define-public jsoftware-j-901 =2B (make-j =2B #:version '("901" . "f") =2B #:hash "1776021m0j1aanzwg60by83n53pw7i6afd5wplfzczwk8bywax4p" =2B #:patches (search-patches "jsoftware-j901-f-fixes.patch"))) =2B =2B =2B(define j-build-configuration-with-sleef =2B `(#:extra-inputs (("sleef" ,sleef)) =2B #:extra-envars (("USE_SLEEF_SRC" "0") =2B ("LDFLAGS" "-lsleef")))) =2B =2B(define-public jsoftware-j-902 =2B (apply make-j =2B (append j-build-configuration-with-sleef =2B `(#:version ,'("902" . "b") =2B #:hash "0j67vgikqflwjqacsdicasvyv1k54s2c8vjgwmf0ix7l41p4xqz0")))= =29 =2B =2B =2B(define-public jsoftware-j-903 =2B (apply make-j =2B (append j-build-configuration-with-sleef =2B `(#:version ,'("903" . "a") =2B #:tag "903-release-a" =2B #:hash "1fcfl7q7c2vj4fmnqqc8c6hwgsjm20ff93v8xxfniasss1b2fmc4")))= =29 =2B =2B =2B(define-public (jsoftware-ijconsole-symlink jpkg) =2B "Provide bin/ijconsole symlink that points to pkg's bin/ijconsole-" =2B (package =2B (name "jsoftware-ijconsole") =2B (version (package-version jpkg)) =2B (source #f) =2B (build-system trivial-build-system) =2B (propagated-inputs `(("jpkg" ,jpkg))) =2B (arguments =2B `(#:modules ((guix build utils) =2B (srfi srfi-26)) =2B #:builder =2B (begin =2B (use-modules ((guix build utils) #:select (mkdir-p)) =2B ((ice-9 regex) #:select (string-match)) =2B ((ice-9 ftw) #:select (scandir)) =2B ((srfi srfi-26) #:select (cut))) =2B (let* ((out (assoc-ref %outputs "out")) =2B (jpkg (assoc-ref %build-inputs "jpkg")) =2B (ijconsole (car (scandir (string-append jpkg "/bin") =2B (cut string-match "ijconsole-.*" = =3C>)))) =2B (source (string-append jpkg "/bin/" ijconsole)) =2B (dest (string-append out "/bin/ijconsole"))) =2B (mkdir-p (dirname dest)) =2B (symlink source dest))))) =2B (home-page (package-home-page jpkg)) =2B (synopsis "Provide `ijconsole' symlink to default interpreter version"= =29 =2B (description =2B "The interpreter provided by the J package has a filename like =2Bijconsole-, which provides support for having multiple, concurr= =65nt =2Bversions installed. This package provides a version-agnostic `ijconsole= =27 =2Bsymlink to interpreter version indicated and build time.") =2B (license license:gpl3+))) =64iff --git a/gnu/packages/patches/jsoftware-j901-f-fixes.patch b/gnu/pack= =61ges/patches/jsoftware-j901-f-fixes.patch =6Eew file mode 100644 =69ndex 0000000000..0ac7e94de4 =2D-- /dev/null =2B++ b/gnu/packages/patches/jsoftware-j901-f-fixes.patch =40@ -0,0 +1,80 @@ =2BThis patch fixes two separate issues with ustream sources: =2B =2B* Normalize import paths in jsrc/cip.c =2B =2BUpstream claims to have some build requirements that force them to use s= =74range =2Bimport paths. However, these paths do not exist inside our build chroot.= =0A+ =2B* Fix unititialized variable warning =2B =2BClang 9 issues some warnings which cause the build to fail since upstrea= =6D =2Bcompiles with -Werror. =2B =2B =2Bdiff --git a/jsrc/cip.c b/jsrc/cip.c =2Bindex 61da4088..fb3c03b6 100644 =2B--- a/jsrc/cip.c =2B+++ b/jsrc/cip.c =2B@@ -3,9 +3,9 @@ =2B /* = =20 */ =2B /* Conjunctions: Inner Product = =20 */ =2B=20 =2B-#include "../../jsource/jsrc/j.h" =2B-#include "../../jsource/jsrc/vasm.h" =2B-#include "../../jsource/jsrc/gemm.h" =2B+#include "j.h" =2B+#include "vasm.h" =2B+#include "gemm.h" =2B=20 =2B #define MAXAROWS 384 // max rows of a that we can process to stay in L= =32 cache a strip is m*CACHEHEIGHT, z strip is m*CACHEWIDTH this is wir= =65d to 128*3 - check if you chage =2B=20 =2B@@ -1057,15 +1057,15 @@ static A jtipbx(J jt,A a,A w,C c,C d){A g=3D0,x0= =2Cx1,z;B*av,*av0,b,*v0,*v1,*zv;C c0 =2B switch(c){ =2B case CPLUSDOT: =2B #define F |=3D =2B-#include "../../jsource/jsrc/cip_t.h" =2B+#include "cip_t.h" =2B break; =2B case CSTARDOT: =2B #define F &=3D =2B-#include "../../jsource/jsrc/cip_t.h" =2B+#include "cip_t.h" =2B break; =2B case CNE: =2B #define F ^=3D =2B-#include "../../jsource/jsrc/cip_t.h" =2B+#include "cip_t.h" =2B break; =2B } =2B R z; =2Bdiff --git a/jsrc/gemm.c b/jsrc/gemm.c =2Bindex 51fe306e..b105dfc1 100644 =2B--- a/jsrc/gemm.c =2B+++ b/jsrc/gemm.c =2B@@ -318,7 +318,7 @@ dgemm_nn (I m, =2B _B); =2B=20 =2B // loop 3 =2B- I i; =2B+ I i=3D0; =2B #pragma omp parallel for default(none),private(i),shared(j,l,A,C,mb,nc,= =6Bc,alpha,_beta,_mc,_B,rs_a,cs_a,rs_c,cs_c) =2B for (i=3D0; i