diff mbox series

[bug#64688,v2] gnu: Add calc.

Message ID 20230718112911.31050-1-distopico@riseup.net
State New
Headers show
Series [bug#64688,v2] gnu: Add calc. | expand

Commit Message

Distopico July 18, 2023, 11:28 a.m. UTC
* gnu/packages/maths.scm (calc): New variable.
---
 Remove unnecesary open/libre substitute.

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

Comments

Distopico July 24, 2023, 3:27 p.m. UTC | #1
On 2023-07-24, Andreas Enge <andreas@enge.fr> wrote:

> 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

>
> 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

>> +                  (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?
diff mbox series

Patch

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")