Subject: [PATCH 2/5] gnu: Add fortunes-jkirchartz.

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 23 Jul 2022 17:11:16 +0200

* gnu/packages/toys.scm (fortunes-jkirchartz): New variable.
---
 gnu/packages/toys.scm | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/toys.scm b/gnu/packages/toys.scm
index b3e4cc4f84..556f196a55 100644
--- a/gnu/packages/toys.scm
+++ b/gnu/packages/toys.scm
@@ -23,6 +23,7 @@
 
 (define-module (gnu packages toys)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages gtk)
@@ -35,8 +36,10 @@ (define-module (gnu packages toys)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system meson)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
@@ -69,6 +72,52 @@ (define-public daikichi
             (variable "DAIFUKU_FORTUNE_PATH")
             (files '("share/fortunes")))))))
 
+(define-public fortunes-jkirchartz
+  (let ((commit "2e32ba0a57e3842dc06c8128d880ab4c8ec3aefc")
+        (revision "2022.05.23"))        ; Use a date rather than a number
+    (package
+      (name "fortunes-jkirchartz")
+      (version (git-version "0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/JKirchartz/fortunes")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1ym4ldzww5yfd76q7zvhi491bqlykfjnc215bqx1cbj0c8ndb2l4"))
+                (snippet
+                 #~(for-each delete-file
+                             ;; incompatible license
+                             '("BibleAbridged")))))
+      ;; To read the fortunes, but also to compile them.
+      ;; No support for cross-compilation yet
+      (build-system copy-build-system)
+      (propagated-inputs (list daikichi))
+      (native-inputs (list gnu-make))
+      (arguments
+       (list #:install-plan
+             #~`(("." "share/fortunes" #:include-regexp ("\\.dat$")))
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'patch-source
+                   (lambda _
+                     (substitute* "showerthoughts"
+                       (("&lt;") "<")
+                       (("&gt;") ">")
+                       (("&amp;") "&"))
+                     (substitute* "Makefile"
+                       (("strfile") "daikichi pack"))))
+                 (add-before 'install 'build
+                   (lambda _
+                     (invoke "make"))))))
+      (home-page "https://github.com/JKirchartz/fortunes")
+      (synopsis "Collection of fortunes")
+      (description "This package contains a large collection of fortunes drawn
+from sources all around the world.")
+      (license license:unlicense))))
+
 (define-public lolcat
   (let ((commit "35dca3d0a381496d7195cd78f5b24aa7b62f2154")
         (revision "0"))
-- 
2.37.0