From patchwork Fri Feb 7 09:40:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andreas Enge X-Patchwork-Id: 38337 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D36FB27BBEA; Fri, 7 Feb 2025 09:41:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A386B27BBE2 for ; Fri, 7 Feb 2025 09:41:40 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgKrD-00055c-Pp; Fri, 07 Feb 2025 04:41:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tgKr8-00054M-Fd for guix-patches@gnu.org; Fri, 07 Feb 2025 04:41:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgKr8-0001sx-4F for guix-patches@gnu.org; Fri, 07 Feb 2025 04:41:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:MIME-Version:References:From:Date:To:Subject; bh=eLoxMZyNHt2fyCmH4V4eMHZYAhXF578utGJMm9O6zDs=; b=ZpTNWn6LNm+/bnL+B/mg/tJmc38lDmvfSAsis/3+dCQNpW8YYxm277hEz6Da+epTlJxXVSun39j3kE+zrbU7ed14ClZu1/roMs8lhanmMdnochnP+e4Gqi4Y+a4HnLHAhm4RVd2gWq3W2kLLEc2ZjwkZpoSJT6N3vjbBcz7npiFkXi3m49SvmmiAjyGNqIDIsnNSyjXwrYMT7mJo78oflsqcuNTM0NCrb8vpqcGW1F5uaM4PpHLfpokvztTIPA2v/75kisDGGGTLilNQl4bqa7sUWpRI3aByorVy6snO6YFY0fksgq+GpPE0evuI5E77SbOBElbPeWjNSd+rc1H+iw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tgKr7-0000SX-Ni for guix-patches@gnu.org; Fri, 07 Feb 2025 04:41:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#66606] [PATCH v3] gnu: Add reduce-csl. Resent-From: Andreas Enge Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 07 Feb 2025 09:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66606 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Nigko Yerden Cc: 66606@debbugs.gnu.org, efraim@flashner.co.il, bavier@posteo.net Received: via spool by 66606-submit@debbugs.gnu.org id=B66606.17389212501738 (code B ref 66606); Fri, 07 Feb 2025 09:41:01 +0000 Received: (at 66606) by debbugs.gnu.org; 7 Feb 2025 09:40:50 +0000 Received: from localhost ([127.0.0.1]:32858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tgKqt-0000Rs-88 for submit@debbugs.gnu.org; Fri, 07 Feb 2025 04:40:50 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:59614) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tgKqo-0000RW-F9 for 66606@debbugs.gnu.org; Fri, 07 Feb 2025 04:40:45 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D081B2D0; Fri, 7 Feb 2025 10:40:35 +0100 (CET) Authentication-Results: hera.aquilenet.fr; none X-Virus-Scanned: Debian amavis at hera.aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP id uycd74gt-HqX; Fri, 7 Feb 2025 10:40:33 +0100 (CET) Received: from jurong (176-179-191-150.abo.bbox.fr [176.179.191.150]) by hera.aquilenet.fr (Postfix) with ESMTPSA id E6806A52; Fri, 7 Feb 2025 10:40:32 +0100 (CET) Date: Fri, 7 Feb 2025 10:40:31 +0100 From: Andreas Enge Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Action: add header X-Rspamd-Server: hera X-Rspamd-Queue-Id: D081B2D0 X-Spamd-Bar: ++++++ X-Spamd-Result: default: False [6.88 / 15.00]; SPAM_FLAG(5.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_SPAM(2.98)[0.993]; SUSPICIOUS_RECIPS(1.50)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; HAS_ATTACHMENT(0.00)[]; TAGGED_RCPT(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; ARC_NA(0.00)[] X-Spam: Yes 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hello, Am Thu, Feb 06, 2025 at 09:40:11PM +0500 schrieb Nigko Yerden: > I rewrote this old patch. New patch provides > 1. Updated package revision number 6860 (was 6547). > 2. Apparent reproducibility of the package. > 3. 'check' build phase for running tests. > 4. Unbundled libffi. thanks for sending the new patch, and so quickly; I did not expect unbundling of libffi to require so much work! And running tests is also good. I have moved the package from the maths to the algebra module (which is more specific). The patch needs to be registered in local.mk. I would also suggest to use the snapshot date and not the svn commit as the version number, since it is more telling (and also appears "higher up" in the file hierarchy on their site). And maybe call the package just "reduce" instead of "reduce-csl"? I wondered whether we should also compile with psl (using "--with-both" instead of "--with-csl"); but I suppose that this would just create a duplicate? It is a bit surprising to first use "--without-autogen" and then call autogen in a separate phase, but I tried to drop both, and this caused an error. The package compiles, and I could run reduce with a few of the examples from their website. Are you okay with the patch as attached, or would you prefer to handle differently some changes I made? Andreas From fd80b9f9f53326f9855379244c96aabbc122d08d Mon Sep 17 00:00:00 2001 Message-ID: From: Nigko Yerden Date: Thu, 6 Feb 2025 21:40:11 +0500 Subject: [PATCH] gnu: Add reduce. * gnu/packages/math.scm (reduce): New variable. * gnu/packages/patches/reduce-unbundle-libffi.patch: New file. * gnu/local.mk (dist_patch_DATA): Register file. Change-Id: Ic85be7dc490f005f7ba65c418250cc9681fbb3a8 Signed-off-by: Andreas Enge --- gnu/local.mk | 1 + gnu/packages/algebra.scm | 106 +++++++++++++++ .../patches/reduce-unbundle-libffi.patch | 125 ++++++++++++++++++ 3 files changed, 232 insertions(+) create mode 100644 gnu/packages/patches/reduce-unbundle-libffi.patch base-commit: 2a4bba2249a71e928bd612d47b6ef439dc498c9c diff --git a/gnu/local.mk b/gnu/local.mk index 83abc86fe2..ac19734a3e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2167,6 +2167,7 @@ dist_patch_DATA = \ %D%/packages/patches/rtags-separate-rct.patch \ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ %D%/packages/patches/racket-rktio-bin-sh.patch \ + %D%/packages/patches/reduce-unbundle-libffi.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restartd-update-robust.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm index 90b7e32088..9ca866e4dc 100644 --- a/gnu/packages/algebra.scm +++ b/gnu/packages/algebra.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Mehmet Tekman ;;; Copyright © 2025 Sharlatan Hellseher +;;; Copyright © 2025 Nigko Yerden ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,6 +37,7 @@ (define-module (gnu packages algebra) #:use-module (gnu packages) #:use-module (gnu packages autotools) + #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages bison) #:use-module (gnu packages boost) @@ -46,14 +48,17 @@ (define-module (gnu packages algebra) #:use-module (gnu packages documentation) #:use-module (gnu packages flex) #:use-module (gnu packages fltk) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) #:use-module (gnu packages gl) #:use-module (gnu packages graphviz) #:use-module (gnu packages image) #:use-module (gnu packages java) + #:use-module (gnu packages libffi) #:use-module (gnu packages maths) #:use-module (gnu packages mpi) #:use-module (gnu packages multiprecision) + #:use-module (gnu packages ncurses) #:use-module (gnu packages networking) #:use-module (gnu packages ocaml) #:use-module (gnu packages perl) @@ -1875,3 +1880,104 @@ (define-public parform (description (string-append (package-description form) " This package also includes @code{parform}, a version of FORM parallelized using OpenMPI.")))) + +(define-public reduce + (package + (name "reduce") + (version "2024-08-12") + (source (origin + (method url-fetch) + (uri (string-append + "mirror://sourceforge/reduce-algebra/snapshot_" + version "/Reduce-svn6860-src.tar.gz")) + (sha256 + (base32 + "13bij9d4dj96vd5di59skz77s2fihj7awmkx403fvh9rd04ly25z")) + (modules '((guix build utils))) + (patches (search-patches "reduce-unbundle-libffi.patch")) + ;; remove binaries and unnecessary parts + ;; to ensure we build from source files only + (snippet '(map delete-file-recursively + (append (find-files "csl/generated-c" "\\.img$") + '("psl" "vsl" + "jlisp" + "jslisp" + "libedit" + "macbuild" + "MacPorts" + "mac-universal" + "reduce2" + "winbuild64" + "common-lisp" + "contrib" + "generic/qreduce" + "web/htdocs/images/Thumbs.db") + (find-files "csl" + "^(embedded|new-embedded|winbuild|support-packages)$" + #:directories? #t) + (find-files "libraries" + "^(original|wineditline|libffi|libffi-for-mac)$" + #:directories? #t)))))) + (build-system gnu-build-system) + (arguments + (list #:configure-flags + #~(list "--without-autogen" + ;; fix conflict with internal build name determination + "--build=" + "--with-csl" + (string-append "CPPFLAGS=-I" + #$freetype + "/include/freetype2")) + #:make-flags #~(list "csl") + #:phases + #~(modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "scripts/testall.sh" "--csl" "--noregressions")))) + (add-before 'patch-source-shebangs 'autogen + (lambda _ + (invoke "sh" "autogen.sh"))) + (add-after 'install 'fix-install + (lambda _ + (copy-file "bin/rfcsl" + (string-append #$output "/bin/rfcsl")) + (copy-file "generic/newfront/redfront.1" + (string-append #$output + "/share/man/man1/rfcsl.1")) + (let ((.desktop-file + "debianbuild/reduce/debian/redcsl.desktop") + (icon "debianbuild/reduce/debian/reduce.png")) + (install-file .desktop-file + (string-append #$output + "/share/applications")) + (install-file icon + (string-append + #$output + "/share/icons/hicolor/32x32/apps"))) + (with-directory-excursion #$output + (map (lambda (dir) + (map (lambda (file) + (chmod file #o444)) + (find-files dir))) + '("share/man/man1" "share/reduce/fonts")))))))) + (native-inputs (list autoconf automake libtool which)) + (inputs + ;; bundled libraries: fox (adjusted) editline (adjusted) + ;; crlibm softfloat + (list freetype libffi libx11 libxext libxft ncurses)) + (synopsis "Portable general-purpose computer algebra system") + (description + "REDUCE is a portable general-purpose computer algebra system. It is a +system for doing scalar, vector and matrix algebra by computer, which also +supports arbitrary precision numerical approximation and interfaces to +gnuplot to provide graphics. It can be used interactively for simple +calculations but also provides a full programming language, with a syntax +similar to other modern programming languages. REDUCE supports alternative +user interfaces including Run-REDUCE, TeXmacs and GNU Emacs. This package +provides the Codemist Standard Lisp (CSL) version of REDUCE. It uses the +gnuplot program, if installed, to draw figures.") + (home-page "https://reduce-algebra.sourceforge.io/") + (license (license:non-copyleft "file://README" + "See README in the distribution.")))) + diff --git a/gnu/packages/patches/reduce-unbundle-libffi.patch b/gnu/packages/patches/reduce-unbundle-libffi.patch new file mode 100644 index 0000000000..21529840b6 --- /dev/null +++ b/gnu/packages/patches/reduce-unbundle-libffi.patch @@ -0,0 +1,125 @@ +This patch unbundles libffi. + +Index: autogen.sh +=================================================================== +diff --git a/autogen.sh b/autogen.sh +--- a/autogen.sh (revision 6860) ++++ b/autogen.sh (working copy) +@@ -142,18 +142,6 @@ + ;; + *--with-csl* | *--with-both*) + L="$L ./csl ./csl/cslbase ./csl/cslbase-nothrow ./libraries/SoftFloat-3a/source" +-# On Apple m1 (ie arm64) I will want to build a universal version of the +-# libffi library and that is done in a way that differs from standrad builds. +- case "`uname -s` `uname -m`" in +- *Darwin*arm64*) +- L="$L ./libraries/libffi-for-mac/libffi-3.3-arm64" +- L="$L ./libraries/libffi-for-mac/libffi-3.3-x86_64" +- L="$L ./libraries/libffi" +- ;; +- *) +- L="$L ./libraries/libffi" +- ;; +- esac + case $a in + *--without-fox* | *with-fox=no* | \ + *--without-gui* | *with-gui=no*) +Index: configure.ac +=================================================================== +diff --git a/configure.ac b/configure.ac +--- a/configure.ac (revision 6860) ++++ b/configure.ac (working copy) +@@ -1389,37 +1389,6 @@ + cd "$builddir" + fi + +-AC_MSG_NOTICE([About to configure libffi]) +-mkdir -p libffi +-if test `uname` = "Darwin" && test "$enable_universal" != "no" +-then +-# This is a messy script that arranges to build a universal version of +-# the library on MacOS. It does this by building arm64 and an x86_64 +-# separately and then merging the resulting libraries. +- sed "s+@srcdir@+$abssrcdir+" \ +- < $abssrcdir/libraries/libffi-for-mac/Makefile \ +- > libffi/Makefile +-else +- cd libffi +- setpasscc +- doconfig="$SHELL $abssrcdir/libraries/libffi/configure -C $filtered \ +- $pass_host \ +- CPPFLAGS=\"$CPPFLAGS\" \ +- CFLAGS=\"$CFLAGS\" \ +- CXXFLAGS=\"$CXXFLAGS\" \ +- LDFLAGS=\"$LDFLAGS\" \ +- $passcc \ +- --disable-multi-os-directory \ +- --disable-docs \ +- --prefix=\"$builddir\" \ +- --libdir=\"$builddir/lib\" \ +- --includedir=\"$builddir/include\"" +- AC_MSG_NOTICE([doconfig = $doconfig]) +- printf "\n\n+++ About to configure libffi +++\n\n" +- eval "$doconfig" +- cd "$builddir" +-fi +- + AC_MSG_NOTICE([About to configure libsoftfloat]) + mkdir -p softfloat + cd softfloat +Index: csl/cslbase/Makefile.am +=================================================================== +diff --git a/csl/cslbase/Makefile.am b/csl/cslbase/Makefile.am +--- a/csl/cslbase/Makefile.am (revision 6860) ++++ b/csl/cslbase/Makefile.am (working copy) +@@ -807,35 +807,6 @@ + + endif !crlibm + +-LIBFFIDEPS=../lib/libffi.a ../include/ffi.h +- +-FFIDEP = ../include/ffi.h +-FFIINC = -I../include +-AM_CPPFLAGS += $(FFINC) +-reduce_CPPFLAGS += $(FFINC) +-bootstrapreduce_CPPFLAGS += $(FFINC) +-csl_CPPFLAGS += $(FFINC) +-flatcsl_CPPFLAGS += $(FFINC) +- +-# The following ugly dependencies are here so that one can go, for +-# instance, "make csl.o" in a clean tree and libffi building will get +-# triggered. +- +- +-csl_LDADD += ../lib/libffi.a +-flatcsl_LDADD += ../lib/libffi.a +-bootstrapreduce_LDADD += ../lib/libffi.a +-reduce_LDADD += ../lib/libffi.a +- +-csl_DEPENDENCIES += $(LIBFFIDEPS) +-flatcsl_DEPENDENCIES += $(LIBFFIDEPS) +-bootstrapreduce_DEPENDENCIES += $(LIBFFIDEPS) +-reduce_DEPENDENCIES += $(LIBFFIDEPS) +- +-$(LIBFFIDEPS): +- @printf "About to build libffi for %s ($@)\n" `pwd` +- -$(TRACE)@$(MAKE) -C ../libffi install +- + SOFTFLOATDEPS=../lib/libsoftfloat.a ../include/softfloat.h + + SOFTFLOATDEP = ../include/softfloat.h +Index: csl/cslbase/configure.ac +=================================================================== +diff --git a/csl/cslbase/configure.ac b/csl/cslbase/configure.ac +--- a/csl/cslbase/configure.ac (revision 6860) ++++ b/csl/cslbase/configure.ac (working copy) +@@ -146,8 +146,8 @@ + AC_DEFINE(WITHOUT_FFI, [1], [remove the foreign function support]) + fi + ++AC_SEARCH_LIBS([ffi_call], [ffi]) + +- + # What host am I on? + AC_CANONICAL_HOST() +