summary refs log tree commit diff
path: root/gnu/packages/finance.scm
diff options
context:
space:
mode:
authorPhilip McGrath <philip@philipmcgrath.com>2022-07-06 01:32:42 -0400
committerLudovic Courtès <ludo@gnu.org>2022-07-18 00:21:31 +0200
commit87a10e315f60a198875dec31665b6a8775c9ca9c (patch)
tree85da01a5240c65c664492db7db7ee07c7468f225 /gnu/packages/finance.scm
parent44857d4baaa806f5c6e11fff2e0ba3ba1caaeafc (diff)
downloadguix-87a10e315f60a198875dec31665b6a8775c9ca9c.tar.gz
gnu: Add gbonds.
* gnu/packages/finance.scm (gbonds): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/finance.scm')
-rw-r--r--gnu/packages/finance.scm122
1 files changed, 122 insertions, 0 deletions
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 96dfc34075..89f5fc055c 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2022 Kyle Meyer <kyle@kyleam.com>
 ;;; Copyright © 2022 Aleksandr Vityazev <avityazev@posteo.org>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,7 @@
   #:use-module (guix deprecation)
   #:use-module (guix gexp)
   #:use-module (guix utils)
+  #:use-module (srfi srfi-26)
   #:use-module (gnu packages)
   #:use-module (gnu packages aidc)
   #:use-module (gnu packages autotools)
@@ -1350,6 +1352,126 @@ information.")
     (home-page "https://grisbi.org")
     (license license:gpl2+)))
 
+(define-public gbonds
+  ;; The last "upstream" commit is from about 2008, but the Debian maintainers
+  ;; have effectively become the upstream with an extensive series of patches.
+  ;; However, the patches are stored "unapplied", and some enhancements (like
+  ;; a decade's worth of new data files) rely on the Debian packaging tools,
+  ;; so building normally even from the patched sources would miss them.
+  ;; Here, we do all of the patching in the origin, so that the result of
+  ;; `guix build --source` is actually useable for building without Guix.
+  (let ((revision "1")
+        (commit "3054ee2f90cc7c03ed6b131177d09701c7a4fced"))
+    (package
+      (name "gbonds")
+      (version (git-version "2.0.3" revision commit))
+      (source
+       (let ((unapplied
+              (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://salsa.debian.org/debian/gbonds.git")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "1sqzzfymzxbnq6cjs5wvjbnvcrkdlimlmj2h7mlcaa9qqdpsgfki"))
+                (file-name (git-file-name name version)))))
+         (origin
+           (inherit unapplied)
+           (patches
+            ;; The order matters.
+            (map (cut file-append unapplied "/debian/patches/" <>)
+                 '("desktop-file"
+                   "POTFILES"
+                   "POTFILES.missing"
+                   "commands-compile"
+                   "egg-recent-model-compile"
+                   "gbonds-name-case"
+                   "copyright-update"
+                   "website-url"
+                   "link-libm"
+                   "xmldocs"
+                   "configure-compiler-warnings"
+                   "omf"
+                   "desktop-file-keywords"
+                   "replace-g_strcasecmp"
+                   "gtk3-port"
+                   "gsettings-port"
+                   "no-rarian-compat"
+                   "extern-gb_prefs"
+                   "use-treasury-api.patch")))
+           (snippet
+            #~(begin
+                (use-modules (guix build utils)
+                             (srfi srfi-26))
+
+                ;; Remove generated files, which have not been patched.
+                (for-each (lambda (pth)
+                            (when (file-exists? pth)
+                              (delete-file pth)))
+                          `(;; Things `make maintainer-clean` would do.
+                            "gbonds.spec"
+                            "src/marshal.c"
+                            "src/marshal.h"
+                            ;; Things upstream's distclean missed.
+                            "intltool-extract"
+                            "intltool-merge"
+                            "intltool-update"
+                            ;; Autotools generated files.
+                            "aclocal.m4"
+                            "config.guess"
+                            "config.h.in"
+                            "config.log"
+                            "config.sub"
+                            "configure"
+                            "depcomp"
+                            "intltool-extract.in"
+                            "intltool-merge.in"
+                            "intltool-update.in"
+                            "ltmain.sh"
+                            ,@(find-files "." "^Makefile\\.in$")))
+
+                ;; Arrange for `make install` to handle the additional
+                ;; redemption data files added in the Debian packaging.
+                (let* ((new-redemption-data-files
+                        (find-files "debian" "^sb[[:digit:]]+\\.asc$"))
+                       (names
+                        (map (cut substring <> (string-length "debian/"))
+                             new-redemption-data-files)))
+                  (for-each rename-file
+                            new-redemption-data-files
+                            (map (cut string-append "data/" <>)
+                                 names))
+                  (substitute* "data/Makefile.am"
+                    (("redemption_DATA = \\\\")
+                     (apply string-append
+                            "redemption_DATA = \\"
+                            (map (cut string-append "\n\t" <> " \\")
+                                 names))))))))))
+      (outputs '("out" "debug"))
+      (inputs (list gtk+
+                    glib
+                    json-glib
+                    libxml2
+                    libsoup-minimal-2
+                    cairo
+                    pango))
+      (native-inputs (list autoconf
+                           automake
+                           intltool
+                           libtool
+                           patch
+                           pkg-config))
+      (build-system glib-or-gtk-build-system)
+      (home-page "http://gbonds.sourceforge.net")
+      (synopsis "@acronym{U.S.} Savings Bond inventory program for GNOME")
+      (description
+       "GBonds is a @acronym{U.S.} Savings Bond inventory program for the
+GNOME desktop environment.  It allows you to track the current redemption
+value and performance of your @acronym{U.S.} Savings Bonds and keep a valuable
+record of the bonds you own.")
+      (license license:gpl2+))))
+
 (define-public trezord-udev-rules
   (let ((commit "bff7fdfe436c727982cc553bdfb29a9021b423b0")
         (revision "0"))