1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages lout)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix utils)
24 #:use-module (guix build-system gnu))
27 ;; This one is a bit tricky, because it doesn't follow the GNU Build System
28 ;; rules. Instead, it has a makefile that has to be patched to set the
29 ;; prefix, etc., and it has no makefile rules to build its doc.
30 (let ((configure-phase
31 '(lambda* (#:key outputs #:allow-other-keys)
32 (let ((out (assoc-ref outputs "out"))
33 (doc (assoc-ref outputs "doc")))
34 (substitute* "makefile"
35 (("^PREFIX[[:blank:]]*=.*$")
36 (string-append "PREFIX = " out "\n"))
37 (("^LOUTLIBDIR[[:blank:]]*=.*$")
38 (string-append "LOUTLIBDIR = " out "/lib/lout\n"))
39 (("^LOUTDOCDIR[[:blank:]]*=.*$")
40 (string-append "LOUTDOCDIR = " doc "/doc/lout\n"))
41 (("^MANDIR[[:blank:]]*=.*$")
42 (string-append "MANDIR = " out "/man\n")))
44 (mkdir (string-append out "/bin"))
45 (mkdir (string-append out "/lib"))
46 (mkdir (string-append out "/man"))
47 (mkdir-p (string-append doc "/doc/lout")))))
49 '(lambda* (#:key outputs #:allow-other-keys)
50 (zero? (system* "make" "installman"))))
52 '(lambda* (#:key outputs #:allow-other-keys)
54 (assoc-ref outputs "doc"))
57 (string-append (assoc-ref outputs "out")
58 "/bin:" (getenv "PATH")))
61 (format #t "doc: building `~a'...~%" doc)
62 (with-directory-excursion doc
63 (let ((file (string-append out "/doc/lout/"
65 (and (or (file-exists? "outfile.ps")
66 (zero? (system* "lout" "-r4" "-o"
69 (copy-file "outfile.ps" file)
71 (zero? (system* "ps2pdf"
72 "-dPDFSETTINGS=/prepress"
75 (string-append out "/doc/lout/"
77 '("design" "expert" "slides" "user")))))
83 ;; FIXME: `http-get' doesn't follow redirects, hence the URL.
85 "http://download-mirror.savannah.gnu.org/releases/lout/lout-"
89 "12gkyqrn0kaa8xq7sc7v3wm407pz2fxg9ngc75aybhi5z825b9vq"))))
90 (build-system gnu-build-system) ; actually, just a makefile
91 (outputs '("out" "doc"))
93 `(;; FIXME: Add dependency on Ghostscript.
94 ;; ("ghostscript" ,(lambda _
95 ;; (nixpkgs-derivation "ghostscript")))
97 (arguments `(#:modules ((guix build utils)
98 (guix build gnu-build-system)
99 (srfi srfi-1)) ; we need SRFI-1
100 #:tests? #f ; no "check" target
102 ;; Customize the build phases.
103 #:phases (alist-replace
104 'configure ,configure-phase
107 'install 'install-man-pages
111 'install 'install-doc
113 %standard-phases)))))
114 (synopsis "Lout, a document layout system similar in style to LaTeX")
116 "The Lout document formatting system is now reads a high-level description of
117 a document similar in style to LaTeX and produces a PostScript or plain text
120 Lout offers an unprecedented range of advanced features, including optimal
121 paragraph and page breaking, automatic hyphenation, PostScript EPS file
122 inclusion and generation, equation formatting, tables, diagrams, rotation and
123 scaling, sorted indexes, bibliographic databases, running headers and
124 odd-even pages, automatic cross referencing, multilingual documents including
125 hyphenation (most European languages are supported), formatting of computer
126 programs, and much more, all ready to use. Furthermore, Lout is easily
127 extended with definitions which are very much easier to write than troff of
128 TeX macros because Lout is a high-level, purely functional language, the
129 outcome of an eight-year research project that went back to the
132 (home-page "http://savannah.nongnu.org/projects/lout/"))))