From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UHn+MvbF5GEgXwAAgWs5BA (envelope-from ) for ; Mon, 17 Jan 2022 02:27:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4GGTL/bF5GHfIgAAauVa8A (envelope-from ) for ; Mon, 17 Jan 2022 02:27:18 +0100 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 02A942B6AD for ; Mon, 17 Jan 2022 02:27:18 +0100 (CET) Received: from localhost ([::1]:60772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9Gnl-0002R3-4T for larch@yhetil.org; Sun, 16 Jan 2022 20:27:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9GnJ-0002Qo-EF for guix-patches@gnu.org; Sun, 16 Jan 2022 20:26:49 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n9GmY-0007QN-1B for guix-patches@gnu.org; Sun, 16 Jan 2022 20:26:34 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n9GmX-0000t2-TZ for guix-patches@gnu.org; Sun, 16 Jan 2022 20:26:01 -0500 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: Mon, 17 Jan 2022 01:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48463 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: Maxime Devos , 48463@debbugs.gnu.org Received: via spool by 48463-submit@debbugs.gnu.org id=B48463.16423827153353 (code B ref 48463); Mon, 17 Jan 2022 01:26:01 +0000 Received: (at 48463) by debbugs.gnu.org; 17 Jan 2022 01:25:15 +0000 Received: from localhost ([127.0.0.1]:44533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9Glg-0000rm-Pk for submit@debbugs.gnu.org; Sun, 16 Jan 2022 20:25:15 -0500 Received: from m42-5.mailgun.net ([69.72.42.5]:13694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9Gle-0000rB-5k for 48463@debbugs.gnu.org; Sun, 16 Jan 2022 20:25:07 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1642382706; h=Content-Type: MIME-Version: Message-Id: In-Reply-To: References: From: Subject: Cc: To: Date: Sender; bh=3w2pKe0BfwFJ1d1bCwlONmtFn6l+i+zE3c/07Wl7RnU=; b=cbCSK2GyySLSX7mXHQkp5aw3FnRWk945/WgbGPovsvsfqa6VC/qUwMSvN14toco1WiaDokgW B1lBtLukNYLVAGAb9urrgPBPjTYj9a28Pp3sh+Nks2vxbXlX1svUqibpJNN+P39e/X6b3zzf zCKLZCaBF3gfUJXS6x1eNeI/b/ljastbl2Ml4Pe1DsskWou1JJTv9Up3qmXVH3XMbrusxFr1 nSC6xpWxMM0sLFBBeqYAIafa4QIzjvZ4RZgjvD/a6C0QMRfURWIe/1gnuCkYms31MhOpmwPN /pmURVr3wFjcgPJ9Qg/VCFI0l+skqailk0v50njq6uB6JRthQHyVnQ== 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-n02.prod.us-west-2.postgun.com with SMTP id 61e4c56ce0071250cf85429f (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Mon, 17 Jan 2022 01:24:59 GMT Received: from localhost (q045100.dynamic.ppp.asahi-net.or.jp [203.181.45.100]) by wilsonb.com (Postfix) with ESMTPSA id AEC4DA04CC; Mon, 17 Jan 2022 01:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1642382694; bh=3w2pKe0BfwFJ1d1bCwlONmtFn6l+i+zE3c/07Wl7RnU=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=j4Z7z6S/rbCwBrL3cjd+mKkFEir/+6OaGqHs93P0V9bHzDv4dGBRjZlZdbVDLUpDE mV2/3PYTQ35G6iuexvSt/9nuLpjtzEGeDOZAux6DPP/VT+zcKKfR/k3i2Y4drl++Og IjdphI2R/JB4ZwCvC9P8mMYxLqGMTCAKrldLxXjA6VzYSsFWYg0qhlfUgvORb42ByL IiRQGEe2kzNJin4FQyIfBrQGnvpLqnhyQaCADaZzEY6LFcpM+Seai5ZIzPEQDaqmBN KNnnJOkY8uCHclm+1fHEEs1CU43au1RBBLKbb4bNmXG0FwvwDUOwy/x18gq2U7GhxV O+FH3B4KA5HEIahjNDZUWO2FU52hxCJfHqTtOTrOWRhiFxXb5QizxqioX+XBBuiy1e WZ+KjMVKHvb7TEeHaJK1RBNgCYGJqQjmiiibPNpu6QwMG/q3fvJ8UDiqNJDRzleJbN FjlXFNWvcroqGlfG9iYlfq6k44eG+Tt17ITBrI93xRTdBMVi0xD4bJsPvIye1ZeD0v 2EiXKSoqRJ84hT9wgb1Ftk2lflCL7guEsTr5J5OvuGTuoBWAg+Pbu92kXz1GoEiDI9 qFgwl7XZCCswKcgsDTQ+ZhQouWAajy0EQlojnj0VEBIWv6krdXCZY2Azbx8eHKkTAx L7MB8BW9XyobO8lspmwhZ7kA= Date: Mon, 17 Jan 2022 10:24:49 +0900 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> <24ZUUMG4QYSHN.2OS7YAMCKREUA@wilsonb.com> <83aba994536bec60f79900d551d4801c967742bd.camel@gmail.com> <25Z6NGGGNJYD1.3S7A1QLFX7I9Y@wilsonb.com> <24FU0VP6N4ZZ7.3PE5LG30BSNUQ@wilsonb.com> In-Reply-To: Message-Id: <2EZU214MJAIBY.3EXSPSUMS5WW5@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_164079252dd080b57e5a8564_=_" 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642382838; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=3w2pKe0BfwFJ1d1bCwlONmtFn6l+i+zE3c/07Wl7RnU=; b=C4kWx0YeTc0EWO6yQXpiCzuIDGQAtBT5J1XaPyGlkwXTcppXohwgmWnZUcbAoICcTeBpMD 6wB/9qEmz21zFxMZUSyDIFctBtdWb7H7tGyjHfB8AMTljbK45ckbnhKDWEJpoNv5LDspQV tv3im8p7OKYu+Y9ZV8pRxAqofilkc19TuDu1VaSBExNwo9v/8TfPp4YulrYy+1e0IS7gr+ g3x8VtyTYrUV4nNJ5LIyLI2T/vExA85FuVgs0JomempW3Yey+fhGWhBnmj1wTWdVasm8/U nF2Un0XrQABADeGI3zKntN4vVzZUsRXCUROo+btRd5YINSHODHbpyoFKiJ1Q6Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642382838; a=rsa-sha256; cv=none; b=TdSz3PuwMY792hjwYehZIxhDOL9jMCo7ykjW4d5ugjQzqYHI0gh3xIgU8ZXnh9bBdt5HkO sLunuMBRo3DzyOIbiV36asYAil7z9kOG6u5oufKbO+ITAtyYrv/OdU8EkJw/WGsCq9CfOs ONZABqggezWNucBVB43OPb+PmUyOD9p+S6SHLsQajbQzqZHuNN7AQvBFE/ML7xS4rKWIpJ Qj0TQssnKBqgf0C+Mja2XWXvd6l9I7LRvgZ8OI1V7/o72gidlXJriWGakemPd3hUsaxlwB yMnDAR1Wce3K/A7Pl2FueluD0+CHZgiauXWbSXwjx4j+OfuGt4NHONp8tdOCNQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mg.wilsonb.com header.s=krs header.b=cbCSK2Gy; dkim=fail ("headers rsa verify failed") header.d=wilsonb.com header.s=201703 header.b="j4Z7z6S/"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.62 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mg.wilsonb.com header.s=krs header.b=cbCSK2Gy; dkim=fail ("headers rsa verify failed") header.d=wilsonb.com header.s=201703 header.b="j4Z7z6S/"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 02A942B6AD X-Spam-Score: -3.62 X-Migadu-Scanner: scn1.migadu.com X-TUID: r49/k2D2Yo43 This is a multipart message in MIME format. ------_=_164079252dd080b57e5a8564_=_ Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Again, thanks for the consistent quick turn-around, lately. > > How about we just go ahead and treat MINOR as mandatory as well? > In other words minor should always have a value >=3D "a" and 902 was just= > missing it? Fair enough, in that case making version mandatory sounds > like the way to go. Exactly. Thanks to your close reading of the patch and your opinionated suggestions,= we were able to catch this > > The file-union seems like a cludgy workaround to me. What we really > > want is an easy, direct way to get handles on the input files. Heck, > > program-file objects already have a name property; why can't we use > > that? Attached patches are a proof-of-concept. > That proof of concept does look nice, but for one we're trying to move > away from labels, and for the other, it's on a scale that I don't want > to decide as part of a package addition. If you feel it has value > outside of the proposed usage for j, discussing it under a different > number or perhaps on guix-devel might be worth it. Of course. It would be kind of ridiculous to merge some random, only vaguel= y related patch deep in the internals of the system, as part of a simple pack= age addendum. We're not writing bills for the Senate here! Whether or not the patch is valuable, I could learn a lot from any ensuing discussion, so I might take up your idea to post separately. > > That said, if this is going to turn into a big rabbit hole, can we just= > > munge the J package inputs into whatever you think is best? > As said in my previous mail, that'd be > > > (define jsoftware-aux-files > > > (file-union "jsoftware-aux-files" > > > `(("profile.ijs" ,(search-aux-file ...) > > > ("ijconsole" ,(program-file ...)))) > In my personal opinion, you can then simply add jsoftware-aux-files as > input and (search-input-file "ijconsole") instead of the current assoc- > ref. WDYT? Sounds clear to me! However, for some reason, right now if 'search-auxiliary-file' is inside a file-union, I'm getting ENOENT on the file somewhere: Backtrace: 2 (primitive-load "/gnu/store/fk7mr923n47r7wj7xqlfmh80jc5?")= In ice-9/eval.scm: 619:8 1 (_ #f) In unknown file: 0 (stat "/home/x/devel/org.gnu.savannah/guix/gnu/package?" ?= ) ERROR: In procedure stat: In procedure stat: No such file or directory: "/home/x/devel/org.gnu.sa= vannah/guix/gnu/packages/aux-files/jsoftware/profilex.ijs" builder for `/gnu/store/4zhrg7g17bqpmlgp5i58vbsc5g8xsl1s-jsoftware-aux-= files.drv' failed with exit code 1 build of /gnu/store/4zhrg7g17bqpmlgp5i58vbsc5g8xsl1s-jsoftware-aux-file= s.drv failed View build log at '/var/log/guix/drvs/4z/hrg7g17bqpmlgp5i58vbsc5g8xsl1s= -jsoftware-aux-files.drv.bz2'. cannot build derivation `/gnu/store/ax3nwc5xybqcirxadm4ynz99jsq3l3j7-js= oftware-j-903.a.drv': 1 dependencies couldn't be built guix build: error: build of `/gnu/store/ax3nwc5xybqcirxadm4ynz99jsq3l3j= 7-jsoftware-j-903.a.drv' failed Running `stat ` from the command line on the offending path succeeds = as expected, and moving the 'search-auxiliary-file' out of the file-union and into the package inputs lets the build proceed. I'm stumped. Attached is the package definition, for reference. > Don't worry, I don't plan to drag this out too long, but I also don't > planning on pushing this today. There are definitely some stylistic > choices that I want to make under the considerations here (basically, > we can just merge major and minor into a single base that'd be "903.a", > for example), but it's almost bedtime and I want to relax a little > before going to sleep. Sure. I'm mostly just way out of my depth here, getting sent on deep rabbit-holes every time you respond give me some feedback to chew on. :P Definitely down for some stylistic improvements. Let me know! Hope you got some nice relaxation time in! ------_=_164079252dd080b57e5a8564_=_ Content-Disposition: attachment; filename=jsoftware.scm Content-Type: text/plain Content-Transfer-Encoding: quoted-printable ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2022 B. Wilson ;;; ;;; 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 . (define-module (gnu packages jsoftware) #:use-module (guix build utils) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages libedit) #:use-module (gnu packages llvm) #:use-module (gnu packages maths) #:use-module (guix gexp) #:use-module (ice-9 ftw) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (ice-9 rdelim) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-71)) ;;; TODO: Make importer and packages for J addons: ;;; http://www.jsoftware.com/jal/ ;;; TODO: Package up j80x series (define (jname prefix release-type) "Return a package name for J, including RELEASE-TYPE only if not 'release= ." (match release-type ('release prefix) (_ (string-append prefix "-" (symbol->string release-type))))) ;; We want a version string where packages specifications like pkg@MAJOR wo= rk. ;; This requires that the first version part separator be dot. Subsequent ;; separators are hyphen, mirror `git-version' etc. (define* (jversion->string major minor #:optional revision commit) "Return a version string formatted like MAJOR.MINOR-REVISION-COMMIT. Onl= y MAJOR is required, and MINOR defaults to ``0'' if not supplied." (let* ((commit (and commit (string-take commit 7))) (sub-parts (filter (cut (compose not eq?) #f <>) (list minor revision commit)))) (string-append major "." (string-join sub-parts "-")))) (define* (jrelease-string release-type #:optional version-minor) "Construct J release identifier string." (let ((release-type (symbol->string release-type))) (if version-minor (string-append release-type "-" version-minor) release-type))) (define* (jinfo->git-tag version-major release-type #:optional version-mino= r) "Given version parameters, construct a git tag for upstream releases." (string-append "j" version-major (jrelease-string release-type version-mi= nor))) (define jsoftware-aux-files (file-union "jsoftware-aux-files" ;; profilex.ijs overrides ~install and ~addons directories to reside u= nder ;; the user-writable ~user. This allows local-install of addons via ;; pacman. ;; TODO: Guix-ify J addons as well. `(("profilex.ijs" ,(search-auxiliary-file "jsoftware/profilex.ijs")) ;; Gexp script that detects AVX/AVX2 support at runtime and executes ;; jconsole with the appropriate libj.so and profile.ijs." ("ijconsole" ,(with-imported-modules '((guix cpu) (guix memoization) (guix profiling) (guix sets) (srfi srfi-26)) (program-file "ijconsole" #~(begin (use-modules ((guix cpu) #:select (cpu-flags current-cpu= )) ((guix sets) #:select (set-contains?)) ((srfi srfi-26) #:select (cute))) ;; Assume that this script will be installed under bin/. (define %basedir (dirname (dirname (current-filename)))) (let* ((jconsole (string-append %basedir "/libexec/j/jconsol= e")) (cpu-has-flag? (cute set-contains? (cpu-flags (current-cpu)) <>)) (libj (format #f "~a/lib/j/libj~a.so" %basedir (cond ((cpu-has-flag? "avx2") "-avx2") ((cpu-has-flag? "avx") "-avx") (else "")))) (jprofile (string-append %basedir "/etc/j/profile.ijs= "))) (apply execl jconsole "ijconsole" "-lib" libj "-jprofile" jprofile (cdr (command-line))))))))))) (define* (make-j #:key version revision hash tag commit (release-type 'release) (patches '()) (extra-inputs '()) (extra-envars '()) (builder "guix.gnu.org")) (let* ((version-major version-minor (if (pair? version) (car+cdr version) (values version #f)))) (package (name (jname "jsoftware-j" release-type)) (version (jversion->string version-major version-minor revision commit))= (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/jsoftware/jsource") (commit (or commit tag (jinfo->git-tag version-major release-type version-minor))))) (sha256 (base32 hash)) (file-name (git-file-name name version)) (patches patches))) (build-system gnu-build-system) (native-inputs (list clang-toolchain)) (inputs (cons* libedit libomp jsoftware-aux-files extra-inputs)) (arguments `(#:tests? #f #:modules (((ice-9 ftw) #:select (scandir)) ((ice-9 popen) #:select (open-pipe* close-pipe)) ((ice-9 regex) #:select (match:substring string-match)) ((ice-9 threads) #:select (parallel par-for-each)) ((srfi srfi-26) #:select (cut)) ((srfi srfi-1) #:select (fold)) ,@%gnu-build-system-modules) #:phases ;; Upstream's build system consists of ad-hoc scripts that build buil= d up ;; (very complicated) environment variables to pass to make. The bas= ic ;; build process looks like this: ;; ;; 1) Copy jsrc/jversion-x.h to jsrc/jversion.h and edit values; ;; 2) Set jplatform and j64x environment variables; ;; 3) Run make2/build_jconsole.sh and make2/build_libj.sh; ;; ;; However, upstream expects users to run J directly from the source ;; directory; they do not supply a make `install' target. Thus it ta= kes ;; some massaging to install files in FHS-style directories. (modify-phases %standard-phases ;; In particular, we have to set up ;; ;; 1) jsrc/jversion.h as in a typical build; ;; 2) jlibrary/bin/profilex.ijs to point to writable directories;= ;; 3) make2/build_*.sh to respect standard build conventions; ;; 4) jsrc/jconsole.c to fix libedit dlopen; and ;; 5) Hard coded references to addons directory. (replace 'configure (lambda* (#:key target inputs outputs #:allow-other-keys) (let* ((clang-toolchain (assoc-ref inputs "clang-toolchain")) (clang (string-append clang-toolchain "/bin/clang")) (libedit (assoc-ref inputs "libedit")) (out (assoc-ref outputs "out"))) ;; Set up build constants (copy-file "jsrc/jversion-x.h" "jsrc/jversion.h") (substitute* "jsrc/jversion.h" (("^#define jversion.*$") (format #f "#define jversion ~s\n" ,version-major)) (("^#define jtype.*$") (format #f "#define jtype ~s\n" ,(jrelease-string release-type version-minor))) (("^#define jbuilder.*$") (format #f "#define jbuilder ~s\n" ,builder))) ;; Munge the build scripts into reason: ;; 1. Short-circuit the fragile compiler detection; ;; 2. Make sure to include our CFLAGS and LFLAGS; and ;; 3. Propagate script errors to top level. (for-each (lambda (file) (with-directory-excursion "make2" (substitute* file ;; The `compiler' variable doesn't point to the actual= ;; compiler. It is just a switch to tell the build ;; scripts whether to use gcc- or clang-specific flags= =2E (("^compiler=3D.*$") "compiler=3Dclang\n") (("^LDFLAGS=3D\"" def) (string-append def "$LDFLAGS ")= ) (("^(common=3D\")(\\$USETHREAD.*)$" _ def rest) (string-append def "$CFLAGS " rest)) (("^#!.*" shebang) (string-append shebang "set -o errexit\n"))))) '("build_jconsole.sh" "build_libj.sh")) ;; The jconsole manually loads libedit with dlopen. The path= ;; must be absolute to correctly point to our input. (substitute* "jsrc/jconsole.c" (("libedit\\.so\\.[0-9]" so-file) (format #f "~a/lib/~a" libedit so-file))) ;; The ~addons/dev directory supplies tentative J-script ;; definitions of new J engine functionality. Since we point= ;; ~addons under the ~user directory, we move it under ~syste= m ;; instead, which sits as-is in the output. (with-directory-excursion "jsrc" (for-each (lambda (file) (substitute* file (("~addons/dev") "~system/dev"))) (scandir "." (lambda (f) (eq? (stat:type (stat f)) 'regular))))) ;; Implementation of 9!:14 records build time which breaks bu= ild ;; reproducibility. Note that upstream code depends on the e= xact ;; format of these strings, so we need to mimic the standard.= (substitute* "jsrc/j.c" (("__DATE__") "\"Jan 01 1970\"") (("__TIME__") "\"00:00:00\"")) ;; Upstream recommends using clang, with GCC support being ;; second-class, often resulting in build failures. (setenv "CC" clang)))) ;; The build output depends primarily on the values of the `jplatfo= rm' ;; and `j64x' environment variables. If the target is ARM, then ;; `jplatform' is "raspberry", otherwise it is `linux'. In additio= n to ;; 32- and 64- bit versions, `j64x' controlls whether AVX or AVX2 ;; variants of libj are built. ;; ;; However, build targets are not fine-grained enough to distinguis= h ;; between CPU features. Thus we build and install all variants of= ;; libj, expecting jconsole to be called with a wrapper script that= ;; detects AVX features and loads the appropriate libj at runtime. (replace 'build (lambda _ (setenv "USE_OPENMP" "1") (setenv "USE_THREAD" "1") (for-each (lambda (var-val) (apply setenv var-val)) (quote ,extra-envars)) ;; The build scripts assume that PWD is make2. (with-directory-excursion "make2" (let* ((platform ,(if (target-arm?) "raspberry" "linux")) (target-bit ,(if (target-64bit?) "64" "32")) (run (lambda* (script #:key (avx "")) (invoke "env" (string-append "jplatform=3D" platform)= (string-append "j64x=3Dj" target-bit av= x) script)))) (parallel ;; Since jconsole doesn't depend on AVX features, we just= ;; build it once. (run "./build_jconsole.sh") (run "./build_libj.sh") (if ,(target-64bit?) (parallel (run "./build_libj.sh" #:avx "avx") (run "./build_libj.sh" #:avx "avx2")))))))) ;; The test suite is expected to be run as follows for each variant= of ;; libj that we build: ;; ;; $ echo 'RUN ddall' | jconsole test/tsu.ijs ;; ;; This requires a working jconsole with accessible jlibrary files.= We ;; simply place these all under test/bin. (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? (let ((platform ,(if (target-arm?) "raspberry" "linux"))) (mkdir-p "test/bin") (for-each (lambda (dir) (let ((source (string-append "jlibrary/" dir)) (dest (string-append "test/bin/" dir))) (begin (mkdir-p dest) (copy-recursively source dest)))) '("system" "tools" "addons")) ;; The jlibrary/dev directory only sometimes exists, but ne= eds ;; to be copied into the ~system directory when it does. (for-each (lambda (dev-dir) (if (file-exists? dev-dir) (copy-recursively dev-dir "test/bin/system/dev"))) '("jlibrary/dev" "jlibrary/addons/dev")) (par-for-each (lambda (dir) (let* ((bin (string-append "bin/" platform)) (jbit ,(if (target-64bit?) "j64" "j32")) (jconsole (string-append bin "/" jbit "/jconsole")) (source (string-append bin "/" dir)) (dest (string-append "test/bin/" dir))) (begin (mkdir-p dest) (copy-recursively source dest) (install-file "jlibrary/bin/profile.ijs" dest) (install-file jconsole dest) (let* ((jconsole (string-append dest "/jconsole")) (tests "test/tsu.ijs") (port (open-pipe* OPEN_WRITE jconsole tests)= )) (display "RUN ddall\n" port) (when (not (zero? (status:exit-val (close-pipe port)))) (error "Some J build tests failed.")))))) (scandir (string-append "bin/" platform) (negate (cut member <> '("." ".."))))) #t)))) ;; Now that everything is built, installation is fairly ;; straightforward, following FHS conventions. The only quirk is t= hat ;; we install jconsole under /libexec to make room for the wrapper ;; replacement under /bin. (replace 'install (lambda* (#:key outputs inputs #:allow-other-keys) (let* ((platform ,(if (target-arm?) "raspberry" "linux")) (jbit ,(if (target-64bit?) "j64" "j32")) (out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (etc (string-append out "/etc/j")) (lib (string-append out "/lib/j")) (libexec (string-append out "/libexec/j")) (share (string-append out "/share/j")) (system (string-append share "/system")) (dev (string-append system "/dev"))) (mkdir-p bin) (copy-file (search-input-file inputs "ijconsole") (string-append bin "/ijconsole-" ,version-major)) (mkdir-p lib) (for-each (lambda (jarch) (let* ((jbin (string-join `("bin" ,platform ,jarch) "/"))= (javx-match (string-match "avx.*" jarch)) (javx (if (not javx-match) "" (match:substring javx-match))) (sep (if javx-match "-" "")) (source (string-append jbin "/libj.so")) (dest (format #f "~a/libj~a~a.so" lib sep javx))) (copy-file source dest))) (scandir (string-append "bin/" platform) (negate (cut member <> '("." ".."))))) (install-file (string-append "bin/" platform "/" jbit "/jcons= ole") libexec) (copy-recursively "jlibrary/system" system) (for-each (lambda (source-dev) (if (access? source-dev R_OK) (copy-recursively source-dev dev))) '("jlibrary/dev" "jlibrary/addons/dev")) (install-file "jlibrary/bin/profile.ijs" etc) (install-file (search-input-file inputs "profilex.ijs") etc))))))) (home-page "https://www.jsoftware.com/") (synopsis "Ascii-only, array programming language in the APL family") (description "J is a high-level, general-purpose programming language that is particularly suited to the mathematical, statistical, and logical analysis = of data. It is a powerful tool for developing algorithms and exploring proble= ms that are not already well understood.") (license license:gpl3+)))) (define-public jsoftware-j-901 (make-j #:version '("901" . "f") #:hash "1776021m0j1aanzwg60by83n53pw7i6afd5wplfzczwk8bywax4p" #:patches (search-patches "jsoftware-j901-f-fixes.patch"))) (define j-build-configuration-with-sleef `(#:extra-inputs (,sleef) #:extra-envars (("USE_SLEEF_SRC" "0") ("LDFLAGS" "-lsleef")))) (define-public jsoftware-j-902 (apply make-j (append j-build-configuration-with-sleef `(#:version ,'("902" . "b") #:hash "0j67vgikqflwjqacsdicasvyv1k54s2c8vjgwmf0ix7l41p4xqz0")))) (define-public jsoftware-j-903 (apply make-j (append j-build-configuration-with-sleef `(#:version ,'("903" . "a") #:tag "903-release-a" #:hash "1fcfl7q7c2vj4fmnqqc8c6hwgsjm20ff93v8xxfniasss1b2fmc4")))) (define-public (jsoftware-ijconsole-symlink jpkg) "Provide bin/ijconsole symlink that points to pkg's bin/ijconsole-" (package (name "jsoftware-ijconsole") (version (package-version jpkg)) (source #f) (build-system trivial-build-system) (propagated-inputs `(("jpkg" ,jpkg))) (arguments `(#:modules ((guix build utils) (srfi srfi-26)) #:builder (begin (use-modules ((guix build utils) #:select (mkdir-p)) ((ice-9 regex) #:select (string-match)) ((ice-9 ftw) #:select (scandir)) ((srfi srfi-26) #:select (cut))) (let* ((out (assoc-ref %outputs "out")) (jpkg (assoc-ref %build-inputs "jpkg")) (ijconsole (car (scandir (string-append jpkg "/bin") (cut string-match "ijconsole-.*" <>)= ))) (source (string-append jpkg "/bin/" ijconsole)) (dest (string-append out "/bin/ijconsole"))) (mkdir-p (dirname dest)) (symlink source dest))))) (home-page (package-home-page jpkg)) (synopsis "Provide `ijconsole' symlink to default interpreter version") (description "The interpreter provided by the J package has a filename like ijconsole-, which provides support for having multiple, concurrent= versions installed. This package provides a version-agnostic `ijconsole' symlink to interpreter version indicated and build time.") (license license:gpl3+))) ------_=_164079252dd080b57e5a8564_=_--