projects/guix·blob javascript-team · refs

124 lines · 5.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2013, 2025 Ludovic Courtès <[email protected]>
3;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
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 git-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.43.4")
31
32 ;; The original version at <https://savannah.nongnu.org/projects/lout/> is
33 ;; effectively abandoned, not receiving build fixes and the likes, and
34 ;; most distros have been providing this one instead.
35 (home-page "https://github.com/william8000/lout")
36
37 (source (origin
38 (method git-fetch)
39 (uri (git-reference (url home-page)
40 (commit version)))
41 (file-name (git-file-name name version))
42 (sha256
43 (base32
44 "09s6mcimvhw96i3vncqa8cz04xcq9x3qir8m1nzqfny8vdwyz35n"))))
45 (build-system gnu-build-system) ; actually, just a makefile
46 (outputs '("out" "doc"))
47 (native-inputs
48 (list ghostscript))
49 (arguments
50 `(#:modules ((guix build utils)
51 (guix build gnu-build-system)
52 (srfi srfi-1)) ; we need SRFI-1
53 #:tests? #f ; no "check" target
54 #:phases
55 (modify-phases %standard-phases
56 ;; This package is a bit tricky, because it doesn't follow the GNU
57 ;; Build System rules. Instead, it has a makefile that has to be
58 ;; patched to set the prefix, etc., and it has no makefile rules to
59 ;; build its documentation.
60 (replace 'configure
61 (lambda* (#:key outputs #:allow-other-keys)
62 (let ((out (assoc-ref outputs "out"))
63 (doc (assoc-ref outputs "doc")))
64 (substitute* "makefile"
65 (("^PREFIX[[:blank:]]*=.*$")
66 (string-append "PREFIX = " out "\n"))
67 (("^LOUTLIBDIR[[:blank:]]*=.*$")
68 (string-append "LOUTLIBDIR = " out "/lib/lout\n"))
69 (("^LOUTDOCDIR[[:blank:]]*=.*$")
70 (string-append "LOUTDOCDIR = " doc "/share/doc/lout\n"))
71 (("^MANDIR[[:blank:]]*=.*$")
72 (string-append "MANDIR = " out "/man\n")))
73 (mkdir out)
74 (mkdir (string-append out "/bin"))
75 (mkdir (string-append out "/lib"))
76 (mkdir (string-append out "/man"))
77 (mkdir-p (string-append doc "/share/doc/lout"))
78 #t)))
79 (add-after 'install 'install-man-pages
80 (lambda* (#:key outputs #:allow-other-keys)
81 (invoke "make" "installman")
82 #t))
83 (add-after 'install 'install-doc
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let ((out (assoc-ref outputs "doc")))
86 (setenv "PATH"
87 (string-append (assoc-ref outputs "out")
88 "/bin:" (getenv "PATH")))
89 (with-directory-excursion "doc"
90 (every (lambda (doc)
91 (format #t "doc: building `~a'...~%" doc)
92 (with-directory-excursion doc
93 (let ((file (string-append out "/share/doc/lout/"
94 doc ".ps")))
95 (unless (file-exists? "outfile.ps")
96 (invoke "lout" "-r4" "-o"
97 "outfile.ps" "all"))
98 (copy-file "outfile.ps" file)
99 (invoke "ps2pdf"
100 "-dPDFSETTINGS=/prepress"
101 "-sPAPERSIZE=a4"
102 file
103 (string-append out "/share/doc/lout/"
104 doc ".pdf")))))
105 '("design" "expert" "slides" "user")))
106 #t))))))
107 (synopsis "Document layout system")
108 (description
109 "The Lout document formatting system reads a high-level description of
110a document similar in style to LaTeX and produces a PostScript or plain text
111output file.
112
113Lout offers an unprecedented range of advanced features, including optimal
114paragraph and page breaking, automatic hyphenation, PostScript EPS file
115inclusion and generation, equation formatting, tables, diagrams, rotation and
116scaling, sorted indexes, bibliographic databases, running headers and
117odd-even pages, automatic cross referencing, multilingual documents including
118hyphenation (most European languages are supported), formatting of computer
119programs, and much more, all ready to use. Furthermore, Lout is easily
120extended with definitions which are very much easier to write than troff of
121TeX macros because Lout is a high-level, purely functional language, the
122outcome of an eight-year research project that went back to the
123beginning.")
124 (license gpl3+)))