This is an automated email from the git hooks/post-receive script.
andreas pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new 44c737c7c1 gnu: Add reduce.
44c737c7c1 is described below
commit 44c737c7c16497741011616204420f5f6e717050
Author: Nigko Yerden <[email protected]>
AuthorDate: Thu Feb 6 21:40:11 2025 +0500
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 <[email protected]>
---
gnu/local.mk | 1 +
gnu/packages/algebra.scm | 106 ++++++++++++++++++
gnu/packages/patches/reduce-unbundle-libffi.patch | 125 ++++++++++++++++++++++
3 files changed, 232 insertions(+)
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 <[email protected]>
;;; Copyright © 2023 Mehmet Tekman <[email protected]>
;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
+;;; Copyright © 2025 Nigko Yerden <[email protected]>
;;;
;;; 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 @@
#: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 @@ and not by the available RAM.")
(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()
+