[PATCH] gnu: Add calc.

  • Done
  • quality assurance status badge
Details
2 participants
  • Andreas Enge
  • Distopico
Owner
unassigned
Submitted by
Distopico
Severity
normal
D
D
Distopico wrote on 17 Jul 2023 20:36
(address . guix-patches@gnu.org)
87edl6bctv.fsf@riseup.net
Adds `calc` package, an console calculator and mathematical tool.

* gnu/packages/maths.scm (calc): New variable.
---
gnu/packages/maths.scm | 58 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)

Toggle diff (78 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index b9b63c81c1..c5e0da4328 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -60,6 +60,7 @@
;;; Copyright © 2022 Akira Kyle <akira@akirakyle.com>
;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -261,6 +262,63 @@ (define-public c-graph
(license license:gpl3+)
(home-page "https://www.gnu.org/software/c-graph/")))
+(define-public calc
+ (package
+ (name "calc")
+ (version "2.14.1.6")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.isthe.com/chongo/src/calc/calc-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "0h3zsqwpbwddv28khg1fk00ydk6sxvdig085lvi1s63d544b6nff"))))
+ (build-system gnu-build-system)
+ (inputs (list readline))
+ (native-inputs (list util-linux))
+ (outputs '("out"))
+ (arguments
+ '(#:make-flags (let ((out (assoc-ref %outputs "out")))
+ (list "DEBUG="
+ "USE_READLINE=-DUSE_READLINE"
+ "READLINE_LIB=-lreadline"
+ "READLINE_EXTRAS=-lhistory -lncurses"
+ (string-append "DEFAULT_LIB_INSTALL_PATH=" out
+ "/lib")
+ (string-append "T=" out)))
+ #:phases (modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'patch-makefile-ldflags
+ (lambda _
+ (substitute* "Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCALC_SHLIB}"))
+ (substitute* "custom/Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCUSTCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCUSTCALC_SHLIB}"))))
+ (add-before 'build 'patch-guixnization
+ (lambda _
+ (for-each (lambda (file)
+ (substitute* file
+ (("(open source|open software)")
+ "Free Software")))
+ (list "calc.c" "version.c" "calc.man"))))
+ (add-before 'build 'patch-makefile-prefix
+ (lambda _
+ (substitute* "Makefile"
+ ;; Replace becase there is more or less
+ ;; 5 Makefile vars with /usr as default prefix
+ (("=\\s?/usr/")
+ "= /")))))))
+ (synopsis "Arbitrary precision console calculator")
+ (description
+ "Calc is an arbitrary precision arithmetic system that uses a C-like language,
+It's useful as a calculator, an algorithm prototyper and as a mathematical research tool.
+More importantly, calc provides one with a machine independent means of computation.
+Calc comes with a rich set of builtin mathematical and programmatic functions.")
+ (home-page "http://www.isthe.com/chongo/tech/comp/calc/")
+ (license license:lgpl2.1)))
+
(define-public coda
(package
(name "coda")
--
2.41.0
D
D
Distopico wrote on 18 Jul 2023 13:28
[PATCH v2] gnu: Add calc.
(address . 64688@debbugs.gnu.org)(name . Distopico)(address . distopico@riseup.net)
20230718112911.31050-1-distopico@riseup.net
* gnu/packages/maths.scm (calc): New variable.
---
Remove unnecesary open/libre substitute.

gnu/packages/maths.scm | 51 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)

Toggle diff (71 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index b9b63c81c1..a8ddf0a514 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -60,6 +60,7 @@
;;; Copyright © 2022 Akira Kyle <akira@akirakyle.com>
;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -261,6 +262,56 @@ (define-public c-graph
(license license:gpl3+)
(home-page "https://www.gnu.org/software/c-graph/")))
+(define-public calc
+ (package
+ (name "calc")
+ (version "2.14.1.6")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.isthe.com/chongo/src/calc/calc-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "0h3zsqwpbwddv28khg1fk00ydk6sxvdig085lvi1s63d544b6nff"))))
+ (build-system gnu-build-system)
+ (inputs (list readline))
+ (native-inputs (list util-linux))
+ (outputs '("out"))
+ (arguments
+ '(#:make-flags (let ((out (assoc-ref %outputs "out")))
+ (list "DEBUG="
+ "USE_READLINE=-DUSE_READLINE"
+ "READLINE_LIB=-lreadline"
+ "READLINE_EXTRAS=-lhistory -lncurses"
+ (string-append "DEFAULT_LIB_INSTALL_PATH=" out
+ "/lib")
+ (string-append "T=" out)))
+ #:phases (modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'patch-makefile-ldflags
+ (lambda _
+ (substitute* "Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCALC_SHLIB}"))
+ (substitute* "custom/Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCUSTCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCUSTCALC_SHLIB}"))))
+ (add-before 'build 'patch-makefile-prefix
+ (lambda _
+ (substitute* "Makefile"
+ ;; Replace becase there is more or less
+ ;; 5 Makefile vars with /usr as default prefix
+ (("=\\s?/usr/")
+ "= /")))))))
+ (synopsis "Arbitrary precision console calculator")
+ (description
+ "Calc is an arbitrary precision arithmetic system that uses a C-like language,
+It's useful as a calculator, an algorithm prototyper and as a mathematical research tool.
+More importantly, calc provides one with a machine independent means of computation.
+Calc comes with a rich set of builtin mathematical and programmatic functions.")
+ (home-page "http://www.isthe.com/chongo/tech/comp/calc/")
+ (license license:lgpl2.1)))
+
(define-public coda
(package
(name "coda")
--
2.41.0
D
D
Distopico wrote on 23 Jul 2023 23:52
[PATCH v3] gnu: Add calc.
(address . 64688@debbugs.gnu.org)(name . Distopico)(address . distopico@riseup.net)
20230723215710.2037-1-distopico@riseup.net
* gnu/packages/maths.scm (calc): New variable.
---
Fyx typo

gnu/packages/maths.scm | 51 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)

Toggle diff (71 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index b9b63c81c1..3937e9118a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -60,6 +60,7 @@
;;; Copyright © 2022 Akira Kyle <akira@akirakyle.com>
;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -261,6 +262,56 @@ (define-public c-graph
(license license:gpl3+)
(home-page "https://www.gnu.org/software/c-graph/")))
+(define-public calc
+ (package
+ (name "calc")
+ (version "2.14.1.6")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.isthe.com/chongo/src/calc/calc-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "0h3zsqwpbwddv28khg1fk00ydk6sxvdig085lvi1s63d544b6nff"))))
+ (build-system gnu-build-system)
+ (inputs (list readline))
+ (native-inputs (list util-linux))
+ (outputs '("out"))
+ (arguments
+ '(#:make-flags (let ((out (assoc-ref %outputs "out")))
+ (list "DEBUG="
+ "USE_READLINE=-DUSE_READLINE"
+ "READLINE_LIB=-lreadline"
+ "READLINE_EXTRAS=-lhistory -lncurses"
+ (string-append "DEFAULT_LIB_INSTALL_PATH=" out
+ "/lib")
+ (string-append "T=" out)))
+ #:phases (modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'patch-makefile-ldflags
+ (lambda _
+ (substitute* "Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCALC_SHLIB}"))
+ (substitute* "custom/Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCUSTCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCUSTCALC_SHLIB}"))))
+ (add-before 'build 'patch-makefile-prefix
+ (lambda _
+ (substitute* "Makefile"
+ ;; Replace because there is more or less
+ ;; 5 Makefile vars with /usr as default prefix
+ (("=\\s?/usr/")
+ "= /")))))))
+ (synopsis "Arbitrary precision console calculator")
+ (description
+ "Calc is an arbitrary precision arithmetic system that uses a C-like language,
+It's useful as a calculator, an algorithm prototyper and as a mathematical research tool.
+More importantly, calc provides one with a machine independent means of computation.
+Calc comes with a rich set of builtin mathematical and programmatic functions.")
+ (home-page "http://www.isthe.com/chongo/tech/comp/calc/")
+ (license license:lgpl2.1)))
+
(define-public coda
(package
(name "coda")
--
2.41.0
D
D
Distopico wrote on 24 Jul 2023 17:27
Re: [bug#64688] [PATCH v2] gnu: Add calc.
(address . 64688@debbugs.gnu.org)(name . Andreas Enge)(address . andreas@enge.fr)
87lef5nxbb.fsf@riseup.net
On 2023-07-24, Andreas Enge <andreas@enge.fr> wrote:

Toggle quote (7 lines)
> Hello,
>
> just a few quick comments, as I do not have the time to look at the
> package in detail.
>
> Am Tue, Jul 18, 2023 at 06:28:14AM -0500 schrieb Distopico:
>> + (outputs '("out"))
Done, removed

Toggle quote (8 lines)
>
> This is the default and can thus be dropped.
>
>> + '(#:make-flags (let ((out (assoc-ref %outputs "out")))
>
> This should probably be done with a gexp nowadays, but I do not know how;
> I suppose there are examples to look up.
>
Changed, thank you

Toggle quote (19 lines)
>> + (add-before 'build 'patch-makefile-prefix
>> + (lambda _
>> + (substitute* "Makefile"
>> + ;; Replace becase there is more or less
>> + ;; 5 Makefile vars with /usr as default prefix
>> + (("=\\s?/usr/")
>> + "= /")))))))
>
> This is strange. The Makefile sets a variable PREFIX, but later uses
> things like
> BINDIR= /usr/bin
> except for MacOS, where it uses
> BINDIR= ${PREFIX}/bin
> This line even appears in the general case, but is commented out, which
> makes no sense.
>
> Maybe this could be discussed with upstream? It is also like this in the
> latest release 2.14.2.0.
>
Yeah, maybe, not big fan of github but I'll try to contact upstream
in other way, ¿it would be a blocker to add this patch to guix?
-----BEGIN PGP SIGNATURE-----

iQFJBAEBCAAzFiEEvYwofabWO6y953lVmAk6gHJUa/MFAmS+mJgVHGRpc3RvcGlj
b0ByaXNldXAubmV0AAoJEJgJOoByVGvzxSgH/jji9PN5vGzxyPmCs2H07nXZC/0W
IHtO8oDTnIRLjQlCfHiWgSprmQp1eGAWtgyYtJeE8Z6UqGjK4NLK9pj0jgQ7VnuD
PDngzzLE8fkjBHQsHtWTrqVMVxpjj0XLjUF9xzxDZzQXI9bOsGRW9RIkLRN8iSyk
lMdAEVkRaIvTz67ps0AR6nU5nM/A6w7T5/YViXVjXCt0w2TUMslBpgFpnVdZMet7
R9vulRVmrsebOHVwCO51oNHDL87tKqUHa/8XKxKP47G0FKfM7oZ1aX6NsouDD7//
qK8JT6uj0vIi/I/ITREgpp+rd3wTwZOBAmmCqHcZdot1niY09XhIxl3EeAg=
=1C/d
-----END PGP SIGNATURE-----

D
D
Distopico wrote on 24 Jul 2023 17:31
[PATCH v3] gnu: Add calc.
(address . 64688@debbugs.gnu.org)
20230724153210.12545-1-distopico@riseup.net
* gnu/packages/maths.scm (calc): New variable.
---
Change make-flags to use gexp and remove unncesary output
gnu/packages/maths.scm | 50 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index b9b63c81c1..9c0c98db56 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -60,6 +60,7 @@
;;; Copyright © 2022 Akira Kyle <akira@akirakyle.com>
;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
+;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -261,6 +262,55 @@ (define-public c-graph
(license license:gpl3+)
(home-page "https://www.gnu.org/software/c-graph/")))
+(define-public calc
+ (package
+ (name "calc")
+ (version "2.14.1.6")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.isthe.com/chongo/src/calc/calc-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "0h3zsqwpbwddv28khg1fk00ydk6sxvdig085lvi1s63d544b6nff"))))
+ (build-system gnu-build-system)
+ (inputs (list readline))
+ (native-inputs (list util-linux))
+ (arguments
+ (list
+ #:make-flags #~(list "DEBUG="
+ "USE_READLINE=-DUSE_READLINE"
+ "READLINE_LIB=-lreadline"
+ "READLINE_EXTRAS=-lhistory -lncurses"
+ (string-append "DEFAULT_LIB_INSTALL_PATH=" #$output
+ "/lib")
+ (string-append "T=" #$output))
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'patch-makefile-ldflags
+ (lambda _
+ (substitute* "Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCALC_SHLIB}"))
+ (substitute* "custom/Makefile"
+ (("\\$\\{CC\\}\\s+\\$\\{LIBCUSTCALC_SHLIB\\}")
+ "${CC} ${LDFLAGS} ${LIBCUSTCALC_SHLIB}"))))
+ (add-before 'build 'patch-makefile-prefix
+ (lambda _
+ (substitute* "Makefile"
+ ;; Replace because there is more or less
+ ;; 5 Makefile vars with /usr as default prefix
+ (("=\\s?/usr/")
+ "= /")))))))
+ (synopsis "Arbitrary precision console calculator")
+ (description
+ "Calc is an arbitrary precision arithmetic system that uses a C-like language,
+It's useful as a calculator, an algorithm prototyper and as a mathematical research tool.
+More importantly, calc provides one with a machine independent means of computation.
+Calc comes with a rich set of builtin mathematical and programmatic functions.")
+ (home-page "http://www.isthe.com/chongo/tech/comp/calc/")
+ (license license:lgpl2.1)))
+
(define-public coda
(package
(name "coda")
--
2.41.0
A
A
Andreas Enge wrote on 26 Jul 2023 11:52
Re: [PATCH v4] gnu: Add calc.
(name . Distopico)(address . distopico@riseup.net)(address . 64688@debbugs.gnu.org)
ZMDs27eDW5SPa_7N@jurong
Hello,

as there has been a new stable release in the meantime, I updated to this.
I also simplified the package a bit, maybe due to the new release one
substitute did not apply any more, another one did not seem to be necessary
regardless, and several "substitute*" on the same file can be combined into
one expression. I then set PREFIX and used it in a substitution, which
makes some CFLAGS unnecessary, and others are there by default in the
current Makefile. Finally I made the description a bit more neutral.

The resulting calc binary seems to work, if you are happy with the
package, I could push it.

Andreas
From e73a154f281e81f9c2bb9c4655dada1ef7df0e48 Mon Sep 17 00:00:00 2001
Message-ID: <e73a154f281e81f9c2bb9c4655dada1ef7df0e48.1690364856.git.andreas@enge.fr>
From: Distopico <distopico@riseup.net>
Date: Mon, 24 Jul 2023 10:31:24 -0500
Subject: [PATCH] gnu: Add calc.

* gnu/packages/maths.scm (calc): New variable.

Co-authored-by: Andreas Enge <andreas@enge.fr>
---
gnu/packages/maths.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 8c30e49d8f..dd17141c28 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -60,6 +60,7 @@
;;; Copyright ᅵ 2022 Akira Kyle <akira@akirakyle.com>
;;; Copyright ᅵ 2022 Roman Scherer <roman.scherer@burningswell.com>
;;; Copyright ᅵ 2023 Jake Leporte <jakeleporte@outlook.com>
+;;; Copyright ᅵ 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -261,6 +262,39 @@ (define-public c-graph
(license license:gpl3+)
(home-page "https://www.gnu.org/software/c-graph/")))
+(define-public calc
+ (package
+ (name "calc")
+ (version "2.14.2.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.isthe.com/chongo/src/calc/calc-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "0kg7cqhq70dlj7k8mrl0dbps1yvflfhri7c1gvm9nh4g2adlkxkf"))))
+ (build-system gnu-build-system)
+ (inputs (list readline))
+ (native-inputs (list util-linux)) ; for col
+ (arguments
+ (list #:phases #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'patch-makefile
+ (lambda _
+ (substitute* "Makefile"
+ (("^PREFIX= /usr/local")
+ (string-append "PREFIX=" #$output))
+ (("=\\s?/usr")
+ "= ${PREFIX}")))))))
+ (synopsis "Arbitrary precision console calculator")
+ (description
+ "Calc is an arbitrary precision arithmetic system that uses a C-like
+language. It can be used as a calculator, an algorithm prototyper and as
+a mathematical research tool, and it comes with built in mathematical and
+programmatic functions.")
+ (home-page "http://www.isthe.com/chongo/tech/comp/calc/")
+ (license license:lgpl2.1)))
+
(define-public coda
(package
(name "coda")

base-commit: 713dca1399cda2439af75989510f86718741a4ff
--
2.41.0
D
D
Distopico wrote on 26 Jul 2023 16:27
(name . Andreas Enge)(address . andreas@enge.fr)(address . 64688@debbugs.gnu.org)
87ila63fz7.fsf@riseup.net
Tested, works fine from my side, thank you

On 2023-07-26, Andreas Enge <andreas@enge.fr> wrote:

Toggle quote (16 lines)
> Hello,
>
> as there has been a new stable release in the meantime, I updated to this.
> I also simplified the package a bit, maybe due to the new release one
> substitute did not apply any more, another one did not seem to be necessary
> regardless, and several "substitute*" on the same file can be combined into
> one expression. I then set PREFIX and used it in a substitution, which
> makes some CFLAGS unnecessary, and others are there by default in the
> current Makefile. Finally I made the description a bit more neutral.
>
> The resulting calc binary seems to work, if you are happy with the
> package, I could push it.
>
> Andreas
>
> [2. text/plain; 0001-gnu-Add-calc.patch]...
A
A
Andreas Enge wrote on 26 Jul 2023 16:35
(name . Distopico)(address . distopico@riseup.net)(address . 64688-done@debbugs.gnu.org)
ZMEvTtdoEplcDIvH@jurong
Am Wed, Jul 26, 2023 at 09:27:20AM -0500 schrieb Distopico:
Toggle quote (2 lines)
> Tested, works fine from my side, thank you

Excellent, pushed! Closing this bug.

Andreas
Closed
?