diff mbox series

[bug#60827,v3] gnu: Add dozenal.

Message ID MN2PR20MB2605C37DBE956CB9A6D6886CACC89@MN2PR20MB2605.namprd20.prod.outlook.com
State New
Headers show
Series [bug#60827,v3] gnu: Add dozenal. | expand

Commit Message

Jake Leporte Jan. 23, 2023, 10:43 p.m. UTC
Got it- thanks for the correction!  I've re-written the patch to use G-Exps.

The `guix style`-reccomended changes involved writing #$output:gui as (ungexp
output "gui"), and various indentation changes that made some of the
'split-output code tough to read, in my opinion, so this patch deviates from
those recommendations a bit.  Let me know if you'd rather I take the `guix
style` output directly.

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


base-commit: 2b1e5cb6a82e60298b620ef8d2dbf90cfb925015
prerequisite-patch-id: 55ebfdbee35b36ac06da23b716337ecfef350452
prerequisite-patch-id: 12b9437ce6c6849e83e52cabad56672a5c73e2a7
prerequisite-patch-id: 52c97b6e4d8d4b78217423a3f1323d95a609de8c

Comments

Bruno Victal Jan. 23, 2023, 11:24 p.m. UTC | #1
On 2023-01-23 22:43, Jake Leporte wrote:
> Got it- thanks for the correction!  I've re-written the patch to use G-Exps.
> 
> The `guix style`-reccomended changes involved writing #$output:gui as (ungexp
> output "gui"), and various indentation changes that made some of the
> 'split-output code tough to read, in my opinion, so this patch deviates from
> those recommendations a bit.  Let me know if you'd rather I take the `guix
> style` output directly.

Sometimes guix style can make things worse, there's no problem in deviating from it
as long it doesn't result in a worse formatting.


Cheers,
Bruno
\( Jan. 24, 2023, 7:02 a.m. UTC | #2
On Mon Jan 23, 2023 at 10:43 PM GMT, Jake Leporte wrote:
> +                    `("PERL5LIB" prefix
> +                      (,(string-append #$perl-tk perl-dir)
> +                       ,(string-append #$perl-par perl-dir)))

Don't refer to dependencies like this; use

  #$(this-package-input "perl-tk")

instead.

    -- (
diff mbox series

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d9bc292..2b2bf10 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -103,6 +103,7 @@  (define-module (gnu packages maths)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages calendar)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
@@ -124,6 +125,7 @@  (define-module (gnu packages maths)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages groff)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
@@ -172,6 +174,7 @@  (define-module (gnu packages maths)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages wxwidgets)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
@@ -455,6 +458,108 @@  (define-public dionysus
     (license license:gpl3+)
     (home-page "https://www.gnu.org/software/dionysus/")))
 
+(define-public dozenal
+  (let ((revision "1")
+        (commit "328bc03ad544179f2cccda36763358c4216f188e"))
+    (package
+      (name "dozenal")
+      (version (git-version "12010904-3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://codeberg.org/dgoodmaniii/dozenal")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0knwfwjqdv854l5ny7csdpvp7r0md6a2k43a1l2lkyw9k3cglpph"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        ;; Some test scripts are included, but no makefile-driven
+        ;; tests, and they are all quite manual to run and check
+        #:tests? #f
+        ;; Running with `make -j' causes the build to fail.
+        ;; This is likely because this project uses the
+        ;; "recursive make" structure, where each
+        ;; subdirectory contains its own make file, which is
+        ;; called by the top-level makefile.
+        #:parallel-build? #f
+        #:make-flags
+        #~(list (string-append "prefix=" #$output))
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'chdir
+              (lambda _
+                (chdir "dozenal")))
+            (add-after 'chdir 'patch-lua-references
+              (lambda _
+                (let ((lua-name (strip-store-file-name #$lua)))
+                  (substitute* '("dozcal/Makefile"
+                                 "dozlua/Makefile")
+                    (("lua52")
+                     (string-take lua-name
+                                  (string-rindex lua-name #\.)))))))
+            (delete 'configure)
+            (add-before 'install 'make-bin-dir
+              (lambda _
+                (mkdir-p (string-append #$output "/bin"))))
+            (add-after 'install 'install-html-docs
+              (lambda _
+                (invoke "make"
+                        (string-append "prefix=" #$output)
+                        "installhtml")))
+            (add-after 'install-html-docs 'split-outputs
+              (lambda* (#:key inputs outputs #:allow-other-keys)
+                (for-each
+                 (lambda (prog)
+                   (let ((orig (string-append #$output "/bin/" prog))
+                         (dst (string-append #$output:gui "/bin/" prog))
+                         (man-orig (string-append #$output
+                                                  "/share/man/man1/"
+                                                  prog ".1"))
+                         (man-dst (string-append #$output:gui
+                                                 "/share/man/man1/"
+                                                 prog ".1")))
+                     (mkdir-p (dirname dst))
+                     (copy-file orig dst)
+                     (delete-file orig)
+                     (mkdir-p (dirname man-dst))
+                     (copy-file man-orig man-dst)
+                     (delete-file man-orig)))
+                 '("xdozdc" "gdozdc"))
+                (let ((perl-dir "/lib/perl5/site-perl"))
+                  (wrap-program
+                      (string-append #$output:gui "/bin/" "gdozdc")
+                    `("PERL5LIB" prefix
+                      (,(string-append #$perl-tk perl-dir)
+                       ,(string-append #$perl-par perl-dir)))
+                    `("PATH" prefix
+                      (,(string-append #$output "/bin"))))))))))
+      (outputs '("out" "gui"))
+      (native-inputs (list groff pkg-config))
+      (inputs (list bash-minimal ;since wrap-program is used
+                    ncurses
+                    libhdate
+                    lua
+                    xforms))
+      (propagated-inputs (list perl perl-tk perl-par))
+      (synopsis
+       "Suite of dozenal programs, including converters, a calculator, and date
+program")
+      (description
+       "The dozenal suite is a set of programs designed to assist with
+working in the dozenal (also called \"duodecimal\" or \"base twelve\")
+system.  It includes number converters (dozenal-to-decimal and
+decimal-to-dozenal), an RPN calculator, a graphical calculator, a
+metric system converter (works with imperial, U.S. customary, SI
+metric, and the dozenal TGM), a pretty-printer for dozenal numbers, a
+date-and-time program, and a dozenal calendar programs, complete with
+events and to-dos.")
+      (home-page "https://codeberg.org/dgoodmaniii/dozenal")
+      (license license:gpl3+))))
+
 (define-public dsfmt
   (package
     (name "dsfmt")