From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OF9oN+f5oGBY5QAAgWs5BA (envelope-from ) for ; Sun, 16 May 2021 12:54:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UDAfM+f5oGAAOgAA1q6Kng (envelope-from ) for ; Sun, 16 May 2021 10:54:31 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B7E9013078 for ; Sun, 16 May 2021 12:54:30 +0200 (CEST) Received: from localhost ([::1]:35642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liEPl-0005by-UR for larch@yhetil.org; Sun, 16 May 2021 06:54:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liEPN-0005Zi-Fb for guix-patches@gnu.org; Sun, 16 May 2021 06:54:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1liEPK-0005j3-GJ for guix-patches@gnu.org; Sun, 16 May 2021 06:54:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1liEPK-0005IY-Db for guix-patches@gnu.org; Sun, 16 May 2021 06:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48463] gnu: Add j. Resent-From: elaexuotee@wilsonb.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 16 May 2021 10:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48463 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 48463@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162116239520306 (code B ref -1); Sun, 16 May 2021 10:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 May 2021 10:53:15 +0000 Received: from localhost ([127.0.0.1]:49747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1liEOS-0005HL-RX for submit@debbugs.gnu.org; Sun, 16 May 2021 06:53:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:36356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1liEOL-0005Gw-RG for submit@debbugs.gnu.org; Sun, 16 May 2021 06:53:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liEOL-0004ru-HQ for guix-patches@gnu.org; Sun, 16 May 2021 06:53:01 -0400 Received: from m42-5.mailgun.net ([69.72.42.5]:35906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1liEOG-00055n-Up for guix-patches@gnu.org; Sun, 16 May 2021 06:53:01 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1621162377; h=Content-Type: MIME-Version: Message-Id: Subject: From: To: Date: Sender; bh=wp90HGR7czWGjUyhqykYSOCgr9nC17oHWfwfutUFgWw=; b=PnmksnhEI/x7fVV2o1IFgi+8KRf5HlhY2OVDwHVVazVV2mMjzlk4OXB5KTGmB5ukZsWs9Tlh ivqNu8afkLYPVLsomwpNh0OydTKwyD2LE5rqiVoKGOuR0IRV4i+H1N1JRKbgVwecEFaLbOxq ISokfj7E03bGQ3+hmMqq5agU8ypIJgSWekvuKkyC1hNgNmp/4tUAI7+qjDWrVy1dgbYmgvJd nKX86ZNiV0JgdMgG2n7phxLSiBEJxo0c+FkktlIrzXr7LarSRFHvwGK/hHGxe8Jq1gb6esbe FplVM4YrZYGhCfwBZa+6wvoDYnFa9FpTmyrvUI9rYnKsmkhfDG8EJA== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyI5MmEzMyIsICJndWl4LXBhdGNoZXNAZ251Lm9yZyIsICIwODU0N2EiXQ== Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n03.prod.us-east-1.postgun.com with SMTP id 60a0f97760c53c8c9d798945 (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Sun, 16 May 2021 10:52:39 GMT Received: from localhost (x111210.dynamic.ppp.asahi-net.or.jp [122.249.111.210]) by wilsonb.com (Postfix) with ESMTPSA id 2198EA2F83 for ; Sun, 16 May 2021 10:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1621162356; bh=wp90HGR7czWGjUyhqykYSOCgr9nC17oHWfwfutUFgWw=; h=Date:To:From:Subject:From; b=3lUNOl3i4BESz6ToXLE5cj7comGwonpxU34R85spPd4fNPxIXxhdFddvO54tmb9ie 1NRZxXTdsIGPxq0RZBpmIwS0um370HbwyUi2EcNkku4GqkPm90cAuDuATtMmv5/ITM il/qPiMh5OC61h+3ECWG/p+pFQw48/28LdWeMuEybWb/IZ3FkFNso6o805QPFRe/kR W4KuAENuV1L7pnkhzghPxLG3AJZD4vAxJx4Ei/ogbyTKbmCL6Xgx8wGNOeI2WuptG4 619jVjOe5SltjhHUWJjiOpSfIjgO2dMYlUQIngh5rWuqLOa2AQF0wDyP9stYTcc+c4 jwd9enW1PzZ5d3I7N3ISTHOmcenBIGtPN46g5nzpWKujGFqbBQD0QZifi9B208Rjsd mzltWQszxwVQ1tkIHESolFrNHL8D8DSbPJLyZppf/evBYNmteBALR/1OyWYhMa8WqC 2x99mtApOPLVs1374YOZAyUfiLTdhishVbP1Th7oHSlZjDDqsCs60c6335p2QpPkoU V69Xv7Aag1LgqjXPvKfAd73+CBES1cppfVxhqiFG551voc4c4jLa+RJLebl27qsYRI qPSauJ48fU0uB2D/IC2OondTJa8v5F6ZuFJ+IDjXCfdXJrP9z9tWD9vzpxI0uhnIHB Fdu2NhvA3EkElxwUeeb2xSKc= Date: Sun, 16 May 2021 19:54:03 +0900 Message-Id: <3LOAUDT0FLL4U.2SOD925YP915T@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_7a8f3a2476501c02442e0b78_=_" Received-SPF: pass client-ip=69.72.42.5; envelope-from=bounce+686de0.08547a-guix-patches=gnu.org@mg.wilsonb.com; helo=m42-5.mailgun.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: elaexuotee@wilsonb.com X-ACL-Warn: , elaexuotee--- via Guix-patches From: elaexuotee--- via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621162471; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=wp90HGR7czWGjUyhqykYSOCgr9nC17oHWfwfutUFgWw=; b=U+NE26hNdfwlqr7XHFWGMUsg3EowJvYPAPA24HV0w8R1EaXT3fjuB9Hvz/SVAGjqGfxrfU MOxirEv3gL0lgtACWhRvxnKV67UZgnQn8ISGz7gTgB9GMUYa3RrrkBrACnQ6qJJK9+c2TS 9AAyV2Ubtm67Fo8+T/WWLTSljwvqV1lm4dnU4yusMB2PbDCkWz1GoqTT/x0S47aamysKkb En+OBi9R3/ojdCRDnJD3uOi951Gh1usd6fKDaaGh3l5GQbBxy8PyXcqKqQRAvg1nFvynsO GI9MsoUFnCQsG3VDMDP+RDyuXrv3zzbvNAvlFzfN+wvktMVCXgEOkX+sx96Vsg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621162471; a=rsa-sha256; cv=none; b=OCNm1R7OiRO3sf38Uj3Vpet6yuYynXoDVdAkUDS61Kt6g/J7NneUnqPEDZoIXYd6WCep0k 8hmk9zuM/SKJF0aUT+hjsjHLm+bhofo5QFaunEdPhqmUyIB1//GrW0aFWNoqXKDXsqx5Cy pmNFs0IPIahqXWtXYTTVV+98isASouTGgDIO58eLEvdmmperq4ikFcIEpjep1rn5TR4TJ9 rWwHMImh0Kn9j25O7RqUYwN0HrKjtA20G/YaNgi+ovNMXgBXIrqSQu1Iror3QCeUaykg2K BfHHuaHMNNAmsYS1UoW4nF7/lWAnRANV+RnYU1xnulfXYZK7ZzmgTxgb0EPFpA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mg.wilsonb.com header.s=krs header.b=PnmksnhE; dkim=fail ("headers rsa verify failed") header.d=wilsonb.com header.s=201703 header.b=3lUNOl3i; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.45 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mg.wilsonb.com header.s=krs header.b=PnmksnhE; dkim=fail ("headers rsa verify failed") header.d=wilsonb.com header.s=201703 header.b=3lUNOl3i; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: B7E9013078 X-Spam-Score: -1.45 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8UWIbr8msYRL This is a multipart message in MIME format. ------_=_7a8f3a2476501c02442e0b78_=_ Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Guix, This packages up the J programming lanuage. The build scripts that upstream= provides are pretty hostile to package maintainers, so we have to jump thro= ugh quite a few hoops to get the build working. I have had this in my personal, private channel for a while, tweaking it ov= er time, so I believe it works fairly well in practice. Here are the high-leve= l design decisions I have made: 1) Provide multiple J versions; It is extremely common for J users to have multiple versions installed in parallel since there are often major, breaking changes between (non-patch-level) releases. In addition, a very large fraction of J users keep the beta installed as we= ll, so I have elected to provide this too. 2) Bundle together all variants of the interpreter along with a wrapper script that selects the most featureful one at runtime; There are 3 versions of the interpreter, supporting different CPU feature-s= ets: vanilla, AVX, AVX2. This package elects to build all these variants and provides a wrapper script that launches the "most AVX-y" version possible a= t runtime. Essentially, this is trying to make up for upstream's lack of a fat binary.= 3) Try to mirror the FHS standard for installation locations; For the most part, J uses idiosyncratic defaults for where it looks for lib= rary files and the like. This package elects to configure things so files sit in= more standard locations---e.g. runtime scripts sit under .../share/j; configuration files sit under .../etc/j; etc. 4) Point the J package manager to $HOME/.j/. J maintains its own mini package repository for "addons", which are simply officially-supported J scripts. This package sets things up so that these packages get installed to .j//addons. In addition, other related directories are gathered under .j/. Items on the TODO list: 1) Write an importer and create packages for J addons; This is currently in progress. 2) Create a something like a jsoftware-union procedure to bundle up J with user-selectable addons; This is necessary since the interpreter looks for addons at a specified pat= h. We probably want to mimick something like texlive and provide both an "all batteries included" package along with one where users can select which add= ons they want. 3) Support more older versions of J. J is open source starting with j801, so it'd be nice to have packages for t= he entire j80x series too. Unfortunately, those use an entirely different set = of build scripts from the current j90x series, so it will require munging-work= similar to what we already have. Cheers! ------_=_7a8f3a2476501c02442e0b78_=_ Content-Disposition: attachment; filename=0001-gnu-Add-j.patch Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable =46rom c231924ab9a72979001640d866db1988f8fd3bde Mon Sep 17 00:00:00 2001 =46rom: "B. Wilson" =44ate: Sun, 16 May 2021 19:02:29 +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: (GNU_SYSTEM_MODULES, dist_patch_DATA): Add them. =2D-- =20gnu/local.mk | 2 + =20gnu/packages/jsoftware.scm | 432 ++++++++++++++++++ =20.../patches/jsoftware-j901-f-fixes.patch | 80 ++++ =203 files changed, 514 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 c3b0274945..b706ec4e86 100644 =2D-- a/gnu/local.mk =2B++ b/gnu/local.mk =40@ -305,6 +305,7 @@ GNU_SYSTEM_MODULES =3D \ =20 %D%/packages/javascript.scm \ =20 %D%/packages/jemalloc.scm \ =20 %D%/packages/jrnl.scm \ =2B %D%/packages/jsoftware.scm \ =20 %D%/packages/jose.scm \ =20 %D%/packages/julia.scm \ =20 %D%/packages/julia-xyz.scm \ =40@ -1270,6 +1271,7 @@ dist_patch_DATA =3D \ =20 %D%/packages/patches/jfsutils-add-sysmacros.patch \ =20 %D%/packages/patches/jfsutils-include-systypes.patch \ =20 %D%/packages/patches/jsoncpp-fix-inverted-case.patch \ =2B %D%/packages/patches/jsoftware-j901-f-fixes.patch \ =20 %D%/packages/patches/julia-SOURCE_DATE_EPOCH-mtime.patch \ =20 %D%/packages/patches/kdbusaddons-kinit-file-name.patch \ =20 %D%/packages/patches/libffi-3.3-powerpc-fixes.patch \ =64iff --git a/gnu/packages/jsoftware.scm b/gnu/packages/jsoftware.scm =6Eew file mode 100644 =69ndex 0000000000..f6f6099e42 =2D-- /dev/null =2B++ b/gnu/packages/jsoftware.scm =40@ -0,0 +1,432 @@ =2B;;; GNU Guix --- Functional package management for GNU =2B;;; Copyright =C2=A9 2021 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 records) =2B #:use-module (guix packages) =2B #:use-module ((guix licenses) #:prefix license:) =2B #:use-module (guix git-download) =2B #:use-module (guix build-system gnu) =2B #:use-module (guix build-system trivial) =2B #:use-module (guix build utils) =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 match)) =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-record-type* =2B jlib-build-configuration make-jlib-build-configuration =2B jlib-build-configuration? =2B (builder jlib-build-configuration-builder (default "guix.gnu.org"= =29) =2B (version jlib-build-configuration-version (default #f)) =2B (revision jlib-build-configuration-revision (default #f)) =2B (hash jlib-build-configuration-hash (default #f)) =2B (type jlib-build-configuration-type (default 'release)) =2B (patches jlib-build-configuration-patches (default '())) =2B (extra-inputs jlib-build-configuration-extra-inputs (default '())) =2B (extra-envars jlib-build-configuration-extra-envars (default '()))) =2B =2B(define make-jlib =2B (match-lambda =2B (($ =2B builder jversion revision hash type patches extra-inputs extra-e= =6Evars) =2B (package =2B (name (jname "jlib" type)) =2B (version (jversion->string jversion revision)) =2B (source =2B (origin =2B (method git-fetch) =2B (uri (git-reference =2B (url "https://github.com/jsoftware/jsource") =2B (commit (jinfo->git-tag jversion type revision)))) =2B (sha256 (base32 hash)) =2B (file-name (git-file-name name version)) =2B (patches patches))) =2B (properties `((jversion . ,jversion) =2B (jrevision . ,revision) =2B (jtype . ,type))) =2B (build-system gnu-build-system) =2B (native-inputs `(("clang-toolchain" ,clang-toolchain))) =2B (inputs (cons* `("libedit" ,libedit) =2B `("libomp" ,libomp) =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-mat= =63h)) =2B ((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 bui= =6Cd =2B ;; build up (very complicated) environment variables to pass t= =6F make. =2B ;; The basic build process looks like this: =2B ;; =2B ;; 1) Copy jsrc/jversion-x.h to jsrc/jversion.h and edit val= =75es; =2B ;; 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 = =73ource =2B ;; directory; they do not supply a make `install' target. Thu= =73 it =2B ;; takes some massaging to install files in FHS-style director= =69es. =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 direc= =74ories; =2B ;; 3) make2/build_*.sh to respect standard build conventio= =6Es; =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-toolcha= =69n")) =2B (clang (string-append clang-toolchain "/bin/clang= =22)) =2B (libedit (assoc-ref inputs "libedit")) =2B (out (assoc-ref outputs "out")) =2B (share (string-append out "/share/j"))) =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 ',t= =79pe))) =2B (("^#define jbuilder.*$") =2B (format #f "#define jbuilder ~s\n" ,builder))) =2B ;; Create profilex.ijs overrides to point to the corre= =63t =2B ;; store items. Note that we set ~install and ~addons= =0A+ ;; directories to reside under ~user to allow install= =69ng =2B ;; and loading addons. TODO: Guix-ify J addons as wel= =6C. =2B (call-with-output-file "jlibrary/bin/profilex.ijs" =2B (lambda (port) =2B (display =2B (string-join =2B (list =2B (format #f "system=3D. '~a/system'" share) =2B (format #f "tools=3D. '~a/tools'" share) =2B ;; Upstream defaults to spamming $HOME with =2B ;; unhidden userdata directories. Set this = =74o be =2B ;; $HOME/.j// instead =2B "'jtype jversion'=3D. (3&{,{.) <;._2 ,&'/' 9= =21:14''" =2B "jversion=3D. ({.~ i.&'-') jversion" =2B "jsuffix=3D. >@{&('';'-beta') jtype -: 'beta= =27" =2B "user=3D. home,'/.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= =20actual =2B ;; compiler. It is just a switch to tell the b= =75ild =2B ;; scripts whether to use gcc- or clang-specifi= =63 =2B ;; flags. =2B (("^compiler=3D.*$") "compiler=3Dclang\n") =2B (("^LDFLAGS=3D\"" def) (string-append def "$LDF= =4CAGS ")) =2B (("^(common=3D\")(\\$USETHREAD.*)$" _ def rest)= =0A+ (string-append def "$CFLAGS " rest)) =2B (("^#!.*" shebang) =2B (string-append shebang "set -o errexit\n")))))= =0A+ '("build_jconsole.sh" "build_libj.sh")) =2B ;; The jconsole manually loads libedit with dlopen. T= =68e path =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-scri= =70t =2B ;; definitions of new J engine functionality. Since w= =65 point =2B ;; ~addons under the ~user directory, we move it under= =0A+ ;; ~system 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"= =29)) =2B (scandir "." =2B (lambda (f) (eq? (stat:type (stat f)) 'regular))= =29)) =2B ;; Implementation of 9!:14 records build time which br= =65aks =2B ;; build reproducibility. Note that upstream code dep= =65nds on =2B ;; the exact format of these strings, so we need to mi= =6Dic the =2B ;; standard. =2B (substitute* "jsrc/j.c" =2B (("__DATE__") "\"Jan 01 1970\"") =2B (("__TIME__") "\"00:00:00\"")) =2B ;; Upstream recommends using clang, with GCC support b= =65ing =2B ;; second-class, often resulting in build failures. =2B (setenv "CC" clang)))) =2B ;; The build output depends primarily on the values of the =2B ;; `jplatform' and `j64x' environment variables. If the tar= =67et is =2B ;; ARM, then `jplatform' is "raspberry", otherwise it is `li= =6Eux'. =2B ;; In addition to 32- and 64- bit versions, `j64x' controlls= =0A+ ;; whether AVX or AVX2 variants of libj are built. =2B ;; =2B ;; However, build targets are not fine-grained enough to =2B ;; distinguish between CPU features. Thus we build and inst= =61ll all =2B ;; variants of libj, expecting jconsole to be called with a = =77rapper =2B ;; script that detects AVX features and loads the appropriat= =65 libj =2B ;; at runtime. =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= =22)) =2B (jplat (string-append "jplatform=3D" platform))= =0A+ (target-bit ,(if (target-64bit?) "64" "32")) =2B (jbit (string-append "j64x=3D" "j" target-bit))= =0A+ (jbit-avx (string-append jbit "avx")) =2B (jbit-avx2 (string-append jbit "avx2"))) =2B (parallel =2B ;; Since jconsole doesn't depend on AVX features, = =77e just =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"= =29 =2B (invoke "env" jplat jbit-avx2 =2B "./build_libj.sh")))))))) =2B ;; The test suite is expected to be run as follows for each = =76ariant =2B ;; of libj that we build: =2B ;; =2B ;; $ echo 'RUN ddall' | jconsole test/tsu.ijs =2B ;; =2B ;; This requires a working jconsole with accessible jlibrary= =20files. =2B ;; We simply place these all under test/bin. =2B (replace 'check =2B (lambda _ =2B (let ((jplatform ,(if (target-arm?) "raspberry" "linux"= =29)) =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, = =62ut =2B ;; needs to be copied into the ~system directory when= =20it =2B ;; does. =2B (if (access? "jlibrary/dev" R_OK) =2B (copy-recursively "jlibrary/dev" "test/bin/system/d= =65v")) =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= =29 =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)= =29) =2B (display "RUN ddall\n" port) =2B (when (not (zero? (status:exit-val =2B (close-pipe port)))) =2B (error "Some J build tests failed."))))))= =0A+ (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 qui= =72k is =2B ;; that we install jconsole under /libexec to make room for = =74he =2B ;; wrapper 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 (jconsole (string-join =2B `("bin" ,jplat ,jbit "jconsole") "/")= =29 =2B (out (assoc-ref outputs "out")) =2B (etc (string-append out "/etc/j")) =2B (lib (string-append out "/lib/j")) =2B (libexec (string-append out "/libexec")) =2B (share (string-append out "/share/j")) =2B (system (string-append share "/system")) =2B (dev (string-append system "/dev"))) =2B (mkdir-p lib) =2B (for-each =2B (lambda (jarch) =2B (let* ((jbin (string-join `("bin" ,jplat ,jarch) "= =2F")) =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 j= =61vx))) =2B (copy-file source dest))) =2B (scandir (string-append "bin/" jplat) =2B (negate (cut member <> '("." ".."))))) =2B (install-file jconsole libexec) =2B (copy-recursively "jlibrary/system" system) =2B (if (access? "jlibrary/dev" R_OK) =2B (copy-recursively "jlibrary/dev" 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 fami= =6Cy") =2B (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 prob= =6Cems =2Bthat are not already well understood.") =2B (license license:gpl3+))))) =2B =2B =2B(define jlib-901 =2B (make-jlib =2B (jlib-build-configuration =2B (version "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 (jlib-build-configuration =2B (extra-inputs `(("sleef" ,sleef))) =2B (extra-envars `(("USE_SLEEF_SRC" "0") =2B ("LDFLAGS" "-lsleef"))))) =2B =2B(define jlib-902 =2B (make-jlib =2B (jlib-build-configuration =2B (inherit jlib-build-configuration-with-sleef) =2B (version "902") =2B (revision "b") =2B (hash "0j67vgikqflwjqacsdicasvyv1k54s2c8vjgwmf0ix7l41p4xqz0")))) =2B =2B(define jlib-903-beta =2B (make-jlib =2B (jlib-build-configuration =2B (inherit jlib-build-configuration-with-sleef) =2B (version "903") =2B (revision "h") =2B (type 'beta) =2B (hash "13sw2ffgx6pm699qfi50drlp8y1vmzj4swzx82g6vhyjpjci1w4h")))) =2B =2B =2B(define (make-ijconsole jlib) =2B "Generate a G-exp wrapper script that detects AVX/AVX2 support at runt= =69me and =2B executes jconsole with the appropriate libj.so and profile.ijs." =2B (program-file (string-append "ijconsole-" (package-version jlib)) =2B #~(begin =2B (use-modules ((ice-9 rdelim) #:select (read-line)) =2B ((ice-9 regex) #:select (regexp-match? string-match= =29)) =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 #$jlib "/libexec/jconsole")) =2B (libj (format #f "~a/lib/j/libj-~a.so" #$jlib =2B (cond ((has-cpu-feature? "avx2") "avx2") =2B ((has-cpu-feature? "avx") "avx") =2B (else "")))) =2B (jprofile (string-append #$jlib "/etc/j/profile.ijs"))) =2B (apply execl jconsole "ijconsole" "-lib" libj "-jprofile" jpro= =66ile =2B (cdr (command-line))))))) =2B =2B(define (make-j jlib) =2B "Generate a J package containing /bin/ijconsole- linked agai= =6Est the =2B given jlib library package. Note that the ijconsole executable is ver= =73ioned =2B since it is typical for J users to have multiple versions installed on= =20the =2B same system." =2B (let ((jversion (assq-ref (package-properties jlib) 'jversion)) =2B (jtype (assq-ref (package-properties jlib) 'jtype))) =2B (package (inherit jlib) =2B (name (jname "j" jtype)) =2B (source #f) =2B (inputs `(("jlib" ,jlib) =2B ("ijconsole" ,(make-ijconsole jlib)))) =2B (build-system trivial-build-system) =2B (arguments =2B `(#:modules ((guix build utils)) =2B #:builder =2B (begin =2B (use-modules (guix build utils)) =2B (let* ((ijconsole (assoc-ref %build-inputs "ijconsole")) =2B (out (assoc-ref %outputs "out")) =2B (bin (string-append out "/bin"))) =2B (mkdir-p bin) =2B (symlink ijconsole =2B (string-append bin "/ijconsole-" ,jversion))))))))= =29 =2B =2B(define-public j-901 (make-j jlib-901)) =2B(define-public j-902 (make-j jlib-902)) =2B(define-public j-903-beta (make-j jlib-903-beta)) =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