From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 12 07:07:34 2022 Received: (at 48463) by debbugs.gnu.org; 12 Jan 2022 12:07:34 +0000 Received: from localhost ([127.0.0.1]:56389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7cPW-0001hZ-HF for submit@debbugs.gnu.org; Wed, 12 Jan 2022 07:07:34 -0500 Received: from m42-5.mailgun.net ([69.72.42.5]:52555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7cPT-0001hA-N1 for 48463@debbugs.gnu.org; Wed, 12 Jan 2022 07:07:25 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1641989243; h=Content-Type: MIME-Version: Message-Id: In-Reply-To: References: From: Subject: Cc: To: Date: Sender; bh=MEreWgqurGcxMV8ZznYEUkmEIRS8TdbMJ25yFmEcArA=; b=STN4FaIC1Uum+HSmFkjOiEnR4S83uF579IYKWHf7tjgPKEDNndb3+dsBaKGcXBt8j3J8XrOo EZDNkFdUfulA3vdsk0G7ZxRKfg03ORXr2TNXH28pE3PmVE93A8+HAONBvTgjS+XJc3BnKiYm 5RkU5SU516mE0AeCxa/8VliIp+NZiMsxEb0quLrOaO//IOnrM0/m92MYRlq7LtSi/9t6nJm2 RVeXAAn074eOgb9a40mCMn3SAUHomvtjm70eJ30nSOY0nZ2xf7N6kZjr7/Bw8o7Xbd1SKEt4 xS5ofJ4iO6qdiEIi4Fay1mIFQK/cytSc921cD9Q6ExcZpm1wOGGTsA== 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-n08.prod.us-east-1.postgun.com with SMTP id 61dec4769c5d22ce31147056 (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Wed, 12 Jan 2022 12:07:18 GMT Received: from localhost (aj097104.dynamic.ppp.asahi-net.or.jp [220.150.97.104]) by wilsonb.com (Postfix) with ESMTPSA id 6E283A04D6; Wed, 12 Jan 2022 12:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1641989228; bh=MEreWgqurGcxMV8ZznYEUkmEIRS8TdbMJ25yFmEcArA=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=4ME7M3md7DgrTgYJu7iL9JyjjWbqFo8lGzimyLKEwFyuH+jS/coOhtzJ8oc9PZJ1t dASiJqdp2BR6gZkqqy4+WN4u6Fnr8VVDWE14PccT3+sY3z9627FgXPE5tR5y2DOBNy GE/O3tqkbXLPXa/qiqhlpCDRoVYMAwVnbfIJffDoWnRcOFdFot7Cwujkb56MpxyNht xx7VtCXgqKfgwZ7FHhPM0CMI5qzZwDGXx/hx/QU8OLW4Gsdfya9ROdpWaAtUmkAawM PIOVR0JXQHeQQSiyhaidzAlgIQEYqrPL1tImah13Bo+BZpzaxDACXFBxYRB0nyb723 h1zW3FEcMPv5hxfDxX2jdVCLCevAfksPFy0MvvRTEzbStT1NULOrweOOa12oVHkHhE UK139nRr8AIJGX4Kd3NnWxppy1qliyeHzDBSwamdH2v5Q625xW2m5/1GrZ3dtXtxQo LM7zndqlZLMC7NPWvuQwiz2JDGdwTEsQ/did50cJDA1avUtePlfh1NfQjLRriren5v EBbNQVRylrDBHNB4U1FKxm9Ca5BX2cbEab6L8NU23C1dYYYOHQYXveOruv+BrPL1eX ZNuHAPnLLB3b4+3Juf7XhNKrt3CHcem24F5UWDE7RJdnHvdkl4Bti9XfIYihK8CKaI lshRJjOcZORQFw3C68Vyxvus= Date: Wed, 12 Jan 2022 21:07:45 +0900 To: Maxime Devos 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> In-Reply-To: <90704c2259f576a14fb1268219e8c0dc2b3bf289.camel@telenet.be> Message-Id: <2P322C327XW0Q.21O5A4IFGMNDI@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_37270a30602a14be45b721a4_=_" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 48463 Cc: Liliana Marie Prikler , 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. ------_=_37270a30602a14be45b721a4_=_ Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > + `(#:tests? #f > > [...] > > + (replace 'check > > + (lambda* (#:key tests? #:allow-other-keys) > > + (when tests? [...])))) >=20 > I think #:tests? #false should be removed, otherwise this > check phase would never do anything. Nice catch! Thanks. Disabled tests when tweaking builds and forgot to remov= e. > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ;; The jlibrary/dev directory only sometimes exists, > > but needs > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ;; to be copied into the ~system directory when it > > does. > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (for-each > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (lambda (dev-dir) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (access? dev-dir R_OK) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (copy-recursively de= v-dir > > "test/bin/system/dev"))) >=20 >=20 > Are you testing for file permissions, or for the existence of the file? > If the latter, I'd recommend using 'file-exists?' instead. >=20 > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (access? source-dev R_OK) Just existence. Thanks for the pointer. Changed. ------_=_37270a30602a14be45b721a4_=_ Content-Disposition: attachment; filename=0001-gnu-Add-j.patch Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable =46rom 648efabc2d9e7b9a28d22d47ea53451bc5b46cf3 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 | 454 ++++++++++++++++++ =20.../patches/jsoftware-j901-f-fixes.patch | 80 +++ =203 files changed, 535 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 1706663bde..0cbb8899ee 100644 =2D-- a/gnu/local.mk =2B++ b/gnu/local.mk =40@ -1290,6 +1290,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..97b561ec27 =2D-- /dev/null =2B++ b/gnu/packages/jsoftware.scm =40@ -0,0 +1,454 @@ =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-26))) =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 jtype) =2B "Return a package name for the given prefix and jtype, e.g. `jlib', =2B `jlib-beta', `j', and `j-beta'." =2B (let ((postfix (if (eq? jtype 'release) "" =2B (string-append "-" (symbol->string jtype))))) =2B (string-append prefix postfix))) =2B =2B(define (jversion->string version revision) =2B "Return a string representation of a J version and (optional) revision= =20pair." =2B (let ((postfix (if (not revision) "" =2B (string-append "." revision)))) =2B (string-append version postfix))) =2B =2B(define (jinfo->git-tag jversion jtype jrevision) =2B "Given version parameters, construct a git tag for upstream releases."= =0A+ (let ((postfix (if (not jrevision) "" =2B (string-append "-" jrevision)))) =2B (string-append "j" jversion "-" (symbol->string jtype) postfix))) =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 (program-file "ijconsole" =2B #~(begin =2B (use-modules ((ice-9 rdelim) #:select (read-line)) =2B ((ice-9 regex) #:select (regexp-match? string-match= =29)) =2B =2B ;; Assume that this script will be installed under bin/. =2B (define %basedir (dirname (dirname (current-filename)))) =2B =2B (define (cpu-feature-line? string) =2B (string-prefix? "flags" string)) =2B =2B (define (contains-word? word string) =2B (regexp-match? =2B (string-match (string-join `("\\<" ,word "\\>") "") =2B string))) =2B =2B (define (has-cpu-feature? feature) =2B (with-input-from-file "/proc/cpuinfo" =2B (lambda () =2B (catch 'found =2B (lambda () =2B (let loop ((line (read-line))) =2B (cond ((eof-object? line) #f) =2B ((and (cpu-feature-line? line) =2B (contains-word? feature line)) =2B (throw 'found)) =2B (else (loop (read-line)))))) =2B (const #t))))) =2B =2B (let* ((jconsole (string-append %basedir "/libexec/j/jconsole"))= =0A+ (libj (format #f "~a/lib/j/libj-~a.so" %basedir =2B (cond ((has-cpu-feature? "avx2") "avx2") =2B ((has-cpu-feature? "avx") "avx") =2B (else "")))) =2B (jprofile (string-append %basedir "/etc/j/profile.ijs")))= =0A+ (apply execl jconsole "ijconsole" "-lib" libj "-jprofile" jpr= =6Ffile =2B (cdr (command-line))))))) =2B =2B(define* (make-j #:key =2B (builder "guix.gnu.org") =2B vername =2B revision =2B hash =2B (type 'release) =2B commit =2B (patches '()) =2B (extra-inputs '()) =2B (extra-envars '())) =2B (package =2B (name (jname "jsoftware-j" type)) =2B (version (jversion->string vername revision)) =2B (source =2B (origin =2B (method git-fetch) =2B (uri (git-reference =2B (url "https://github.com/jsoftware/jsource") =2B (commit (or commit (jinfo->git-tag vername type revision))))= =29 =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)) =2B (("^#define jtype.*$") =2B (format #f "#define jtype ~s\n" (symbol->string ',type)= =29) =2B (("^#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/.j// instead =2B "'jtype jversion'=3D. (3&{,{.) <;._2 ,&'/' 9!:14= =27'" =2B "jversion=3D. ({.~ i.&'-') jversion" =2B "jsuffix=3D. >@{&('';'-beta') jtype -: 'beta'" =2B "user=3D. home,'/.config/j/',jversion,jsuffix" =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 (jplat (string-append "jplatform=3D" platform)) =2B (target-bit ,(if (target-64bit?) "64" "32")) =2B (jbit (string-append "j64x=3D" "j" target-bit)) =2B (jbit-avx (string-append jbit "avx")) =2B (jbit-avx2 (string-append jbit "avx2"))) =2B (parallel =2B ;; Since jconsole doesn't depend on AVX features, we j= =75st =2B ;; build it once. =2B (invoke "env" jplat jbit "./build_jconsole.sh") =2B (invoke "env" jplat jbit "./build_libj.sh") =2B (if ,(target-64bit?) =2B (parallel =2B (invoke "env" jplat jbit-avx "./build_libj.sh") =2B (invoke "env" jplat jbit-avx2 =2B "./build_libj.sh")))))))) =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 ((jplatform ,(if (target-arm?) "raspberry" "linux")))= =0A+ (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* ((jbin (string-append "bin/" jplatform)) =2B (jbit ,(if (target-64bit?) "j64" "j32")) =2B (jconsole (string-append jbin "/" jbit =2B "/jconsole")) =2B (source (string-append jbin "/" 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* ((jc (string-append dest "/jconsole")) =2B (tests "test/tsu.ijs") =2B (port (open-pipe* OPEN_WRITE jc tests))) =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/" jplatform) =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* ((jplat ,(if (target-arm?) "raspberry" "linux")) =2B (jbit ,(if (target-64bit?) "j64" "j32")) =2B (ijconsole (assoc-ref inputs "ijconsole")) =2B (interp (string-join `("bin" ,jplat ,jbit "jconsole")= =20"/")) =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-" ,ver= =6Eame)) =2B (mkdir-p lib) =2B (for-each =2B (lambda (jarch) =2B (let* ((jbin (string-join `("bin" ,jplat ,jarch) "/"))= =0A+ (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/" jplat) =2B (negate (cut member <> '("." ".."))))) =2B (install-file interp 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 #:vername "901" =2B #:revision "f" =2B #:hash "1776021m0j1aanzwg60by83n53pw7i6afd5wplfzczwk8bywax4p" =2B #:patches (search-patches "jsoftware-j901-f-fixes.patch"))) =2B =2B =2B(define jlib-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 jlib-build-configuration-with-sleef =2B '(#:vername "902" =2B #:revision "b" =2B #:hash "0j67vgikqflwjqacsdicasvyv1k54s2c8vjgwmf0ix7l41p4xqz0")))= =29 =2B =2B =2B(define-public jsoftware-j-903 =2B (apply make-j =2B (append jlib-build-configuration-with-sleef =2B '(#:vername "903" =2B #:revision "a" =2B #:commit "903-release-a" =2B #:hash "1fcfl7q7c2vj4fmnqqc8c6hwgsjm20ff93v8xxfniasss1b2fmc4")))= =29 =2B =2B;; Keep until j904-beta is released. =2B(define-public jsoftware-j-903-beta =2B (apply make-j =2B (append jlib-build-configuration-with-sleef =2B `(#:vername "903" =2B #:revision "w" =2B #:type ,'beta =2B #:hash "0kd63mrkaq0bs42gw0wrlb14fymhigznx1lrb698dgv6fzlfglim")))= =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 (interp (car (scandir (string-append jpkg "/bin") =2B (cut string-match "ijconsole-.*" = =3C>)))) =2B (source (string-append jpkg "/bin/" interp)) =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