Subject: [bug#62554] [PATCH] gnu: Add book-r5rs.

From: Antero Mejr <[email-masked]>
Date: Fri, 31 Mar 2023 03:28:41 +0000

* gnu/packages/book-software.scm (book-r5rs): New variable.
---
Please apply this patch last.
This patch is for the R5RS spec document, in PDF and Info formats.
Not sure what conventions would work best, but here I used:
1. package definitions for books/documents go into the file
   "book-[type].scm".
2. package definition names are formatted "book-[shortname]".
3. PDF is installed into share/doc/shortname.
4. other formats go into the appropriate path for their file type,
   or share/doc/shortname.

I think distributing books and documentation through Guix, especially
technical or FOSS-related, is an interesting idea.
Maybe these packages could go in the same .scm file as iyzsong's package for
the book "Free as in Freedom":
https://issues.guix.gnu.org/62545

I would be interested to hear what others think about books in Guix.
Would we want to limit to technical books? What about translations?
Has this already been proposed somewhere?

 gnu/packages/book-software.scm | 38 ++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/book-software.scm b/gnu/packages/book-software.scm
index ca4e47b89e..35ad76399e 100644
--- a/gnu/packages/book-software.scm
+++ b/gnu/packages/book-software.scm
@@ -48,3 +48,41 @@ (define-public rrrs2txi
 translates the LaTeX r3rs, r4rs, and r5rs to texinfo format (r3rs.txi,
 r4rs.txi, and r5rs.txi).")
     (license license:bsd-3)))
+
+(define-public book-r5rs
+  (package
+    (name "book-r5rs")
+    (version "5")
+    (source (origin
+              (method url-fetch)
+              (uri
+               "https://groups.csail.mit.edu/mac/ftpdir/scheme-reports/r5rs.tar.gz")
+              (sha256
+               (base32
+                "12c6087zdffigmdl9bx1xv71si9jfpffsbpimivx3j80j8hvxrci"))))
+    (build-system copy-build-system)
+    (arguments
+     (list #:phases #~(modify-phases %standard-phases
+                        (add-before 'install 'build
+                          (lambda _
+                            (invoke "pdflatex" "r5rs.tex")
+                            (invoke "pdflatex" "r5rs.tex")
+                            (system* "scm" "-f" ;expected to fail
+                                     (string-append
+                                      #$(this-package-native-input "rrrs2txi")
+                                      "/lib/rrrs2txi.scm")
+                                     "-e" "(go)")
+                            ;; forcing because the online txi is broken too
+                            (invoke "makeinfo" "--force" "r5rs.txi"))))
+           #:install-plan #~'(("r5rs.pdf" "share/doc/r5rs/")
+                              ("r5rs.info" "share/info/"))))
+    (native-inputs (list rrrs2txi scm texinfo
+                         (texlive-updmap.cfg (list texlive-fonts-ec))))
+    (home-page "https://people.csail.mit.edu/jaffer/Scheme.html")
+    (synopsis "Specification for the R5RS implementation of Scheme")
+    (description
+     "The report gives a defining description of the programming language
+Scheme.  Scheme is a statically scoped and properly tail-recursive dialect of
+the Lisp programming language.")
+    (license (license:non-copyleft
+              "https://people.csail.mit.edu/jaffer/Scheme_TERMS.html"))))
-- 
2.38.1