gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / lout.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages lout)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages ghostscript))
26
27 (define-public lout
28 (package
29 (name "lout")
30 (version "3.40")
31 (source (origin
32 (method url-fetch)
33 (uri (string-append "mirror://savannah/lout/lout-"
34 version ".tar.gz"))
35 (sha256
36 (base32
37 "1gb8vb1wl7ikn269dd1c7ihqhkyrwk19jwx5kd0rdvbk6g7g25ix"))))
38 (build-system gnu-build-system) ; actually, just a makefile
39 (outputs '("out" "doc"))
40 (native-inputs
41 `(("ghostscript" ,ghostscript)))
42 (arguments
43 `(#:modules ((guix build utils)
44 (guix build gnu-build-system)
45 (srfi srfi-1)) ; we need SRFI-1
46 #:tests? #f ; no "check" target
47 #:phases
48 (modify-phases %standard-phases
49 ;; This package is a bit tricky, because it doesn't follow the GNU
50 ;; Build System rules. Instead, it has a makefile that has to be
51 ;; patched to set the prefix, etc., and it has no makefile rules to
52 ;; build its documentation.
53 (replace 'configure
54 (lambda* (#:key outputs #:allow-other-keys)
55 (let ((out (assoc-ref outputs "out"))
56 (doc (assoc-ref outputs "doc")))
57 (substitute* "makefile"
58 (("^PREFIX[[:blank:]]*=.*$")
59 (string-append "PREFIX = " out "\n"))
60 (("^LOUTLIBDIR[[:blank:]]*=.*$")
61 (string-append "LOUTLIBDIR = " out "/lib/lout\n"))
62 (("^LOUTDOCDIR[[:blank:]]*=.*$")
63 (string-append "LOUTDOCDIR = " doc "/share/doc/lout\n"))
64 (("^MANDIR[[:blank:]]*=.*$")
65 (string-append "MANDIR = " out "/man\n")))
66 (mkdir out)
67 (mkdir (string-append out "/bin"))
68 (mkdir (string-append out "/lib"))
69 (mkdir (string-append out "/man"))
70 (mkdir-p (string-append doc "/share/doc/lout"))
71 #t)))
72 (add-after 'install 'install-man-pages
73 (lambda* (#:key outputs #:allow-other-keys)
74 (invoke "make" "installman")
75 #t))
76 (add-after 'install 'install-doc
77 (lambda* (#:key outputs #:allow-other-keys)
78 (let ((out (assoc-ref outputs "doc")))
79 (setenv "PATH"
80 (string-append (assoc-ref outputs "out")
81 "/bin:" (getenv "PATH")))
82 (with-directory-excursion "doc"
83 (every (lambda (doc)
84 (format #t "doc: building `~a'...~%" doc)
85 (with-directory-excursion doc
86 (let ((file (string-append out "/share/doc/lout/"
87 doc ".ps")))
88 (unless (file-exists? "outfile.ps")
89 (invoke "lout" "-r4" "-o"
90 "outfile.ps" "all"))
91 (copy-file "outfile.ps" file)
92 (invoke "ps2pdf"
93 "-dPDFSETTINGS=/prepress"
94 "-sPAPERSIZE=a4"
95 file
96 (string-append out "/share/doc/lout/"
97 doc ".pdf")))))
98 '("design" "expert" "slides" "user")))
99 #t))))))
100 (synopsis "Document layout system")
101 (description
102 "The Lout document formatting system reads a high-level description of
103 a document similar in style to LaTeX and produces a PostScript or plain text
104 output file.
105
106 Lout offers an unprecedented range of advanced features, including optimal
107 paragraph and page breaking, automatic hyphenation, PostScript EPS file
108 inclusion and generation, equation formatting, tables, diagrams, rotation and
109 scaling, sorted indexes, bibliographic databases, running headers and
110 odd-even pages, automatic cross referencing, multilingual documents including
111 hyphenation (most European languages are supported), formatting of computer
112 programs, and much more, all ready to use. Furthermore, Lout is easily
113 extended with definitions which are very much easier to write than troff of
114 TeX macros because Lout is a high-level, purely functional language, the
115 outcome of an eight-year research project that went back to the
116 beginning.")
117 (license gpl3+)
118 (home-page "https://savannah.nongnu.org/projects/lout/")))