Hello,

I am writing package definitions for a certain Texinfo document, the
r7rs-small.  Each package would create another file format, so:

r7rs-small-info, r7rs-small-pdf, r7rs-small-epub, etc.

I am having problems generating epub because the native-input texinfo
package does not accept the `--epub3` (or `--epub`) flag.  I have
tried adding the perl-archive-zip package as well, but that did not
work.

Attached is the script with the package definitions.

p.s., if you have any criticism regarding the structure of the package
definition and the (lack of?) wisdom in defining different packages
using a single procedure, please provide them.
;;; Kakafarm's Guix Channel
;;; Copyright © 2023-2024 Yuval Langer <yuval.lan...@gmail.com>
;;;
;;; This file is part of Kakafarm's Guix Channel.
;;;
;;; Kakafarm's Guix Channel is free software; you can redistribute it
;;; and/or modify it under the terms of the GNU General Public License
;;; as published by the Free Software Foundation; either version 3 of
;;; the License, or (at your option) any later version.
;;;
;;; Kakafarm's Guix Channel is distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;;; See the GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Kakafarm's Guix Channel.  If not, see
;;; <http://www.gnu.org/licenses/>.

(define-module (kakafarm packages texinfo-documents)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages perl-compression)
  #:use-module (gnu packages tex)
  #:use-module (gnu packages texinfo)

  #:use-module (guix build-system copy)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses)
                #:select (non-copyleft))
  #:use-module (guix packages))

(define-public (r7rs-small-texinfo target-format)
  (let ((commit "38a703976ea6353e32b52a5187dbdaf77fb2f050")
        (revision "3"))
    (package
      (name (string-append "r7rs-small-" target-format))
      (version (git-version "0.1.0" revision commit))
      (home-page "https://codeberg.org/Zipheir/r7rs-small-texinfo/";)
      (source
       (origin
         (uri (git-reference
               (url home-page)
               (commit commit)))
         (method git-fetch)
         (file-name (git-file-name name version))
         (sha256
          (base32 "1fr02fyhiwd364jkfy1n5w31pq3kx1rl5w634421g05702yb47x3"))))
      (native-inputs (list bash
                           coreutils
                           perl-archive-zip
                           texinfo
                           texlive-scheme-small
                           texlive-texinfo))
      (inputs '())
      (build-system copy-build-system)
      (arguments
       (list
        #:install-plan #~`((,(string-append "r7rs-small."
                                            #$target-format) ,(string-append
                                                               "share/"
                                                               #$target-format
                                                               "/")))
        #:phases #~(modify-phases %standard-phases
                     (add-after 'unpack 'compile-the-files
                       (lambda _
                         (let* ((source-directory-path (string-append (getcwd)
                                                        "/doc/r7rs-small"))
                                (target-directory-path (string-append #$output
                                                        "/share/"
                                                        #$target-format)))
                           (chdir source-directory-path)
                           (system* "bash" "build.sh"
                                    #$target-format)
                           (mkdir-p target-directory-path)
                           (copy-file (string-append "r7rs-small."
                                                     #$target-format)
                                      (string-append target-directory-path
                                                     "/r7rs-small."
                                                     #$target-format))))))))
      (synopsis (string-append
                 "R7RS Small standard of the Scheme programming language in "
                 target-format " format"))
      (description (string-append
                    "Revised^7 Report of the Algorithmic Language Scheme adapted to Texinfo format.

This package installs the  "
                    target-format " version of the document."))
      (license (non-copyleft "file://COPYING")))))

(define-public r7rs-small-info
  (r7rs-small-texinfo "info"))

(define-public r7rs-small-pdf
  (r7rs-small-texinfo "pdf"))

(define-public r7rs-small-html
  (r7rs-small-texinfo "html"))

(define-public r7rs-small-epub
  (r7rs-small-texinfo "epub"))

Reply via email to