You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
5.9 KiB

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